mirror of
https://gitlab.freedesktop.org/mesa/vulkan-wsi-layer.git
synced 2025-12-20 06:50:08 +01:00
Initial support for VK_KHR_present_wait2
Add support for present wait2 ext. for physical, surface and sc. Signed-off-by: Nir.Ekhauz <nir.ekhauz@arm.com> Change-Id: I0f7cdadb2d3ea0ecbc32b8b2efe9fc3bb4ba0369
This commit is contained in:
parent
ad2767ee77
commit
64c1c46609
11 changed files with 106 additions and 4 deletions
|
|
@ -332,7 +332,7 @@ if (VULKAN_WSI_LAYER_EXPERIMENTAL)
|
||||||
target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/wsi/extensions/present_timing.cpp)
|
target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/wsi/extensions/present_timing.cpp)
|
||||||
add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=1")
|
add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=1")
|
||||||
else()
|
else()
|
||||||
list(APPEND JSON_COMMANDS COMMAND sed -Ei '/VK_EXT_present_timing/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
list(APPEND JSON_COMMANDS COMMAND sed -Ei '/VK_EXT_present_timing|VK_KHR_present_wait2/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
|
||||||
add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=0")
|
add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=0")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,13 @@
|
||||||
"vkWaitForPresentKHR"
|
"vkWaitForPresentKHR"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "VK_KHR_present_wait2",
|
||||||
|
"spec_version": "1",
|
||||||
|
"entrypoints": [
|
||||||
|
"vkWaitForPresent2KHR"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "VK_EXT_present_mode_fifo_latest_ready",
|
"name": "VK_EXT_present_mode_fifo_latest_ready",
|
||||||
"spec_version": "1"
|
"spec_version": "1"
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,15 @@ VKAPI_ATTR VkResult create_device(VkPhysicalDevice physicalDevice, const VkDevic
|
||||||
device_data.set_present_wait_enabled(present_wait_features->presentWait);
|
device_data.set_present_wait_enabled(present_wait_features->presentWait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
auto *present_wait2_features = util::find_extension<VkPhysicalDevicePresentWait2FeaturesKHR>(
|
||||||
|
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_2_FEATURES_KHR, pCreateInfo->pNext);
|
||||||
|
if (present_wait2_features != nullptr)
|
||||||
|
{
|
||||||
|
device_data.set_present_wait2_enabled(present_wait2_features->presentWait2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -503,6 +512,15 @@ wsi_layer_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device,
|
||||||
present_wait_features->presentWait = VK_FALSE;
|
present_wait_features->presentWait = VK_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
auto *present_wait2_features = util::find_extension<VkPhysicalDevicePresentWait2FeaturesKHR>(
|
||||||
|
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_2_FEATURES_KHR, pFeatures->pNext);
|
||||||
|
if (present_wait2_features != nullptr)
|
||||||
|
{
|
||||||
|
present_wait2_features->presentWait2 = VK_TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
instance.disp.GetPhysicalDeviceFeatures2KHR(physical_device, pFeatures);
|
instance.disp.GetPhysicalDeviceFeatures2KHR(physical_device, pFeatures);
|
||||||
|
|
||||||
auto *image_compression_control_swapchain_features =
|
auto *image_compression_control_swapchain_features =
|
||||||
|
|
|
||||||
|
|
@ -433,6 +433,7 @@ device_private_data::device_private_data(instance_private_data &inst_data, VkPhy
|
||||||
, swapchain_maintenance1_enabled{ false }
|
, swapchain_maintenance1_enabled{ false }
|
||||||
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
, present_timing_enabled { true }
|
, present_timing_enabled { true }
|
||||||
|
, present_wait2_enabled { false }
|
||||||
#endif
|
#endif
|
||||||
, present_id2_enabled { false }
|
, present_id2_enabled { false }
|
||||||
, present_mode_fifo_latest_ready_enabled { false }
|
, present_mode_fifo_latest_ready_enabled { false }
|
||||||
|
|
@ -637,6 +638,18 @@ bool device_private_data::is_present_wait_enabled()
|
||||||
return present_wait_enabled;
|
return present_wait_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
void device_private_data::set_present_wait2_enabled(bool enable)
|
||||||
|
{
|
||||||
|
present_wait2_enabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool device_private_data::is_present_wait2_enabled()
|
||||||
|
{
|
||||||
|
return present_wait2_enabled;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void device_private_data::set_present_mode_fifo_latest_ready_enabled(bool enable)
|
void device_private_data::set_present_mode_fifo_latest_ready_enabled(bool enable)
|
||||||
{
|
{
|
||||||
present_mode_fifo_latest_ready_enabled = enable;
|
present_mode_fifo_latest_ready_enabled = enable;
|
||||||
|
|
|
||||||
|
|
@ -980,6 +980,22 @@ public:
|
||||||
*/
|
*/
|
||||||
bool is_present_wait_enabled();
|
bool is_present_wait_enabled();
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
/**
|
||||||
|
* @brief Set whether present wait2 feature is enabled.
|
||||||
|
*
|
||||||
|
* @return true if enabled, false otherwise.
|
||||||
|
*/
|
||||||
|
void set_present_wait2_enabled(bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Check whether present wait2 feature has been enabled.
|
||||||
|
*
|
||||||
|
* @return true if supported, false otherwise.
|
||||||
|
*/
|
||||||
|
bool is_present_wait2_enabled();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Allow util::allocator to access the private constructor */
|
/* Allow util::allocator to access the private constructor */
|
||||||
friend util::allocator;
|
friend util::allocator;
|
||||||
|
|
@ -1048,6 +1064,12 @@ private:
|
||||||
* @brief Stores whether the device has enabled support for the present timing features.
|
* @brief Stores whether the device has enabled support for the present timing features.
|
||||||
*/
|
*/
|
||||||
bool present_timing_enabled{ false };
|
bool present_timing_enabled{ false };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stores whether the device supports the present wait2 feature.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool present_wait2_enabled{ false };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,15 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_
|
||||||
present_id2_surface_cap->presentId2Supported = VK_TRUE;
|
present_id2_surface_cap->presentId2Supported = VK_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
auto present_wait2_surface_cap = util::find_extension<VkSurfaceCapabilitiesPresentWait2KHR>(
|
||||||
|
VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_WAIT_2_KHR, pSurfaceCapabilities->pNext);
|
||||||
|
if (present_wait2_surface_cap != nullptr)
|
||||||
|
{
|
||||||
|
present_wait2_surface_cap->presentWait2Supported = VK_TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,12 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_device_data.is_present_wait_enabled())
|
if (m_device_data.is_present_wait_enabled()
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
|| (swapchain_create_info->flags &
|
||||||
|
(VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR | VK_SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!add_swapchain_extension(
|
if (!add_swapchain_extension(
|
||||||
m_allocator.make_unique<wsi_ext_present_wait_display>(*get_swapchain_extension<wsi_ext_present_id>(true))))
|
m_allocator.make_unique<wsi_ext_present_wait_display>(*get_swapchain_extension<wsi_ext_present_id>(true))))
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,15 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_
|
||||||
present_id2_surface_cap->presentId2Supported = VK_TRUE;
|
present_id2_surface_cap->presentId2Supported = VK_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
auto present_wait2_surface_cap = util::find_extension<VkSurfaceCapabilitiesPresentWait2KHR>(
|
||||||
|
VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_WAIT_2_KHR, surface_capabilities->pNext);
|
||||||
|
if (present_wait2_surface_cap != nullptr)
|
||||||
|
{
|
||||||
|
present_wait2_surface_cap->presentWait2Supported = VK_TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,12 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_device_data.is_present_wait_enabled())
|
if (m_device_data.is_present_wait_enabled()
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
|| (swapchain_create_info->flags &
|
||||||
|
(VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR | VK_SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!add_swapchain_extension(m_allocator.make_unique<wsi_ext_present_wait_headless>(
|
if (!add_swapchain_extension(m_allocator.make_unique<wsi_ext_present_wait_headless>(
|
||||||
*get_swapchain_extension<wsi_ext_present_id>(true))))
|
*get_swapchain_extension<wsi_ext_present_id>(true))))
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,15 @@ VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_
|
||||||
present_id2_surface_cap->presentId2Supported = VK_TRUE;
|
present_id2_surface_cap->presentId2Supported = VK_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
auto present_wait2_surface_cap = util::find_extension<VkSurfaceCapabilitiesPresentWait2KHR>(
|
||||||
|
VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_WAIT_2_KHR, pSurfaceCapabilities->pNext);
|
||||||
|
if (present_wait2_surface_cap != nullptr)
|
||||||
|
{
|
||||||
|
present_wait2_surface_cap->presentWait2Supported = VK_TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,12 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_device_data.is_present_wait_enabled())
|
if (m_device_data.is_present_wait_enabled()
|
||||||
|
#if VULKAN_WSI_LAYER_EXPERIMENTAL
|
||||||
|
|| (swapchain_create_info->flags &
|
||||||
|
(VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR | VK_SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!add_swapchain_extension(
|
if (!add_swapchain_extension(
|
||||||
m_allocator.make_unique<wsi_ext_present_wait_wayland>(*get_swapchain_extension<wsi_ext_present_id>(true))))
|
m_allocator.make_unique<wsi_ext_present_wait_wayland>(*get_swapchain_extension<wsi_ext_present_id>(true))))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue