Module: Mesa
Branch: staging/23.3
Commit: f4e231dddd75b0670130c9ad70a869759df7acaa
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4e231dddd75b0670130c9ad70a869759df7acaa

Author: Karol Herbst <kher...@redhat.com>
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 <kher...@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25985>
(cherry picked from commit 208875516c10f5163d5a7333e2f5fe271fad4ee1)

---

 .pick_status.json                       | 2 +-
 src/gallium/drivers/zink/zink_context.c | 2 ++
 src/gallium/drivers/zink/zink_kopper.c  | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index f8688403255..8ebb6d962cc 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -584,7 +584,7 @@
         "description": "zink: lock screen queue on context_destroy and 
CreateSwapchain",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/gallium/drivers/zink/zink_context.c 
b/src/gallium/drivers/zink/zink_context.c
index b418c6d9d31..c7c0e8ab5c2 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -124,7 +124,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