[Mesa-dev] [PATCH mesa 16/21] vulkan: Define new VK_MESA_query_timestamp extension
Keith Packard
keithp at keithp.com
Thu Mar 8 07:25: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>
---
include/vulkan/vk_mesa_query_timestamp.h | 41 +++++++++++++++++++++++++
src/Makefile.am | 1 +
src/vulkan/meson.build | 1 +
src/vulkan/registry/vk_mesa_query_timestamp.xml | 22 +++++++++++++
4 files changed, 65 insertions(+)
create mode 100644 include/vulkan/vk_mesa_query_timestamp.h
create mode 100644 src/vulkan/registry/vk_mesa_query_timestamp.xml
diff --git a/include/vulkan/vk_mesa_query_timestamp.h b/include/vulkan/vk_mesa_query_timestamp.h
new file mode 100644
index 00000000000..20b53446e04
--- /dev/null
+++ b/include/vulkan/vk_mesa_query_timestamp.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2018 Keith Packard
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. The copyright holders make no representations
+ * about the suitability of this software for any purpose. It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#ifndef __VK_MESA_QUERY_TIMESTAMP_H__
+#define __VK_MESA_QUERY_TIMESTAMP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef VkResult (VKAPI_PTR *PFN_vkQueryCurrentTimestampMESA)(VkDevice device, uint64_t *timestamp);
+
+VKAPI_ATTR VkResult VKAPI_CALL vkQueryCurrentTimestampMESA(
+ VkDevice _device,
+ uint64_t *timestamp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __VK_MESA_QUERY_TIMESTAMP_H__ */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 014ffaf3e29..74ff305d7c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -68,6 +68,7 @@ endif
EXTRA_DIST += vulkan/registry/vk.xml
EXTRA_DIST += vulkan/registry/vk_android_native_buffer.xml
+EXTRA_DIST += vulkan/registry/vk_mesa_query_timestamp.xml
if HAVE_AMD_DRIVERS
SUBDIRS += amd
diff --git a/src/vulkan/meson.build b/src/vulkan/meson.build
index 3908005b8a0..6ab0966b7c5 100644
--- a/src/vulkan/meson.build
+++ b/src/vulkan/meson.build
@@ -20,6 +20,7 @@
vk_api_xml = files('registry/vk.xml')
vk_android_native_buffer_xml = files('registry/vk_android_native_buffer.xml')
+vk_mesa_query_timestamp_xml = files('registry/vk_mesa_query_timestamp.xml')
inc_vulkan_util = include_directories('util')
inc_vulkan_wsi = include_directories('wsi')
diff --git a/src/vulkan/registry/vk_mesa_query_timestamp.xml b/src/vulkan/registry/vk_mesa_query_timestamp.xml
new file mode 100644
index 00000000000..7fd4d974872
--- /dev/null
+++ b/src/vulkan/registry/vk_mesa_query_timestamp.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<registry>
+ <commands>
+ <command>
+ <proto><type>VkResult</type> <name>vkQueryCurrentTimestampMESA</name></proto>
+ <param><type>VkDevice</type> <name>device</name></param>
+ <param><type>uint64_t</type>* <name>pTimestamp</name></param>
+ </command>
+ </commands>
+ <extensions>
+ <extension name="VK_MESA_query_timestamp" number="200"
+ type="device" author="MESA"
+ contact="Keith Packard @keithp"
+ supported="vulkan">
+ <require>
+ <enum value="1" name="VK_MESA_QUERY_TIMESTAMP_SPEC_VERSION"/>
+ <enum value=""VK_MESA_query_timestamp"" name="VK_MESA_QUERY_TIMESTAMP_NAME"/>
+ <command name="vkQueryCurrentTimestampMESA"/>
+ </require>
+ </extension>
+ </extensions>
+</registry>
--
2.16.2
More information about the mesa-dev
mailing list