From 6eb10b69a46dcb85ea73cfa7f28f0c84aefb502f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 29 May 2025 12:19:47 -0400 Subject: [PATCH] zink: fix queue transition check in check_for_layout_update() this only applies if the resource has active binds, otherwise it triggers crashes Fixes: 18d206d67ca ("zink: Check queue families when binding image resources") Part-of: (cherry picked from commit 44bff7eb057c3c4deeeef41f508c6126167dbe13) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_context.c | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 224cd45c147..86f73181c55 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1904,7 +1904,7 @@ "description": "zink: fix queue transition check in check_for_layout_update()", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "18d206d67ca485ef2f8b17ea1c0e0c08b63d3562", "notes": null diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index 3eed8350b69..e1b07d5dce5 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1853,11 +1853,10 @@ check_for_layout_update(struct zink_context *ctx, struct zink_resource *res, boo if (!is_compute && res->fb_binds && !(ctx->feedback_loops & res->fb_binds)) { /* always double check feedback loops */ ret = !!_mesa_set_add(ctx->need_barriers[0], res); - } else if (res->queue != zink_screen(ctx->base.screen)->gfx_queue && res->queue != VK_QUEUE_FAMILY_IGNORED) { - /* Check if we need a queue family transfer */ - ret = !!_mesa_set_add(ctx->need_barriers[0], res); } else { - if (res->bind_count[is_compute] && layout && res->layout != layout) + if (res->bind_count[is_compute] && ((layout && res->layout != layout) || + /* Check if we need a queue family transfer */ + (res->queue != zink_screen(ctx->base.screen)->gfx_queue && res->queue != VK_QUEUE_FAMILY_IGNORED))) ret = !!_mesa_set_add(ctx->need_barriers[is_compute], res); if (res->bind_count[!is_compute] && other_layout && (layout != other_layout || res->layout != other_layout)) ret = !!_mesa_set_add(ctx->need_barriers[!is_compute], res);