From 7c846e460646fc0ae8b7c2c0087eddaaa4a5ea4d Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 23 Jan 2023 16:34:31 -0500 Subject: [PATCH] zink: always unref old images when adding new binds at some point this was correct, but refactoring has since occurred, and this ends up leaking storage image objects cc: mesa-stable Part-of: (cherry picked from commit d745e3b0ab4614136f1c8d93feb54b612fd58d3f) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_resource.c | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 061b66c4b35..3e08f732b75 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -40,7 +40,7 @@ "description": "zink: always unref old images when adding new binds", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/zink/zink_resource.c b/src/gallium/drivers/zink/zink_resource.c index 2d44de44499..16d1f2deca8 100644 --- a/src/gallium/drivers/zink/zink_resource.c +++ b/src/gallium/drivers/zink/zink_resource.c @@ -1312,11 +1312,6 @@ add_resource_bind(struct zink_context *ctx, struct zink_resource *res, unsigned res->layout = VK_IMAGE_LAYOUT_UNDEFINED; res->obj->access = 0; res->obj->access_stage = 0; - bool needs_unref = true; - if (zink_resource_has_usage(res)) { - zink_batch_reference_resource_move(&ctx->batch, res); - needs_unref = false; - } res->obj = new_obj; for (unsigned i = 0; i <= res->base.b.last_level; i++) { struct pipe_box box = {0, 0, 0, @@ -1325,8 +1320,7 @@ add_resource_bind(struct zink_context *ctx, struct zink_resource *res, unsigned box.depth = util_num_layers(&res->base.b, i); ctx->base.resource_copy_region(&ctx->base, &res->base.b, i, 0, 0, 0, &staging.base.b, i, &box); } - if (needs_unref) - zink_resource_object_reference(screen, &old_obj, NULL); + zink_resource_object_reference(screen, &old_obj, NULL); return true; }