Merge 'Add wait flag on querying present timing queue operations end timestamp' into 'main'

See merge request mesa/vulkan-wsi-layer!227
This commit is contained in:
Iason Paraskevopoulos 2026-01-22 11:26:21 +00:00
commit fac9daabaf
3 changed files with 16 additions and 2 deletions

View file

@ -82,6 +82,7 @@ set(WSIALLOC_MEMORY_HEAP_NAME "linux,cma" CACHE STRING "Heap name used by the dm
option(BUILD_WSI_DISPLAY_SUPPORT_FORMAT_MODIFIERS "Build with support for format modifiers in VK_KHR_display" ON)
option(VULKAN_WSI_LAYER_EXPERIMENTAL "Enable the Vulkan WSI Experimental features" OFF)
option(ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD "Enable the non-conformant FIFO presentation thread implementation in the Wayland backend" OFF)
option(ENABLE_WAIT_FOR_QUERY_RESULT "Enable waiting for result while querying present timing queue operations end timestamp" OFF)
# Enables the layer to pass frame boundary events if the ICD or layers below have support for it by
# making use of the VK_EXT_frame_boundary extension. If the application itself makes use of the
@ -357,6 +358,11 @@ else()
add_definitions("-DENABLE_INSTRUMENTATION=0")
endif()
if(ENABLE_WAIT_FOR_QUERY_RESULT)
target_compile_definitions(${PROJECT_NAME} PRIVATE WAIT_FOR_QUERY_RESULT_ENABLED=1)
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE WAIT_FOR_QUERY_RESULT_ENABLED=0)
endif()
target_link_libraries(${PROJECT_NAME} ${LINK_WSI_LIBS})
add_custom_target(manifest_json ALL COMMAND

View file

@ -169,6 +169,12 @@ for applications that do not make use of this extension.
In order to enable this feature `-DENABLE_INSTRUMENTATION=1` option can
be passed at build time.
### Build with wait for present timing query results
The option `-DENABLE_WAIT_FOR_QUERY_RESULT=1` provides a way to wait for
present timing queue operations end bit timestamps to be available when
queried.
### Debug builds
The layer can be built with different values of the CMAKE_BUILD_TYPE variable.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 Arm Limited.
* Copyright (c) 2024-2026 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@ -168,9 +168,11 @@ VkResult wsi_ext_present_timing::write_pending_results()
}
uint64_t timestamp;
VkQueryResultFlags wait_for_result = WAIT_FOR_QUERY_RESULT_ENABLED ? VK_QUERY_RESULT_WAIT_BIT : 0;
VkResult res = m_device.disp.GetQueryPoolResults(
m_device.device, m_queue_family_resources.m_query_pool, slot.m_image_index, 1u, sizeof(timestamp),
&timestamp, static_cast<VkDeviceSize>(0), static_cast<VkQueryResultFlags>(VK_QUERY_RESULT_64_BIT));
&timestamp, static_cast<VkDeviceSize>(0),
static_cast<VkQueryResultFlags>(VK_QUERY_RESULT_64_BIT | wait_for_result));
if (res != VK_SUCCESS && res != VK_NOT_READY)
{
return res;