Mesa (9.0): mesa: don't wait in _mesa_ClientWaitSync if timeout is 0

Ian Romanick idr at kemper.freedesktop.org
Fri Sep 14 08:20:30 UTC 2012


Module: Mesa
Branch: 9.0
Commit: 405d47bbe78106f44e4283925e58a1d1ebc88455
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=405d47bbe78106f44e4283925e58a1d1ebc88455

Author: Vadim Girlin <vadimgirlin at gmail.com>
Date:   Sat Sep  1 01:02:24 2012 +0400

mesa: don't wait in _mesa_ClientWaitSync if timeout is 0

>From ARB_sync spec:

    If the value of <timeout> is zero, then ClientWaitSync does not
    block, but simply tests the current state of <sync>. TIMEOUT_EXPIRED
    will be returned in this case if <sync> is not signaled, even though
    no actual wait was performed.

Fixes random fails of the arb_sync-timeout-zero piglit test on r600g.

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
(cherry picked from commit b05a1fc156c4776d97d6ff3dcce71e6e34bac21d)

---

 src/mesa/main/syncobj.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index e1a5c6c..9f5a27e 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -326,9 +326,13 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
    if (syncObj->StatusFlag) {
       ret = GL_ALREADY_SIGNALED;
    } else {
-      ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
+      if (timeout == 0) {
+         ret = GL_TIMEOUT_EXPIRED;
+      } else {
+         ctx->Driver.ClientWaitSync(ctx, syncObj, flags, timeout);
 
-      ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
+         ret = syncObj->StatusFlag ? GL_CONDITION_SATISFIED : GL_TIMEOUT_EXPIRED;
+      }
    }
 
    _mesa_unref_sync_object(ctx, syncObj);




More information about the mesa-commit mailing list