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

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Thu Aug 31 04:24:19 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    | 105 ++++++++++++++++++++++++++++++++++++++++++
 src/vulkan/registry/vk.xml | 111 ++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 204 insertions(+), 12 deletions(-)

diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h
index a297bae4e9..9fa0f0fb14 100644
--- a/include/vulkan/vulkan.h
+++ b/include/vulkan/vulkan.h
@@ -319,6 +319,12 @@ typedef enum VkStructureType {
     VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000,
     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_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000,
     VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001,
     VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000,
@@ -333,6 +339,7 @@ typedef enum VkStructureType {
     VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002,
     VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000,
     VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000,
+    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),
@@ -4119,6 +4126,7 @@ typedef enum VkExternalMemoryHandleTypeFlagBitsKHR {
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040,
+    VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_MESAX = 0x00020000,
     VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
 } VkExternalMemoryHandleTypeFlagBitsKHR;
 typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR;
@@ -6303,6 +6311,103 @@ 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
+
+
 #define VK_EXT_sampler_filter_minmax 1
 #define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1
 #define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax"
diff --git a/src/vulkan/registry/vk.xml b/src/vulkan/registry/vk.xml
index f0a1cd625b..1b7196777d 100644
--- a/src/vulkan/registry/vk.xml
+++ b/src/vulkan/registry/vk.xml
@@ -2472,6 +2472,66 @@ private version is maintained in the 1.0 branch of the member gitlab server.
             <member><type>uint32_t</type>                                                                         <name>coverageModulationTableCount</name></member>
             <member noautovalidity="true" optional="true" len="coverageModulationTableCount">const <type>float</type>* <name>pCoverageModulationTable</name></member>
         </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>
 
     <comment>Vulkan enumerant (token) definitions</comment>
@@ -5139,6 +5199,12 @@ private version is maintained in the 1.0 branch of the member gitlab server.
             <param optional="false,true"><type>uint32_t</type>* <name>pSparseMemoryRequirementCount</name></param>
             <param optional="true" len="pSparseMemoryRequirementCount"><type>VkSparseImageMemoryRequirements2KHR</type>* <name>pSparseMemoryRequirements</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>
 
     <feature api="vulkan" name="VK_VERSION_1_0" number="1.0" comment="Vulkan core API interface definitions">
@@ -6616,18 +6682,36 @@ private version is maintained in the 1.0 branch of the member gitlab server.
                 <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">
+        <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_MESA_EXTENSION_126_SPEC_VERSION"/>
-                <enum value=""VK_MESA_extension_126""         name="VK_MESA_EXTENSION_126_EXTENSION_NAME"/>
+                <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_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"/>
+         </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>
         <extension name="VK_KHR_dedicated_allocation" number="128" type="device" author="KHR" contact="James Jones @cubanismo" supported="vulkan">
             <require>
                 <enum value="3"                                         name="VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION"/>
@@ -6899,10 +6983,13 @@ private version is maintained in the 1.0 branch of the member gitlab server.
                 <enum value=""VK_KHR_extension_158""           name="VK_KHR_EXTENSION_158_EXTENSION_NAME"/>
             </require>
         </extension>
-        <extension name="VK_EXT_extension_159" number="159" author="EXT" contact="Chad Versace @chadversary" supported="disabled">
+        <extension name="VK_EXT_get_image_properties" number="159" type="device" author="EXT" contact="Chad Versace @chadversary" supported="vulkan">
             <require>
-                <enum value="0"                                          name="VK_EXT_EXTENSION_159_SPEC_VERSION"/>
-                <enum value=""VK_EXT_extension_159""           name="VK_EXT_EXTENSION_159_EXTENSION_NAME"/>
+                <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>
         <extension name="VK_EXT_extension_160" number="160" author="EXT" contact="Mark Young @MarkY_LunarG" supported="disabled">
-- 
2.13.0



More information about the mesa-dev mailing list