iris: Fix fence leak in iris_fence_flush
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Thu, 12 Sep 2019 11:17:28 +0000 (14:17 +0300)
committerDanylo Piliaiev <danylo.piliaiev@gmail.com>
Mon, 16 Sep 2019 08:47:37 +0000 (08:47 +0000)
Documentation for pipe_context::flush states:
 "NOTE: use screen->fence_reference() (or equivalent) to transfer
  new fence ref to **fence, to ensure that previous fence is unref'd"

Hence we need to unref previous out_fence.

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_fence.c

index 3aaa0af2281d206d96c94932885b904b0d0f2aaf..2225774a601f34b900732ec6e16d41b5fb6ccabf 100644 (file)
@@ -184,6 +184,8 @@ iris_fence_flush(struct pipe_context *ctx,
       iris_syncpt_reference(screen, &fence->syncpt[fence->count++],
                             ice->batches[b].last_syncpt);
    }
+
+   iris_fence_reference(ctx->screen, out_fence, NULL);
    *out_fence = fence;
 }