Mesa (staging/19.3): turnip: hook up GetImageDrmFormatModifierPropertiesEXT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 23 22:40:48 UTC 2020


Module: Mesa
Branch: staging/19.3
Commit: 43af5c33ac48ae942f0b6d4b0773cb086215940e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43af5c33ac48ae942f0b6d4b0773cb086215940e

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Tue Jan 21 08:32:32 2020 -0500

turnip: hook up GetImageDrmFormatModifierPropertiesEXT

Fixes: 210e6887 "vulkan/wsi: Use the interface from the real modifiers extension"

Signed-off-by: Jonathan Marek <jonathan at marek.ca>
Acked-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3485>
(cherry picked from commit 11f6fba1c95b1a391d43fed44db3a8176b111493)

---

 .pick_status.json                     |  2 +-
 src/freedreno/vulkan/tu_extensions.py |  1 +
 src/freedreno/vulkan/tu_image.c       | 23 +++++++++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 589fadbd54d..da9f211cfa0 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -31,7 +31,7 @@
         "description": "turnip: hook up GetImageDrmFormatModifierPropertiesEXT",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "210e68874bbf5321adc6e6464a80526c177f8741"
     },
diff --git a/src/freedreno/vulkan/tu_extensions.py b/src/freedreno/vulkan/tu_extensions.py
index ca69ba7f119..1235911ee69 100644
--- a/src/freedreno/vulkan/tu_extensions.py
+++ b/src/freedreno/vulkan/tu_extensions.py
@@ -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:
diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 6c774de9f53..48580c343d6 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -440,6 +440,29 @@ tu_GetImageSubresourceLayout(VkDevice _device,
    pLayout->depthPitch = level->size;
 }
 
+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,



More information about the mesa-commit mailing list