From ee6d45430f4e908090b06a6f4afea532753dcd46 Mon Sep 17 00:00:00 2001 From: Nir Ekhauz Date: Wed, 17 Sep 2025 09:20:46 +0000 Subject: [PATCH] Fix Wayland swapchain to support present_id2 Adding support for present_id2 Signed-off-by: Nir.Ekhauz Change-Id: Ie30caf423902fea9f2bc3341c3b61390b09c0f7c --- layer/layer.cpp | 4 ++-- wsi/wayland/swapchain.cpp | 29 +++++++++++++---------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/layer/layer.cpp b/layer/layer.cpp index 2aa3afe..f3de8a6 100644 --- a/layer/layer.cpp +++ b/layer/layer.cpp @@ -512,6 +512,8 @@ wsi_layer_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device, present_wait_features->presentWait = VK_FALSE; } + instance.disp.GetPhysicalDeviceFeatures2KHR(physical_device, pFeatures); + #if VULKAN_WSI_LAYER_EXPERIMENTAL auto *present_wait2_features = util::find_extension( VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_2_FEATURES_KHR, pFeatures->pNext); @@ -521,8 +523,6 @@ wsi_layer_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device, } #endif - instance.disp.GetPhysicalDeviceFeatures2KHR(physical_device, pFeatures); - auto *image_compression_control_swapchain_features = util::find_extension( VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT, pFeatures->pNext); diff --git a/wsi/wayland/swapchain.cpp b/wsi/wayland/swapchain.cpp index 8c29624..5824828 100644 --- a/wsi/wayland/swapchain.cpp +++ b/wsi/wayland/swapchain.cpp @@ -599,16 +599,16 @@ void swapchain::present_image(const pending_present_request &pending_present) } #if VULKAN_WSI_LAYER_EXPERIMENTAL - if (m_device_data.is_present_id_enabled()) + auto *present_id_ext = get_swapchain_extension(); + if (present_id_ext != nullptr) { - auto *ext = get_swapchain_extension(true); if (m_wsi_surface->get_presentation_time_interface() != nullptr && pending_present.present_id) { wp_presentation *pres = m_wsi_surface->get_presentation_time_interface(); struct wp_presentation_feedback *feedback = wp_presentation_feedback(pres, m_wsi_surface->get_wl_surface()); wl_proxy_set_queue(reinterpret_cast(feedback), m_buffer_queue); presentation_feedback *feedback_obj = - ext->insert_into_pending_present_feedback_list(pending_present.present_id, feedback); + present_id_ext->insert_into_pending_present_feedback_list(pending_present.present_id, feedback); if (feedback_obj == nullptr) { WSI_LOG_ERROR("Error adding to pending present feedback list"); @@ -650,24 +650,21 @@ void swapchain::present_image(const pending_present_request &pending_present) set_error_state(VK_ERROR_SURFACE_LOST_KHR); } - if (m_device_data.is_present_id_enabled()) +#if VULKAN_WSI_LAYER_EXPERIMENTAL + auto *ext = get_swapchain_extension(); + if (ext != nullptr) { -#if VULKAN_WSI_LAYER_EXPERIMENTAL - auto *ext = get_swapchain_extension(); - if (ext != nullptr) - { - if (m_wsi_surface->get_presentation_time_interface() == nullptr) + if (m_wsi_surface->get_presentation_time_interface() == nullptr) #else - auto *ext = get_swapchain_extension(); - if (ext != nullptr) + auto *ext = get_swapchain_extension(); + if (ext != nullptr) #endif - { - ext->mark_delivered(pending_present.present_id); - } -#if VULKAN_WSI_LAYER_EXPERIMENTAL + { + ext->mark_delivered(pending_present.present_id); } -#endif +#if VULKAN_WSI_LAYER_EXPERIMENTAL } +#endif } void swapchain::destroy_image(swapchain_image &image)