From 639bdadd4a81d1954aa3959869675ad817840fce Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 25 Aug 2023 15:43:58 +0200 Subject: [PATCH] vulkan/wsi/wayland: fix unset present_mode chain->base.present_mode is unset at this point, ie. it's zero-initialized. VK_PRESENT_MODE_IMMEDIATE_KHR happens to be 0, so the WSI will attempt to use tearing-control on compositors that don't support it. Signed-off-by: Simon Ser Fixes: 5ceba97c2e18 ("vulkan/wsi/wayland: add support for IMMEDIATE") Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 4402f77..51b9e18 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -2272,7 +2272,8 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, if (result != VK_SUCCESS) goto fail; - if (chain->base.present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR) { + VkPresentModeKHR present_mode = wsi_swapchain_get_present_mode(wsi_device, pCreateInfo); + if (present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR) { chain->tearing_control = wp_tearing_control_manager_v1_get_tearing_control(wsi_wl_surface->display->tearing_control_manager, wsi_wl_surface->surface); @@ -2351,7 +2352,7 @@ wsi_wl_surface_create_swapchain(VkIcdSurfaceBase *icd_surface, chain->base.release_images = wsi_wl_swapchain_release_images; chain->base.set_present_mode = wsi_wl_swapchain_set_present_mode; chain->base.wait_for_present = wsi_wl_swapchain_wait_for_present; - chain->base.present_mode = wsi_swapchain_get_present_mode(wsi_device, pCreateInfo); + chain->base.present_mode = present_mode; chain->base.image_count = num_images; chain->extent = pCreateInfo->imageExtent; chain->vk_format = pCreateInfo->imageFormat; -- 2.7.4