From dd267ab434e1dfabe14e508e6a80a4ef3c928602 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 25 Jan 2024 20:56:46 +0100 Subject: [PATCH] zink: move zink_resource_copies_reset out of exportable_lock The function takes care of synchronization by itself, so no need to also protect the call by ctx->batch.state->exportable_lock. Signed-off-by: Gert Wollny Part-of: --- src/gallium/drivers/zink/zink_synchronization.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/zink/zink_synchronization.cpp b/src/gallium/drivers/zink/zink_synchronization.cpp index 81290978632..6d83b2eaaaa 100644 --- a/src/gallium/drivers/zink/zink_synchronization.cpp +++ b/src/gallium/drivers/zink/zink_synchronization.cpp @@ -539,6 +539,10 @@ zink_resource_image_barrier(struct zink_context *ctx, struct zink_resource *res, res->obj->access = flags; res->obj->access_stage = pipeline; res->layout = new_layout; + + if (new_layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) + zink_resource_copies_reset(res); + if (res->obj->exportable) simple_mtx_lock(&ctx->batch.state->exportable_lock); if (res->obj->dt) { @@ -554,8 +558,6 @@ zink_resource_image_barrier(struct zink_context *ctx, struct zink_resource *res, pipe_resource_reference(&pres, &res->base.b); } } - if (new_layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) - zink_resource_copies_reset(res); if (res->obj->exportable && queue_import) { for (struct zink_resource *r = res; r; r = zink_resource(r->base.b.next)) { VkSemaphore sem = zink_screen_export_dmabuf_semaphore(zink_screen(ctx->base.screen), r);