zink: lock screen queue on context_destroy and CreateSwapchain
authorKarol Herbst <kherbst@redhat.com>
Tue, 31 Oct 2023 23:59:55 +0000 (00:59 +0100)
committerEric Engestrom <eric@engestrom.ch>
Wed, 3 Jan 2024 23:02:44 +0000 (23:02 +0000)
Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25985>
(cherry picked from commit 208875516c10f5163d5a7333e2f5fe271fad4ee1)

.pick_status.json
src/gallium/drivers/zink/zink_context.c
src/gallium/drivers/zink/zink_kopper.c

index f868840..8ebb6d9 100644 (file)
         "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
index b418c6d..c7c0e8a 100644 (file)
@@ -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));
index d1e9a57..bda4c20 100644 (file)
@@ -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,