From fb7ccd3b23538eff70b5e75d518ffb01bbd06ade Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Thu, 10 Dec 2020 14:35:34 +0100 Subject: [PATCH] gallium/u_threaded: fix pipe_resource leak for staging transfer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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 05dfb2e..249bf82 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); -- 2.7.4