From 1900617baf929c5fd59cd1f33d42f4fe8c4f9c24 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Thu, 21 Mar 2024 16:56:12 +0100 Subject: [PATCH] wsi/wayland: Init outstanding list earlier. Fixes a crash if swapchain free is called before the list is initialized. This only happens when swapchain init fails, so it is highly unlikely to happen in practical scenarios. Fixes dEQP-VK.wsi.wayland.swapchain.simulate_oom.min_image_count. Fixes: 0d51cd48089c2b03abbf ("wsi/wl: Improve fallback for present_wait.") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10866 Signed-off-by: Hans-Kristian Arntzen Reviewed-by: Joshua Ashton Tested-by: Iago Toral Quiroga Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 2b529397aa4..6f8fc44c43d 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -2262,6 +2262,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, if (chain == NULL) return VK_ERROR_OUT_OF_HOST_MEMORY; + wl_list_init(&chain->present_ids.outstanding_list); + /* We are taking ownership of the wsi_wl_surface, so remove ownership from * oldSwapchain. If the surface is currently owned by a swapchain that is * not oldSwapchain we return an error. @@ -2397,8 +2399,6 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, } pthread_mutex_init(&chain->present_ids.lock, NULL); - wl_list_init(&chain->present_ids.outstanding_list); - char *queue_name = vk_asprintf(pAllocator, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT, "mesa vk surface %d swapchain %d queue",