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: a6b3792843 ("r600: add core pieces of image support.")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22394>
(cherry picked from commit 4f42d3b843)
This commit is contained in:
Patrick Lerda 2023-04-01 23:08:09 +02:00 committed by Dylan Baker
parent 6cb9f60cb0
commit f18be07792
2 changed files with 3 additions and 2 deletions

View File

@ -2074,7 +2074,7 @@
"description": "r600: fix refcnt imbalance related to evergreen_set_shader_images()",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "a6b379284365e8adee780b691596d3a66de1ba93",
"notes": null

View File

@ -4269,8 +4269,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);