From f5c66e2d4abf7b6720b47a55ed5d5a291691cc52 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 13 Mar 2025 08:46:22 -0400 Subject: [PATCH] zink: fix refcounting of zink_surface objects this was previously a no-op because the pointers were identical, leading to an extra unref in check_framebuffer_surface_mutable() cc: mesa-stable Part-of: --- src/gallium/drivers/zink/zink_surface.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_surface.c b/src/gallium/drivers/zink/zink_surface.c index 5f5bfb341a5..1a778c7a927 100644 --- a/src/gallium/drivers/zink/zink_surface.c +++ b/src/gallium/drivers/zink/zink_surface.c @@ -364,9 +364,12 @@ zink_create_surface(struct pipe_context *pctx, csurf->needs_mutable = needs_mutable; if (needs_mutable) { - pipe_resource_reference(&csurf->base.texture, pres); + struct pipe_resource *ref = NULL; + pipe_resource_reference(&ref, pres); init_pipe_surface_info(pctx, &csurf->base, templ, pres); } + /* this may or may not be set previously depending whether templ->texture is set */ + csurf->base.texture = pres; if (templ->nr_samples && !screen->info.have_EXT_multisampled_render_to_single_sampled) { /* transient fb attachment: not cached */