diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-03-04 09:19:13 -0800 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-03-29 10:01:07 -0700 |
commit | c4d54816f2ee4883d8f9bcf4595474fb58c95146 (patch) | |
tree | 34b4dfe4460d2ca22eee58e24148463d0c96a33c /hw | |
parent | 3083c5d0c4386cdd7083b7a83ac72fdad2f1e61e (diff) |
DRI2: fixup handling of last_swap_target
We need to initialize the swap target, which is passed to the driver to
schedule events. Rather than using -1 to indicate that the field is
uninitialized, just make sure we initialize it at drawable creation
time.
Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 48618e1a5..d60bd5e18 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -116,9 +116,11 @@ DRI2GetDrawable(DrawablePtr pDraw) int DRI2CreateDrawable(DrawablePtr pDraw) { + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); WindowPtr pWin; PixmapPtr pPixmap; DRI2DrawablePtr pPriv; + CARD64 ust; pPriv = DRI2GetDrawable(pDraw); if (pPriv != NULL) @@ -141,7 +143,10 @@ DRI2CreateDrawable(DrawablePtr pDraw) pPriv->swap_count = 0; pPriv->target_sbc = -1; pPriv->swap_interval = 1; - pPriv->last_swap_target = -1; + /* Initialize last swap target from DDX if possible */ + if (!ds->GetMSC || !(*ds->GetMSC)(pDraw, &ust, &pPriv->last_swap_target)) + pPriv->last_swap_target = 0; + pPriv->swap_limit = 1; /* default to double buffering */ if (pDraw->type == DRAWABLE_WINDOW) @@ -579,7 +584,6 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen); DRI2DrawablePtr pPriv; DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL; - CARD64 ust; int ret, i; pPriv = DRI2GetDrawable(pDraw); @@ -621,27 +625,6 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, } /* - * In the simple glXSwapBuffers case, all params will be 0, and we just - * need to schedule a swap for the last swap target + the swap interval. - * If the last swap target hasn't been set yet, call into the driver - * to get the current count. - */ - if (target_msc == 0 && divisor == 0 && remainder == 0 && - pPriv->last_swap_target < 0) { - ret = (*ds->GetMSC)(pDraw, &ust, &target_msc); - if (!ret) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[DRI2] %s: driver failed to return current MSC\n", - __func__); - return BadDrawable; - } - } - - /* First swap needs to initialize last_swap_target */ - if (pPriv->last_swap_target < 0) - pPriv->last_swap_target = target_msc; - - /* * Swap target for this swap is last swap target + swap interval since * we have to account for the current swap count, interval, and the * number of pending swaps. |