[Mesa-dev] [PATCH 18/21] radv: Add new VK_MESA_query_timestamp extension to radv driver
Keith Packard
keithp at keithp.com
Wed Feb 14 00:31:31 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 coorelate GPU and CPU
timestamps.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
src/amd/vulkan/Makefile.am | 3 +++
src/amd/vulkan/meson.build | 8 ++++----
src/amd/vulkan/radv_device.c | 8 ++++++++
src/amd/vulkan/radv_extensions.py | 1 +
4 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/amd/vulkan/Makefile.am b/src/amd/vulkan/Makefile.am
index 94ece06e99e..86dfb0265d6 100644
--- a/src/amd/vulkan/Makefile.am
+++ b/src/amd/vulkan/Makefile.am
@@ -129,12 +129,14 @@ libvulkan_radeon_la_SOURCES = $(VULKAN_GEM_FILES)
vulkan_api_xml = $(top_srcdir)/src/vulkan/registry/vk.xml
vk_android_native_buffer_xml = $(top_srcdir)/src/vulkan/registry/vk_android_native_buffer.xml
+vk_mesa_query_timestamp_xml = $(top_srcdir)/src/vulkan/registry/vk_mesa_query_timestamp.xml
radv_entrypoints.c: radv_entrypoints_gen.py radv_extensions.py $(vulkan_api_xml)
$(MKDIR_GEN)
$(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_entrypoints_gen.py \
--xml $(vulkan_api_xml) \
--xml $(vk_android_native_buffer_xml) \
+ --xml $(vk_mesa_query_timestamp_xml) \
--outdir $(builddir)
radv_entrypoints.h: radv_entrypoints.c
@@ -144,6 +146,7 @@ radv_extensions.c: radv_extensions.py \
$(AM_V_GEN)$(PYTHON2) $(srcdir)/radv_extensions.py \
--xml $(vulkan_api_xml) \
--xml $(vk_android_native_buffer_xml) \
+ --xml $(vk_mesa_query_timestamp_xml) \
--out $@
vk_format_table.c: vk_format_table.py \
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index 0b92a1763a1..34f578476c0 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -20,10 +20,10 @@
radv_entrypoints = custom_target(
'radv_entrypoints.[ch]',
- input : ['radv_entrypoints_gen.py', vk_api_xml],
+ input : ['radv_entrypoints_gen.py', vk_api_xml, vk_android_native_buffer_xml, vk_mesa_query_timestamp_xml],
output : ['radv_entrypoints.h', 'radv_entrypoints.c'],
command : [
- prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--outdir',
+ prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--xml', '@INPUT3@', '--outdir',
meson.current_build_dir()
],
depend_files : files('radv_extensions.py'),
@@ -31,10 +31,10 @@ radv_entrypoints = custom_target(
radv_extensions_c = custom_target(
'radv_extensions.c',
- input : ['radv_extensions.py', vk_api_xml, vk_android_native_buffer_xml],
+ input : ['radv_extensions.py', vk_api_xml, vk_android_native_buffer_xml, vk_mesa_query_timestamp_xml],
output : ['radv_extensions.c'],
command : [
- prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--out', '@OUTPUT@',
+ prog_python2, '@INPUT0@', '--xml', '@INPUT1@', '--xml', '@INPUT2@', '--xml', '@INPUT3@', '--out', '@OUTPUT@',
],
)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 8ae7391c891..09c5ca8edcc 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -4083,3 +4083,11 @@ radv_DebugReportMessageEXT(VkInstance _instance,
vk_debug_report(&instance->debug_report_callbacks, flags, objectType,
object, location, messageCode, pLayerPrefix, pMessage);
}
+
+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 42b8d996b6a..0e7b18dc104 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -95,6 +95,7 @@ EXTENSIONS = [
Extension('VK_AMD_draw_indirect_count', 1, True),
Extension('VK_AMD_rasterization_order', 1, 'device->rad_info.chip_class >= VI && device->rad_info.max_se >= 2'),
Extension('VK_AMD_shader_info', 1, True),
+ Extension('VK_MESA_query_timestamp', 1, True),
]
class VkVersion:
--
2.15.1
More information about the mesa-dev
mailing list