turnip: hook up GetImageDrmFormatModifierPropertiesEXT
authorJonathan Marek <jonathan@marek.ca>
Tue, 21 Jan 2020 13:32:32 +0000 (08:32 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 18:34:07 +0000 (18:34 +0000)
Fixes: 210e6887 "vulkan/wsi: Use the interface from the real modifiers extension"
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3485>

src/freedreno/vulkan/tu_extensions.py
src/freedreno/vulkan/tu_image.c

index 0856d6d2d625e9a64e22eb336d18db673a6c982b..3e1a7cf6625e1af7d3cc0e649d38b9334732d97b 100644 (file)
@@ -76,6 +76,7 @@ EXTENSIONS = [
     Extension('VK_KHR_external_memory',                   1, True),
     Extension('VK_KHR_external_memory_fd',                1, True),
     Extension('VK_EXT_external_memory_dma_buf',           1, True),
+    Extension('VK_EXT_image_drm_format_modifier',         1, False),
 ]
 
 class VkVersion:
index 08028e520638f4aa7f29f03f438fc3d6f688b35d..7dbbcb99682481622bef4d2b3876116a5a41bd7e 100644 (file)
@@ -444,6 +444,29 @@ tu_GetImageSubresourceLayout(VkDevice _device,
    }
 }
 
+VkResult tu_GetImageDrmFormatModifierPropertiesEXT(
+    VkDevice                                    device,
+    VkImage                                     _image,
+    VkImageDrmFormatModifierPropertiesEXT*      pProperties)
+{
+   TU_FROM_HANDLE(tu_image, image, _image);
+
+   assert(pProperties->sType ==
+          VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT);
+
+   /* TODO invent a modifier for tiled but not UBWC buffers */
+
+   if (!image->layout.tile_mode)
+      pProperties->drmFormatModifier = DRM_FORMAT_MOD_LINEAR;
+   else if (image->layout.ubwc_size)
+      pProperties->drmFormatModifier = DRM_FORMAT_MOD_QCOM_COMPRESSED;
+   else
+      pProperties->drmFormatModifier = DRM_FORMAT_MOD_INVALID;
+
+   return VK_SUCCESS;
+}
+
+
 VkResult
 tu_CreateImageView(VkDevice _device,
                    const VkImageViewCreateInfo *pCreateInfo,