Mesa (master): gallium/u_threaded: fix pipe_resource leak for staging transfer

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 11 21:49:29 UTC 2020


Module: Mesa
Branch: master
Commit: fb7ccd3b23538eff70b5e75d518ffb01bbd06ade
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb7ccd3b23538eff70b5e75d518ffb01bbd06ade

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Thu Dec 10 14:35:34 2020 +0100

gallium/u_threaded: fix pipe_resource leak for staging transfer

In 2900f82e191 I mistakenly used tc_set_resource_reference in both
tc_transfer_unmap and tc_call_transfer_unmap.

This causes a leak because tc_call_transfer_unmap clears dst before
acquiring a reference, so it must only be used when initializing
tc_payloads.

This fixes the perf drop reported by Marek in MR 7098.

Fixes: 2900f82e191 ("gallium/u_threaded: fix staging and non-staging conflicts")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8035>

---

 src/gallium/auxiliary/util/u_threaded_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 05dfb2e350e..249bf82ad35 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1770,7 +1770,7 @@ tc_call_transfer_unmap(struct pipe_context *pipe, union tc_payload *payload)
       /* Nothing to do except keeping track of staging uploads */
       assert(tres->pending_staging_uploads > 0);
       p_atomic_dec(&tres->pending_staging_uploads);
-      tc_set_resource_reference(&p->resource, NULL);
+      pipe_resource_reference(&p->resource, NULL);
       return;
    }
    pipe->transfer_unmap(pipe, p->transfer);



More information about the mesa-commit mailing list