From: Rob Clark <robcl...@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 <robcl...@freedesktop.org>
---
 src/gallium/drivers/freedreno/freedreno_context.c | 2 +-
 src/gallium/drivers/freedreno/freedreno_fence.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_context.c 
b/src/gallium/drivers/freedreno/freedreno_context.c
index 668ef36..42f79d3 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -145,7 +145,7 @@ fd_context_flush(struct pipe_context *pctx, struct 
pipe_fence_handle **fence,
        fd_context_render(pctx);
 
        if (fence)
-               *fence = fd_fence_create(pctx);
+               fd_screen_fence_ref(pctx->screen, fence, fd_fence_create(pctx));
 }
 
 void
diff --git a/src/gallium/drivers/freedreno/freedreno_fence.c 
b/src/gallium/drivers/freedreno/freedreno_fence.c
index 375e58f..c30c3f9 100644
--- a/src/gallium/drivers/freedreno/freedreno_fence.c
+++ b/src/gallium/drivers/freedreno/freedreno_fence.c
@@ -84,7 +84,7 @@ struct pipe_fence_handle * fd_fence_create(struct 
pipe_context *pctx)
        if (!fence)
                return NULL;
 
-       pipe_reference_init(&fence->reference, 1);
+       pipe_reference_init(&fence->reference, 0);
 
        fence->ctx = ctx;
        fence->screen = ctx->screen;
-- 
2.4.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to