Mesa (master): st/mesa: if a fence isn't returned, assume it's signalled

Marek Olšák mareko at kemper.freedesktop.org
Sun Jul 5 13:09:52 UTC 2015


Module: Mesa
Branch: master
Commit: 872ede6fd136c7f9701cc60268ab195a48e75e67
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=872ede6fd136c7f9701cc60268ab195a48e75e67

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Jun 27 13:57:06 2015 +0200

st/mesa: if a fence isn't returned, assume it's signalled

The reason might be that no commands have been submitted before the flush
and the GPU is idle.

---

 src/mesa/state_tracker/st_cb_syncobj.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c
index d23c93d..ec2687f 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -81,7 +81,13 @@ static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
    struct pipe_screen *screen = st_context(ctx)->pipe->screen;
    struct st_sync_object *so = (struct st_sync_object*)obj;
 
-   if (so->fence && screen->fence_finish(screen, so->fence, 0)) {
+   /* If the fence doesn't exist, assume it's signalled. */
+   if (!so->fence) {
+      so->b.StatusFlag = GL_TRUE;
+      return;
+   }
+
+   if (screen->fence_finish(screen, so->fence, 0)) {
       screen->fence_reference(screen, &so->fence, NULL);
       so->b.StatusFlag = GL_TRUE;
    }
@@ -94,6 +100,12 @@ static void st_client_wait_sync(struct gl_context *ctx,
    struct pipe_screen *screen = st_context(ctx)->pipe->screen;
    struct st_sync_object *so = (struct st_sync_object*)obj;
 
+   /* If the fence doesn't exist, assume it's signalled. */
+   if (!so->fence) {
+      so->b.StatusFlag = GL_TRUE;
+      return;
+   }
+
    /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is
     * already called when creating a fence. */
 




More information about the mesa-commit mailing list