From c66248fb5bdbb199a0a53749935a9dcdb19e3b34 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 31 Oct 2022 16:00:04 +0100 Subject: [PATCH] wsi/common: Allow present-wait to be unconditionally enabled. If all potentially supported surface types support present wait, we can expose the extension. Signed-off-by: Hans-Kristian Arntzen Reviewed-by: Joshua Ashton Part-of: --- src/vulkan/wsi/wsi_common.c | 14 ++++++++++++++ src/vulkan/wsi/wsi_common.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 34512c9cb88..b1b802ea32d 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1376,6 +1376,20 @@ wsi_GetDeviceGroupSurfacePresentModesKHR(VkDevice device, return VK_SUCCESS; } +bool +wsi_common_vk_instance_supports_present_wait(const struct vk_instance *instance) +{ + /* We can only expose KHR_present_wait and KHR_present_id + * if we are guaranteed support on all potential VkSurfaceKHR objects. */ + if (instance->enabled_extensions.KHR_wayland_surface || + instance->enabled_extensions.KHR_win32_surface || + instance->enabled_extensions.KHR_android_surface) { + return false; + } + + return true; +} + VkResult wsi_common_create_swapchain_image(const struct wsi_device *wsi, const VkImageCreateInfo *pCreateInfo, diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h index 19b34ed6e18..8fad975f554 100644 --- a/src/vulkan/wsi/wsi_common.h +++ b/src/vulkan/wsi/wsi_common.h @@ -87,6 +87,7 @@ struct wsi_memory_signal_submit_info { }; struct wsi_interface; +struct vk_instance; struct driOptionCache; @@ -312,6 +313,9 @@ wsi_common_bind_swapchain_image(const struct wsi_device *wsi, VkSwapchainKHR _swapchain, uint32_t image_idx); +bool +wsi_common_vk_instance_supports_present_wait(const struct vk_instance *instance); + #ifdef __cplusplus } #endif