[Mesa-dev] [PATCH mesa 3/3] radv: Add new VK_MESA_query_timestamp extension to radv driver [v2]
Keith Packard
keithp at keithp.com
Wed Jun 27 19:51:14 UTC 2018
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 <keithp at 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 ad3465f594e..2ea208f7d6f 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -4772,3 +4772,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 a0f1038110b..e5e6f25fca1 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -108,6 +108,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 df335b43d8d..fe895ac777c 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -75,6 +75,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.17.1
More information about the mesa-dev
mailing list