Mesa (master): st/mesa: set the ctx parameter of fence_finish

Marek Olšák mareko at kemper.freedesktop.org
Tue Aug 9 23:32:10 UTC 2016


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Aug  6 17:00:20 2016 +0200

st/mesa: set the ctx parameter of fence_finish

for deferred flushes

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/mesa/state_tracker/st_cb_syncobj.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_syncobj.c b/src/mesa/state_tracker/st_cb_syncobj.c
index 1fa1403..123925a 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -78,7 +78,8 @@ static void st_fence_sync(struct gl_context *ctx, struct gl_sync_object *obj,
 
 static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
 {
-   struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct pipe_screen *screen = pipe->screen;
    struct st_sync_object *so = (struct st_sync_object*)obj;
 
    /* If the fence doesn't exist, assume it's signalled. */
@@ -87,7 +88,7 @@ static void st_check_sync(struct gl_context *ctx, struct gl_sync_object *obj)
       return;
    }
 
-   if (screen->fence_finish(screen, NULL, so->fence, 0)) {
+   if (screen->fence_finish(screen, pipe, so->fence, 0)) {
       screen->fence_reference(screen, &so->fence, NULL);
       so->b.StatusFlag = GL_TRUE;
    }
@@ -97,7 +98,8 @@ static void st_client_wait_sync(struct gl_context *ctx,
                                 struct gl_sync_object *obj,
                                 GLbitfield flags, GLuint64 timeout)
 {
-   struct pipe_screen *screen = st_context(ctx)->pipe->screen;
+   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct pipe_screen *screen = pipe->screen;
    struct st_sync_object *so = (struct st_sync_object*)obj;
 
    /* If the fence doesn't exist, assume it's signalled. */
@@ -106,11 +108,20 @@ static void st_client_wait_sync(struct gl_context *ctx,
       return;
    }
 
-   /* We don't care about GL_SYNC_FLUSH_COMMANDS_BIT, because flush is
-    * already called when creating a fence. */
-
+   /* Section 4.1.2 of OpenGL 4.5 (Compatibility Profile) says:
+    *    [...] if ClientWaitSync is called and all of the following are true:
+    *    - the SYNC_FLUSH_COMMANDS_BIT bit is set in flags,
+    *    - sync is unsignaled when ClientWaitSync is called,
+    *    - and the calls to ClientWaitSync and FenceSync were issued from
+    *      the same context,
+    *    then the GL will behave as if the equivalent of Flush were inserted
+    *    immediately after the creation of sync.
+    *
+    * Assume GL_SYNC_FLUSH_COMMANDS_BIT is always set, because applications
+    * forget to set it.
+    */
    if (so->fence &&
-       screen->fence_finish(screen, NULL, so->fence, timeout)) {
+       screen->fence_finish(screen, pipe, so->fence, timeout)) {
       screen->fence_reference(screen, &so->fence, NULL);
       so->b.StatusFlag = GL_TRUE;
    }




More information about the mesa-commit mailing list