[Mesa-dev] [PATCH 3/4] ilo: unref old fence

Rob Clark robdclark at gmail.com
Wed Jul 8 13:34:45 PDT 2015


From: Rob Clark <robclark at freedesktop.org>

Some, but not all, state trackers will explicitly unref (and set to
NULL) the previous *fence before calling pipe->flush().  So driver
should use fence_ref() which will unref the old fence if not NULL.

Signed-off-by: Rob Clark <robclark at freedesktop.org>
---
 src/gallium/drivers/ilo/ilo_context.c | 5 ++++-
 src/gallium/drivers/ilo/ilo_screen.c  | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_context.c b/src/gallium/drivers/ilo/ilo_context.c
index 3d5c7b6..8d17816 100644
--- a/src/gallium/drivers/ilo/ilo_context.c
+++ b/src/gallium/drivers/ilo/ilo_context.c
@@ -62,7 +62,10 @@ ilo_flush(struct pipe_context *pipe,
          (flags & PIPE_FLUSH_END_OF_FRAME) ? "frame end" : "user request");
 
    if (f) {
-      *f = ilo_screen_fence_create(pipe->screen, ilo->cp->last_submitted_bo);
+      struct pipe_screen *screen = pipe->screen;
+      struct pipe_fence_handle *fence;
+      fence = ilo_screen_fence_create(pipe->screen, ilo->cp->last_submitted_bo);
+      screen->fence_reference(screen, f, fence);
    }
 }
 
diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
index faebb92..a6abd84 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -693,7 +693,7 @@ ilo_screen_fence_create(struct pipe_screen *screen, struct intel_bo *bo)
    if (!fence)
       return NULL;
 
-   pipe_reference_init(&fence->reference, 1);
+   pipe_reference_init(&fence->reference, 0);
 
    fence->seqno_bo = intel_bo_ref(bo);
 
-- 
2.4.3



More information about the mesa-dev mailing list