[03/20] vulkan/registry: Add VK_ANDROID_native_buffer

Submitted by Chad Versace on Sept. 13, 2017, 11:03 p.m.

Details

Message ID 20170913230329.30165-4-chad@kiwitree.net
State New
Headers show
Series "anv: Implement VK_ANDROID_native_buffer" ( rev: 9 8 7 6 5 4 3 ) in Mesa

Not browsing as part of any series.

Commit Message

Chad Versace Sept. 13, 2017, 11:03 p.m.
From: Chad Versace <chadversary@chromium.org>

The VK_ANDROID_native_buffer extension is missing from the official
vk.xml. This patch defines the extension in a separate, minimal XML
file: vk_android_native_buffer.xml.

I chose to add the extension to a new XML file instead of adding it to
the official vk.xml in order to avoid conflicts each time we sync the
vk.xml from Khronos.

This should be only a temporary solution until Jesse Hall is persuaded
to add it to the official vk.xml.
---
 src/Makefile.am                                  |  2 +
 src/vulkan/registry/vk_android_native_buffer.xml | 52 ++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 src/vulkan/registry/vk_android_native_buffer.xml

Patch hide | download patch | download mbox

diff --git a/src/Makefile.am b/src/Makefile.am
index e055cb8e701..7ca3c0a12d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,7 +72,9 @@  endif
 if HAVE_VULKAN_COMMON
 SUBDIRS += vulkan
 endif
+
 EXTRA_DIST += vulkan/registry/vk.xml
+EXTRA_DIST += vulkan/registry/vk_android_native_buffer.xml
 
 if HAVE_AMD_DRIVERS
 SUBDIRS += amd
diff --git a/src/vulkan/registry/vk_android_native_buffer.xml b/src/vulkan/registry/vk_android_native_buffer.xml
new file mode 100644
index 00000000000..2738908aa71
--- /dev/null
+++ b/src/vulkan/registry/vk_android_native_buffer.xml
@@ -0,0 +1,52 @@ 
+<?xml version="1.0" encoding="UTF-8"?>
+<registry>
+    <types>
+        <type category="struct" name="VkNativeBufferANDROID">
+            <member values="VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>* <name>pNext</name></member>
+            <member><type>buffer_handle_t</type> <name>handle</name></member>
+            <member><type>int</type> <name>stride</name></member>
+            <member><type>int</type> <name>format</name></member>
+            <member><type>int</type> <name>usage</name></member>
+        </type>
+    </types>
+    <commands>
+        <command>
+            <proto><type>VkResult</type> <name>vkGetSwapchainGrallocUsageANDROID</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param><type>VkFormat</type> <name>format</name></param>
+            <param><type>VkImageUsageFlags</type> <name>imageUsage</name></param>
+            <param><type>int</type>* <name>grallocUsage</name></param>
+        </command>
+        <command>
+            <proto><type>VkResult</type> <name>vkAcquireImageANDROID</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param><type>VkImage</type> <name>image</name></param>
+            <param><type>int</type> <name>nativeFenceFd</name></param>
+            <param><type>VkSemaphore</type> <name>semaphore</name></param>
+            <param><type>VkFence</type> <name>fence</name></param>
+        </command>
+        <command>
+            <proto><type>VkResult</type> <name>vkQueueSignalReleaseImageANDROID</name></proto>
+            <param><type>VkQueue</type> <name>queue</name></param>
+            <param><type>uint32_t</type> <name>waitSemaphoreCount</name></param>
+            <param>const <type>VkSemaphore</type>* <name>pWaitSemaphores</name></param>
+            <param><type>VkImage</type> <name>image</name></param>
+            <param><type>int</type>* <name>pNativeFenceFd</name></param>
+        </command>
+    </commands>
+    <extensions>
+        <extension name="VK_ANDROID_native_buffer" number="11" type="device" protect="ANDROID" supported="vulkan">
+            <require>
+                <enum value="5"                                         name="VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION"/>
+                <enum value="11"                                        name="VK_ANDROID_NATIVE_BUFFER_NUMBER"/>
+                <enum value="&quot;VK_ANDROID_native_buffer&quot;"      name="VK_ANDROID_NATIVE_BUFFER_NAME"/>
+                <enum offset="0" extends="VkStructureType"              name="VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID"/>
+                <type name="VkNativeBufferANDROID"/>
+                <command name="vkGetSwapchainGrallocUsageANDROID"/>
+                <command name="vkAcquireImageANDROID"/>
+                <command name="vkQueueSignalReleaseImageANDROID"/>
+            </require>
+        </extension>
+    </extensions>
+</registry>