Module: Mesa
Branch: main
Commit: 208875516c10f5163d5a7333e2f5fe271fad4ee1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=208875516c10f5163d5a7333e2f5fe271fad4ee1

Author: Karol Herbst <[email protected]>
Date:   Wed Nov  1 00:59:55 2023 +0100

zink: lock screen queue on context_destroy and CreateSwapchain

Cc: mesa-stable
Signed-off-by: Karol Herbst <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25985>

---

 src/gallium/drivers/zink/zink_context.c | 2 ++
 src/gallium/drivers/zink/zink_kopper.c  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index ad7718c00da..b2e038bfe14 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -125,7 +125,9 @@ zink_context_destroy(struct pipe_context *pctx)
    if (util_queue_is_initialized(&screen->flush_queue))
       util_queue_finish(&screen->flush_queue);
    if (ctx->batch.state && !screen->device_lost) {
+      simple_mtx_lock(&screen->queue_lock);
       VkResult result = VKSCR(QueueWaitIdle)(screen->queue);
+      simple_mtx_unlock(&screen->queue_lock);
 
       if (result != VK_SUCCESS)
          mesa_loge("ZINK: vkQueueWaitIdle failed (%s)", 
vk_Result_to_str(result));
diff --git a/src/gallium/drivers/zink/zink_kopper.c 
b/src/gallium/drivers/zink/zink_kopper.c
index d1e9a57b20f..bda4c206877 100644
--- a/src/gallium/drivers/zink/zink_kopper.c
+++ b/src/gallium/drivers/zink/zink_kopper.c
@@ -318,7 +318,9 @@ kopper_CreateSwapchain(struct zink_screen *screen, struct 
kopper_displaytarget *
    if (error == VK_ERROR_NATIVE_WINDOW_IN_USE_KHR) {
       if (util_queue_is_initialized(&screen->flush_queue))
          util_queue_finish(&screen->flush_queue);
+      simple_mtx_lock(&screen->queue_lock);
       VkResult result = VKSCR(QueueWaitIdle)(screen->queue);
+      simple_mtx_unlock(&screen->queue_lock);
       if (result != VK_SUCCESS)
          mesa_loge("ZINK: vkQueueWaitIdle failed (%s)", 
vk_Result_to_str(result));
       error = VKSCR(CreateSwapchainKHR)(screen->dev, &cswap->scci, NULL,

Reply via email to