Mesa (master): tu: Respect VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 26 11:33:30 UTC 2020


Module: Mesa
Branch: master
Commit: 439a4ac0250f86b8f15fc33bb9443e52045beae8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=439a4ac0250f86b8f15fc33bb9443e52045beae8

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Wed May 20 14:41:48 2020 +0200

tu: Respect VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT

This came up with some image tests that are enabled by the next commit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5122>

---

 src/freedreno/vulkan/tu_image.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 80804496589..de8b6dc3f0d 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -89,10 +89,21 @@ tu_image_create(VkDevice _device,
    bool ubwc_enabled =
       !(device->physical_device->instance->debug_flags & TU_DEBUG_NOUBWC);
 
-   /* disable tiling when linear is requested and for YUYV/UYVY */
+   /* disable tiling when linear is requested, for YUYV/UYVY, and for mutable
+    * images. Mutable images can be reinterpreted as any other compatible
+    * format, including swapped formats which aren't supported with tiling.
+    * This means that we have to fall back to linear almost always. However
+    * depth and stencil formats cannot be reintepreted as another format, and
+    * cannot be linear with sysmem rendering, so don't fall back for those.
+    *
+    * TODO: Be smarter and use usage bits and VK_KHR_image_format_list to
+    * enable tiling and/or UBWC when possible.
+    */
    if (pCreateInfo->tiling == VK_IMAGE_TILING_LINEAR ||
        modifier == DRM_FORMAT_MOD_LINEAR ||
-       vk_format_description(image->vk_format)->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
+       vk_format_description(image->vk_format)->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED ||
+       (pCreateInfo->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT &&
+        !vk_format_is_depth_or_stencil(image->vk_format))) {
       image->layout.tile_mode = TILE6_LINEAR;
       ubwc_enabled = false;
    }



More information about the mesa-commit mailing list