diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-06-11 11:08:31 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-06-11 11:09:46 +1000 |
commit | 421f5dfdd8b566dc07b4606f0edec487b3ead3d9 (patch) | |
tree | ec2baaaa48909ad902f3aa2f28e652af93f393b2 | |
parent | f85552aa452d5f575fee9f6031a33ca79bdc3cc8 (diff) |
DRI2: Don't return junk reply instead of blocking in glXWaitForSbcOML()
DRI2WaitSBC() didn't block if requested targetSBC wasn't yet reached.
Instead it returned a xreply with uninitialized junk return values, then
blocked the connection until targetSBC was reached.
Therefore the client didn't block, but continued with bogus return
values from glXWaitForSbcOML.
This patch fixes the problem by implementing DRI2WaitSBC similar
to the clean and proven DRI2WaitMSC implementation.
Signed-off-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit b3548612c7943011f79a910f9a59bb975984d8a6)
Conflicts:
hw/xfree86/dri2/dri2ext.c
-rw-r--r-- | hw/xfree86/dri2/dri2.c | 10 | ||||
-rw-r--r-- | hw/xfree86/dri2/dri2.h | 3 | ||||
-rw-r--r-- | hw/xfree86/dri2/dri2ext.c | 16 |
3 files changed, 8 insertions, 21 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index 2bdb73392..7d670ffa3 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -768,8 +768,7 @@ DRI2WaitMSC(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc, } int -DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc, - CARD64 *ust, CARD64 *msc, CARD64 *sbc) +DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc) { DRI2DrawablePtr pPriv; @@ -783,14 +782,13 @@ DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, CARD64 target_sbc, if (target_sbc == 0) target_sbc = pPriv->swap_count + pPriv->swapsPending; - /* If current swap count already >= target_sbc, + /* If current swap count already >= target_sbc, reply and * return immediately with (ust, msc, sbc) triplet of * most recent completed swap. */ if (pPriv->swap_count >= target_sbc) { - *sbc = pPriv->swap_count; - *msc = pPriv->last_swap_msc; - *ust = pPriv->last_swap_ust; + ProcDRI2WaitMSCReply(client, pPriv->last_swap_ust, + pPriv->last_swap_msc, pPriv->swap_count); return Success; } diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h index ce8a5df41..de94c0b55 100644 --- a/hw/xfree86/dri2/dri2.h +++ b/hw/xfree86/dri2/dri2.h @@ -251,8 +251,7 @@ extern _X_EXPORT int DRI2WaitMSC(ClientPtr client, DrawablePtr pDrawable, extern _X_EXPORT int ProcDRI2WaitMSCReply(ClientPtr client, CARD64 ust, CARD64 msc, CARD64 sbc); extern _X_EXPORT int DRI2WaitSBC(ClientPtr client, DrawablePtr pDraw, - CARD64 target_sbc, CARD64 *ust, CARD64 *msc, - CARD64 *sbc); + CARD64 target_sbc); extern _X_EXPORT Bool DRI2ThrottleClient(ClientPtr client, DrawablePtr pDraw); extern _X_EXPORT Bool DRI2CanFlip(DrawablePtr pDraw); diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 094d54dc0..627dfc04d 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -516,9 +516,8 @@ static int ProcDRI2WaitSBC(ClientPtr client) { REQUEST(xDRI2WaitSBCReq); - xDRI2MSCReply rep; DrawablePtr pDrawable; - CARD64 target, ust, msc, sbc; + CARD64 target; int status; REQUEST_SIZE_MATCH(xDRI2WaitSBCReq); @@ -528,18 +527,9 @@ ProcDRI2WaitSBC(ClientPtr client) return status; target = vals_to_card64(stuff->target_sbc_lo, stuff->target_sbc_hi); - status = DRI2WaitSBC(client, pDrawable, target, &ust, &msc, &sbc); - if (status != Success) - return status; + status = DRI2WaitSBC(client, pDrawable, target); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - load_msc_reply(&rep, ust, msc, sbc); - - WriteToClient(client, sizeof(xDRI2MSCReply), &rep); - - return client->noClientException; + return status; } static int |