This extension adds a single function to query the current GPU timestamp, just like glGetInteger64v(GL_TIMESTAMP, ×tamp). This function is needed to complete the implementation of GOOGLE_display_timing, which needs to be able to correlate GPU and CPU timestamps.
Signed-off-by: Keith Packard <kei...@keithp.com> v2: Update to track extension API that now returns both device and surface timestamps. --- src/amd/vulkan/radv_device.c | 21 +++++++++++++++++++++ src/amd/vulkan/radv_extensions.py | 1 + src/amd/vulkan/radv_private.h | 1 + 3 files changed, 23 insertions(+) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 73c48cef1f0..d60753b6d69 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -4773,3 +4773,24 @@ radv_GetDeviceGroupPeerMemoryFeatures( VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT | VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT; } + +VkResult radv_QueryCurrentTimestampMESA(VkDevice _device, VkSurfaceKHR _surface, + VkCurrentTimestampMESA *timestamp) +{ + RADV_FROM_HANDLE(radv_device, device, _device); + VkResult result; + + timestamp->deviceTimestamp = device->ws->query_value(device->ws, + RADEON_TIMESTAMP); + + result = wsi_common_convert_timestamp( + &device->physical_device->wsi_device, + _device, + _surface, + radv_get_current_time(), + ×tamp->surfaceTimestamp); + if (result != VK_SUCCESS) + return result; + + return VK_SUCCESS; +} diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py index c36559f48ef..0018eb9040f 100644 --- a/src/amd/vulkan/radv_extensions.py +++ b/src/amd/vulkan/radv_extensions.py @@ -109,6 +109,7 @@ EXTENSIONS = [ Extension('VK_AMD_shader_core_properties', 1, True), Extension('VK_AMD_shader_info', 1, True), Extension('VK_AMD_shader_trinary_minmax', 1, True), + Extension('VK_MESA_query_timestamp', 1, True), ] class VkVersion: diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 4e4b3a6037a..f37136450cc 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -76,6 +76,7 @@ typedef uint32_t xcb_window_t; #include <vulkan/vulkan_intel.h> #include <vulkan/vk_icd.h> #include <vulkan/vk_android_native_buffer.h> +#include <vulkan/vk_mesa_query_timestamp.h> #include "radv_entrypoints.h" -- 2.18.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev