[Mesa-dev] [PATCH 02/12] st/dri: fix EGL_KHR_fence_sync since the last radeonsi change broke it

Marek Olšák maraeo at gmail.com
Thu Jul 16 09:54:39 PDT 2015


From: Marek Olšák <marek.olsak at amd.com>

Broken by f1be3d8cdde17a9b9ae283e1bab2f46b992d3bf3, which returns NULL
if no commands have been submitted.
---
 src/gallium/include/pipe/p_context.h  |  5 ++++-
 src/gallium/state_trackers/dri/dri2.c | 14 ++------------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index f89dae9..1439333 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -385,7 +385,10 @@ struct pipe_context {
     * Flush draw commands
     *
     * NOTE: use screen->fence_reference() (or equivalent) to transfer
-    * new fence ref to **fence, to ensure that previous fence is unref'd
+    * new fence ref to **fence, to ensure that previous fence is unref'd.
+    *
+    * If the returned fence is NULL, it means that all commands have already
+    * been finished, or no commands have been submitted yet.
     *
     * \param fence  if not NULL, an old fence to unref and transfer a
     *    new fence reference to
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 91b4431..45359ff 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -1307,12 +1307,6 @@ dri2_create_fence(__DRIcontext *_ctx)
       return NULL;
 
    ctx->flush(ctx, &fence->pipe_fence, 0);
-
-   if (!fence->pipe_fence) {
-      FREE(fence);
-      return NULL;
-   }
-
    return fence;
 }
 
@@ -1350,8 +1344,6 @@ dri2_destroy_fence(__DRIscreen *_screen, void *_fence)
       screen->fence_reference(screen, &fence->pipe_fence, NULL);
    else if (fence->cl_event)
       driscreen->opencl_dri_event_release(fence->cl_event);
-   else
-      assert(0);
 
    FREE(fence);
 }
@@ -1377,10 +1369,8 @@ dri2_client_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags,
       else
          return driscreen->opencl_dri_event_wait(fence->cl_event, timeout);
    }
-   else {
-      assert(0);
-      return false;
-   }
+   else
+      return true;
 }
 
 static void
-- 
2.1.0



More information about the mesa-dev mailing list