panfrost: Fix fence leak
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 26 May 2020 20:57:44 +0000 (16:57 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jul 2020 14:42:33 +0000 (14:42 +0000)
When overwriting the writer, we need to release the old reference.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Fixes: 2dad9fde505 ("panfrost: Start tracking inter-batch dependencies")
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5859>

src/gallium/drivers/panfrost/pan_job.c

index fb98b9a4bab06a980f4b5333b6d81445e975ee88..929bd993e745a067e167e059f9e5965d21397001 100644 (file)
@@ -462,6 +462,9 @@ panfrost_batch_update_bo_access(struct panfrost_batch *batch,
                 }
                 panfrost_batch_fence_reference(batch->out_sync);
 
+                if (access->writer)
+                        panfrost_batch_fence_unreference(access->writer);
+
                 /* We now are the new writer. */
                 access->writer = batch->out_sync;
                 access->type = access_type;