vc4: unref old fence
authorRob Clark <robclark@freedesktop.org>
Wed, 8 Jul 2015 18:51:46 +0000 (14:51 -0400)
committerRob Clark <robclark@freedesktop.org>
Fri, 10 Jul 2015 15:57:30 +0000 (11:57 -0400)
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@freedesktop.org>
Acked-by: Eric Anholt <eric@anholt.net>
src/gallium/drivers/vc4/vc4_context.c

index 630f8e688967abfbc27b4aa6b71515cb759e514b..316598f0a9daa0973a77ea729bc95b07131d720f 100644 (file)
@@ -103,8 +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);
+                screen->fence_reference(screen, fence, NULL);
                 *fence = (struct pipe_fence_handle *)f;
         }
 }