diff mbox

[3/3] radv: Add new VK_MESA_query_timestamp extension to radv driver

Message ID 20180623151521.8306-4-keithp@keithp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Keith Packard June 23, 2018, 3:15 p.m. UTC
This extension adds a single function to query the current GPU
timestamp, just like glGetInteger64v(GL_TIMESTAMP, &timestamp). 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@keithp.com>
---
 src/amd/vulkan/radv_device.c      | 8 ++++++++
 src/amd/vulkan/radv_extensions.py | 1 +
 src/amd/vulkan/radv_private.h     | 1 +
 3 files changed, 10 insertions(+)
diff mbox

Patch

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 62e1b9dba66..c552030491f 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -4770,3 +4770,11 @@  radv_GetDeviceGroupPeerMemoryFeatures(
 	                       VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT |
 	                       VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT;
 }
+
+VkResult radv_QueryCurrentTimestampMESA(VkDevice _device, uint64_t *timestamp)
+{
+	RADV_FROM_HANDLE(radv_device, device, _device);
+
+	*timestamp = device->ws->query_value(device->ws, RADEON_TIMESTAMP);
+	return VK_SUCCESS;
+}
diff --git a/src/amd/vulkan/radv_extensions.py b/src/amd/vulkan/radv_extensions.py
index ebc3f6bc2b5..008e5cfe960 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -107,6 +107,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 f001b836c8f..a3e0a6f013c 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"