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

Submitted by Marek Olšák on July 16, 2015, 4:54 p.m.

Details

Message ID 1437065689-14314-2-git-send-email-maraeo@gmail.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Marek Olšák July 16, 2015, 4:54 p.m.
From: Marek Olšák <marek.olsak@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(-)

Patch hide | download patch | download mbox

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

Comments

On 17.07.2015 01:54, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak@amd.com>
> 
> Broken by f1be3d8cdde17a9b9ae283e1bab2f46b992d3bf3, which returns NULL
> if no commands have been submitted.

I've fixed that in radeonsi, so you can drop this patch.