[Mesa-dev] [RFC v2 14/23] RFC: vulkan: Update registry for MESAX dma_buf extensions

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Fri Jul 14 04:59:12 UTC 2017


From: Chad Versace <chadversary at chromium.org>

Update vulkan.h and vk.xml from [1]:
  git://github.com/chadversary/vulkan-spec
  refs/tags/chadv/test/2017-03-06-VK_MESAX_external

This pulls in the following extensions:
  - VK_EXT_get_image_properties
  - VK_MESAX_external_memory_dma_buf
  - VK_MESAX_external_image_dma_buf

WARNING: These extension are still drafts. Khronos has not yet merged
them into the Vulkan spec. Up-to-date extension drafts and headers are
in my work-in-progress branch [2].

Reference[1]: https://github.com/chadversary/vulkan-spec/commits/chadv/test/2017-03-06-VK_MESAX_external
Reference[2]: https://github.com/chadversary/vulkan-spec/commits/wip/1.0-VK_MESAX_external
---
 include/vulkan/vulkan.h    | 104 ++++++++++++++++++++++++++++++++++++++++
 src/vulkan/registry/vk.xml | 117 ++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 209 insertions(+), 12 deletions(-)

diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h
index 51e5e9e313..dd8c8b40f6 100644
--- a/include/vulkan/vulkan.h
+++ b/include/vulkan/vulkan.h
@@ -304,6 +304,13 @@ typedef enum VkStructureType {
     VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002,
     VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000,
     VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
+    VK_STRUCTURE_TYPE_DMA_BUF_FORMAT_PROPERTIES_MESAX = 1000126000,
+    VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_FORMAT_PROPERTIES_MESAX = 1000126001,
+    VK_STRUCTURE_TYPE_IMPORT_IMAGE_DMA_BUF_INFO_MESAX = 1000126002,
+    VK_STRUCTURE_TYPE_EXPORT_IMAGE_DMA_BUF_INFO_MESAX = 1000126003,
+    VK_STRUCTURE_TYPE_IMAGE_PROPERTIES_MESAX = 1000126004,
+    VK_STRUCTURE_TYPE_IMAGE_DMA_BUF_PROPERTIES_MESAX = 1000126005,
+    VK_STRUCTURE_TYPE_IMAGE_PROPERTIES_EXT = 1000199000,
     VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
     VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
     VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
@@ -4940,6 +4947,7 @@ typedef enum VkExternalMemoryHandleTypeFlagBitsKHX {
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHX = 0x00000010,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHX = 0x00000020,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHX = 0x00000040,
+    VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_MESAX = 0x00020000,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF
 } VkExternalMemoryHandleTypeFlagBitsKHX;
 typedef VkFlags VkExternalMemoryHandleTypeFlagsKHX;
@@ -5919,6 +5927,102 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(
 #endif
 #endif /* VK_USE_PLATFORM_MACOS_MVK */
 
+#define VK_MESAX_external_memory_dma_buf 1
+#define VK_MESAX_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION 0
+#define VK_MESAX_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME "VK_MESAX_external_memory_dma_buf"
+
+
+#define VK_MESAX_external_image_dma_buf 1
+#define VK_MESAX_EXTERNAL_IMAGE_DMA_BUF_SPEC_VERSION 0
+#define VK_MESAX_EXTERNAL_IMAGE_DMA_BUF_EXTENSION_NAME "VK_MESAX_external_image_dma_buf"
+
+typedef struct VkDmaBufFormatModifierPropertiesMESAX {
+    uint64_t                drmFormatModifier;
+    VkFormatFeatureFlags    imageFeatures;
+} VkDmaBufFormatModifierPropertiesMESAX;
+
+typedef struct VkDmaBufFormatPropertiesMESAX {
+    VkStructureType                           sType;
+    void*                                     pNext;
+    uint32_t                                  modifierCount;
+    VkDmaBufFormatModifierPropertiesMESAX*    pModifierProperties;
+} VkDmaBufFormatPropertiesMESAX;
+
+typedef struct VkDmaBufImageFormatModifierPropertiesMESAX {
+    uint64_t                   drmFormatModifier;
+    VkDeviceSize               maxRowPitch;
+    VkDeviceSize               rowPitchAlignment;
+    VkImageFormatProperties    imageFormatProperties;
+} VkDmaBufImageFormatModifierPropertiesMESAX;
+
+typedef struct VkDmaBufImageFormatPropertiesMESAX {
+    VkStructureType                                sType;
+    void*                                          pNext;
+    uint32_t                                       modifierCount;
+    VkDmaBufImageFormatModifierPropertiesMESAX*    pModifierProperties;
+} VkDmaBufImageFormatPropertiesMESAX;
+
+typedef struct VkImportImageDmaBufPlaneInfoMESAX {
+    VkDeviceSize    offset;
+    VkDeviceSize    size;
+    VkDeviceSize    rowPitch;
+} VkImportImageDmaBufPlaneInfoMESAX;
+
+typedef struct VkImportImageDmaBufInfoMESAX {
+    VkStructureType                             sType;
+    const void*                                 pNext;
+    uint64_t                                    drmFormatModifier;
+    uint32_t                                    planeCount;
+    const VkImportImageDmaBufPlaneInfoMESAX*    pPlanes;
+} VkImportImageDmaBufInfoMESAX;
+
+typedef struct VkExportImageDmaBufInfoMESAX {
+    VkStructureType    sType;
+    const void*        pNext;
+    uint32_t           drmFormatModifierCount;
+    const uint64_t*    pDrmFormatModifiers;
+} VkExportImageDmaBufInfoMESAX;
+
+typedef struct VkImagePropertiesMESAX {
+    VkStructureType    sType;
+    void*              pNext;
+} VkImagePropertiesMESAX;
+
+typedef struct VkImageDmaBufPlanePropertiesMESAX {
+    VkDeviceSize    offset;
+    VkDeviceSize    size;
+    VkDeviceSize    rowPitch;
+} VkImageDmaBufPlanePropertiesMESAX;
+
+typedef struct VkImageDmaBufPropertiesMESAX {
+    VkStructureType                       sType;
+    void*                                 pNext;
+    uint64_t                              drmFormatModifier;
+    uint32_t                              planeCount;
+    VkImageDmaBufPlanePropertiesMESAX*    pPlanes;
+} VkImageDmaBufPropertiesMESAX;
+
+
+
+#define VK_EXT_get_image_properties 1
+#define VK_EXT_GET_IMAGE_PROPERTIES_SPEC_VERSION 1
+#define VK_EXT_GET_IMAGE_PROPERTIES_EXTENSION_NAME "VK_EXT_get_image_properties"
+
+typedef struct VkImagePropertiesEXT {
+    VkStructureType    sType;
+    void*              pNext;
+} VkImagePropertiesEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkGetImagePropertiesEXT)(VkDevice device, VkImage image, VkImagePropertiesEXT* pProperties);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkGetImagePropertiesEXT(
+    VkDevice                                    device,
+    VkImage                                     image,
+    VkImagePropertiesEXT*                       pProperties);
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/vulkan/registry/vk.xml b/src/vulkan/registry/vk.xml
index 1beed0b798..f62892d779 100644
--- a/src/vulkan/registry/vk.xml
+++ b/src/vulkan/registry/vk.xml
@@ -2275,6 +2275,66 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
             <member noautovalidity="true"><type>void</type>*                            <name>pNext</name></member>                    <!-- Pointer to next structure -->
             <member optional="true"><type>VkImageUsageFlags</type> <name>sharedPresentSupportedUsageFlags</name></member> <!-- Supported image usage flags if swapchain created using a shared present mode -->
         </type>
+        <type category="struct" name="VkImagePropertiesEXT">
+            <member values="VK_STRUCTURE_TYPE_IMAGE_PROPERTIES_EXT"><type>VkStructureType</type> <name>sType</name></member>
+            <member><type>void</type>* <name>pNext</name></member>
+        </type>
+        <type category="struct" name="VkDmaBufFormatModifierPropertiesMESAX">
+            <member><type>uint64_t</type>               <name>drmFormatModifier</name></member>
+            <member><type>VkFormatFeatureFlags</type>   <name>imageFeatures</name></member>
+        </type>
+        <type category="struct" name="VkDmaBufFormatPropertiesMESAX">
+            <member values="VK_STRUCTURE_TYPE_DMA_BUF_FORMAT_PROPERTIES_MESAX"><type>VkStructureType</type> <name>sType</name></member>
+            <member><type>void</type>*                                                          <name>pNext</name></member>
+            <member optional="true"><type>uint32_t</type>                                       <name>modifierCount</name></member>
+            <member optional="true" len="modifierCount"><type>VkDmaBufFormatModifierPropertiesMESAX</type>*     <name>pModifierProperties</name></member>
+        </type>
+        <type category="struct" name="VkDmaBufImageFormatModifierPropertiesMESAX">
+            <member><type>uint64_t</type>                 <name>drmFormatModifier</name></member>
+            <member><type>VkDeviceSize</type>             <name>maxRowPitch</name></member>
+            <member><type>VkDeviceSize</type>             <name>rowPitchAlignment</name></member>
+            <member><type>VkImageFormatProperties</type>  <name>imageFormatProperties</name></member>
+        </type>
+        <type category="struct" name="VkDmaBufImageFormatPropertiesMESAX">
+            <member values="VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_FORMAT_PROPERTIES_MESAX"><type>VkStructureType</type> <name>sType</name></member>
+            <member><type>void</type>*                                                              <name>pNext</name></member>
+            <member optional="true"><type>uint32_t</type>                                           <name>modifierCount</name></member>
+            <member optional="true" len="modifierCount"><type>VkDmaBufImageFormatModifierPropertiesMESAX</type>*    <name>pModifierProperties</name></member>
+        </type>
+        <type category="struct" name="VkImportImageDmaBufPlaneInfoMESAX">
+            <member><type>VkDeviceSize</type>   <name>offset</name></member>
+            <member><type>VkDeviceSize</type>   <name>size</name></member>
+            <member><type>VkDeviceSize</type>   <name>rowPitch</name></member>
+        </type>
+        <type category="struct" name="VkImportImageDmaBufInfoMESAX">
+            <member values="VK_STRUCTURE_TYPE_IMPORT_IMAGE_DMA_BUF_INFO_MESAX"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                                                <name>pNext</name></member>
+            <member><type>uint64_t</type>                                                   <name>drmFormatModifier</name></member>
+            <member optional="true"><type>uint32_t</type>                                   <name>planeCount</name></member>
+            <member len="planeCount">const <type>VkImportImageDmaBufPlaneInfoMESAX</type>*  <name>pPlanes</name></member>
+        </type>
+        <type category="struct" name="VkExportImageDmaBufInfoMESAX">
+            <member values="VK_STRUCTURE_TYPE_EXPORT_IMAGE_DMA_BUF_INFO_MESAX"><type>VkStructureType</type> <name>sType</name></member>
+            <member>const <type>void</type>*                                    <name>pNext</name></member>
+            <member optional="true"><type>uint32_t</type>                       <name>drmFormatModifierCount</name></member>
+            <member len="drmFormatModifierCount">const <type>uint64_t</type>*   <name>pDrmFormatModifiers</name></member>
+        </type>
+        <type category="struct" name="VkImagePropertiesMESAX">
+            <member values="VK_STRUCTURE_TYPE_IMAGE_PROPERTIES_MESAX"><type>VkStructureType</type> <name>sType</name></member>
+            <member><type>void</type>* <name>pNext</name></member>
+        </type>
+        <type category="struct" name="VkImageDmaBufPlanePropertiesMESAX">
+            <member><type>VkDeviceSize</type>   <name>offset</name></member>
+            <member><type>VkDeviceSize</type>   <name>size</name></member>
+            <member><type>VkDeviceSize</type>   <name>rowPitch</name></member>
+        </type>
+        <type category="struct" name="VkImageDmaBufPropertiesMESAX">
+            <member values="VK_STRUCTURE_TYPE_IMAGE_DMA_BUF_PROPERTIES_MESAX"><type>VkStructureType</type> <name>sType</name></member>
+            <member><type>void</type>*                                                      <name>pNext</name></member>
+            <member><type>uint64_t</type>                                                   <name>drmFormatModifier</name></member>
+            <member optional="true"><type>uint32_t</type>                                   <name>planeCount</name></member>
+            <member optional="true" len="planeCount"><type>VkImageDmaBufPlanePropertiesMESAX</type>*  <name>pPlanes</name></member>
+        </type>
     </types>
 
     <!-- SECTION: Vulkan enumerant (token) definitions. -->
@@ -4866,6 +4926,12 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
             <param optional="false,true"><type>uint32_t</type>* <name>pSurfaceFormatCount</name></param>
             <param optional="true" len="pSurfaceFormatCount"><type>VkSurfaceFormat2KHR</type>* <name>pSurfaceFormats</name></param>
         </command>
+        <command successcodes="VK_SUCCESS">
+            <proto><type>VkResult</type> <name>vkGetImagePropertiesEXT</name></proto>
+            <param><type>VkDevice</type> <name>device</name></param>
+            <param><type>VkImage</type> <name>image</name></param>
+            <param><type>VkImagePropertiesEXT</type>* <name>pProperties</name></param>
+        </command>
     </commands>
 
     <!-- SECTION: Vulkan API interface definitions -->
@@ -6302,18 +6368,36 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
                 <enum value=""VK_MVK_moltenvk""               name="VK_MVK_MOLTENVK_EXTENSION_NAME"/>
             </require>
         </extension>
-        <extension name="VK_MESA_extension_126" number="126" author="MESA" contact="Chad Versace @chadversary" supported="disabled">
-            <require>
-                <enum value="0"                                         name="VK_MESA_EXTENSION_126_SPEC_VERSION"/>
-                <enum value=""VK_MESA_extension_126""         name="VK_MESA_EXTENSION_126_EXTENSION_NAME"/>
-            </require>
-        </extension>
-        <extension name="VK_MESA_extension_127" number="127" author="MESA" contact="Chad Versace @chadversary" supported="disabled">
-            <require>
-                <enum value="0"                                         name="VK_MESA_EXTENSION_127_SPEC_VERSION"/>
-                <enum value=""VK_MESA_extension_127""         name="VK_MESA_EXTENSION_127_EXTENSION_NAME"/>
-            </require>
-        </extension>
+        <extension name="VK_MESAX_external_memory_dma_buf" number="126" type="device" requires="VK_KHX_external_memory_fd" author="MESA" contact="Chad Versace @chadversary" supported="vulkan">
+            <require>
+                <enum value="0"                                                name="VK_MESAX_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION"/>
+                <enum value=""VK_MESAX_external_memory_dma_buf""     name="VK_MESAX_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME"/>
+                <!-- FINISHME(mesa): placeholder bitpos -->
+                <enum bitpos="17" extends="VkExternalMemoryHandleTypeFlagBitsKHX" name="VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_MESAX"/>
+            </require>
+         </extension>
+         <extension name="VK_MESAX_external_image_dma_buf" number="127" type="device" requires="VK_MESAX_external_memory_dma_buf" author="MESA" contact="Chad Versace @chadversary" supported="vulkan">
+            <require>
+                <enum value="0"                                                name="VK_MESAX_EXTERNAL_IMAGE_DMA_BUF_SPEC_VERSION"/>
+                <enum value=""VK_MESAX_external_image_dma_buf""      name="VK_MESAX_EXTERNAL_IMAGE_DMA_BUF_EXTENSION_NAME"/>
+                <enum offset="0" extends="VkStructureType"                     name="VK_STRUCTURE_TYPE_DMA_BUF_FORMAT_PROPERTIES_MESAX"/>
+                <enum offset="1" extends="VkStructureType"                     name="VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_FORMAT_PROPERTIES_MESAX"/>
+                <enum offset="2" extends="VkStructureType"                     name="VK_STRUCTURE_TYPE_IMPORT_IMAGE_DMA_BUF_INFO_MESAX"/>
+                <enum offset="3" extends="VkStructureType"                     name="VK_STRUCTURE_TYPE_EXPORT_IMAGE_DMA_BUF_INFO_MESAX"/>
+                <enum offset="4" extends="VkStructureType"                     name="VK_STRUCTURE_TYPE_IMAGE_PROPERTIES_MESAX"/>
+                <enum offset="5" extends="VkStructureType"                     name="VK_STRUCTURE_TYPE_IMAGE_DMA_BUF_PROPERTIES_MESAX"/>
+                <type name="VkDmaBufFormatPropertiesMESAX"/>
+                <type name="VkDmaBufFormatModifierPropertiesMESAX"/>
+                <type name="VkDmaBufImageFormatPropertiesMESAX"/>
+                <type name="VkDmaBufImageFormatModifierPropertiesMESAX"/>
+                <type name="VkImportImageDmaBufInfoMESAX"/>
+                <type name="VkImportImageDmaBufPlaneInfoMESAX"/>
+                <type name="VkExportImageDmaBufInfoMESAX"/>
+                <type name="VkImagePropertiesMESAX"/>
+                <type name="VkImageDmaBufPropertiesMESAX"/>
+                <type name="VkImageDmaBufPlanePropertiesMESAX"/>
+            </require>
+         </extension>
         <extension name="VK_KHR_extension_128" number="128" author="KHR" contact="James Jones @cubanismo" supported="disabled">
             <require>
                 <enum value="0"                                         name="VK_KHR_EXTENSION_128_SPEC_VERSION"/>
@@ -6488,5 +6572,14 @@ maintained in the master branch of the Khronos Vulkan GitHub project.
                 <enum value=""VK_NV_extension_156""            name="VK_NV_EXTENSION_156_EXTENSION_NAME"/>
             </require>
         </extension>
+        <extension name="VK_EXT_get_image_properties" number="159" type="device" author="EXT" contact="Chad Versace @chadversary" supported="vulkan">
+            <require>
+                <enum value="1"                                         name="VK_EXT_GET_IMAGE_PROPERTIES_SPEC_VERSION"/>
+                <enum value=""VK_EXT_get_image_properties""   name="VK_EXT_GET_IMAGE_PROPERTIES_EXTENSION_NAME"/>
+                <enum offset="0" extends="VkStructureType"              name="VK_STRUCTURE_TYPE_IMAGE_PROPERTIES_EXT"/>
+                <type name="VkImagePropertiesEXT"/>
+                <command name="vkGetImagePropertiesEXT"/>
+            </require>
+        </extension>
     </extensions>
 </registry>
-- 
2.13.0



More information about the mesa-dev mailing list