From 4f42d3b843c2b5a07b70e1de2467c8b3a34b7de0 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Sat, 1 Apr 2023 23:08:09 +0200 Subject: [PATCH] r600: fix refcnt imbalance related to evergreen_set_shader_images() Indeed, the reference was overwritten. For instance, this issue is triggered with: "piglit/bin/shader_runner tests/spec/arb_shader_image_load_store/execution/write-to-rendered-image.shader_test -auto -fbo" while setting GALLIUM_REFCNT_LOG=refcnt.log. Fixes: a6b379284365 ("r600: add core pieces of image support.") Signed-off-by: Patrick Lerda Part-of: --- src/gallium/drivers/r600/evergreen_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 0db74e0..993f5ac 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -4283,8 +4283,9 @@ static void evergreen_set_shader_images(struct pipe_context *ctx, r600_context_add_resource_size(ctx, image); + struct pipe_resource *const pipe_saved = rview->base.resource; rview->base = *iview; - rview->base.resource = NULL; + rview->base.resource = pipe_saved; pipe_resource_reference((struct pipe_resource **)&rview->base.resource, image); evergreen_setup_immed_buffer(rctx, rview, iview->format); -- 2.7.4