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

Rob Clark robdclark at gmail.com
Wed Jul 8 13:34:46 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/vc4/vc4_context.c | 3 ++-
 src/gallium/drivers/vc4/vc4_fence.c   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index 630f8e6..7de4fad 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -103,9 +103,10 @@ vc4_pipe_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
         vc4_flush(pctx);
 
         if (fence) {
+                struct pipe_screen *screen = pctx->screen;
                 struct vc4_fence *f = vc4_fence_create(vc4->screen,
                                                        vc4->last_emit_seqno);
-                *fence = (struct pipe_fence_handle *)f;
+                screen->fence_reference(screen, fence, (struct pipe_fence_handle *)f);
         }
 }
 
diff --git a/src/gallium/drivers/vc4/vc4_fence.c b/src/gallium/drivers/vc4/vc4_fence.c
index f2ee91d..6055ffe 100644
--- a/src/gallium/drivers/vc4/vc4_fence.c
+++ b/src/gallium/drivers/vc4/vc4_fence.c
@@ -88,7 +88,7 @@ vc4_fence_create(struct vc4_screen *screen, uint64_t seqno)
         if (!f)
                 return NULL;
 
-        pipe_reference_init(&f->reference, 1);
+        pipe_reference_init(&f->reference, 0);
         f->seqno = seqno;
 
         return f;
-- 
2.4.3



More information about the mesa-dev mailing list