diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-03-04 10:31:59 -0800 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-03-29 10:02:17 -0700 |
commit | b180e43977710b56ccfd6780f204ddcc952987a1 (patch) | |
tree | 5f5a3821262f2ab8e7763af548a9e1797278a5d1 | |
parent | 751e8c09d34df4b41e8d8384a3ec1bf5cb8ca028 (diff) |
DRI2: fix swapbuffers handling of SBC and target MSC
Returns expected SBC after completion of swap to caller, as required by
OML_sync_control spec, instead of the last_swap_target value.
Passes target_msc, divisor, remainder, correctly for
glXSwapBuffersMscOML() call, while retaining old behaviour for simple
glXSwapBuffers() call.
An OML swap can have a 0 target_msc, which just means it needs to
satisfy the divisor/remainder equation. Pass this down to the driver as
needed so we can support it.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index ef838ff6b..354b72434 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -632,11 +632,20 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 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. + * 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. */ - *swap_target = pPriv->last_swap_target + pPriv->swap_interval; + if (target_msc == 0 && divisor == 0 && remainder == 0) { + /* + * 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. + */ + *swap_target = pPriv->last_swap_target + pPriv->swap_interval; + } else { + /* glXSwapBuffersMscOML could have a 0 target_msc, honor it */ + *swap_target = target_msc; + } ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer, swap_target, divisor, remainder, func, data); @@ -649,6 +658,11 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, pPriv->swapsPending++; pPriv->last_swap_target = *swap_target; + /* According to spec, return expected swapbuffers count SBC after this swap + * will complete. + */ + *swap_target = pPriv->swap_count + pPriv->swapsPending; + return Success; } |