Mesa (main): turnip: disable UBWC for SNORM formats

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat May 21 15:54:08 UTC 2022


Module: Mesa
Branch: main
Commit: 2a8e6a4d1afa8ecf99a860160177820b967c3557
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a8e6a4d1afa8ecf99a860160177820b967c3557

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Mon May 16 11:07:03 2022 -0700

turnip: disable UBWC for SNORM formats

In copy_format, we treat snorm as unorm to avoid clamping.  But snorm
and unorm are UBWC incompatible for special values such as all 0's or
all 1's.  Disable UBWC for snorm.

For reference, I dumped the first byte of an UBWC blocks and it was

  color      UNORM  SNORM
  all black  0x01   0x31
  all white  0x0d   0x11

@flto clarified that bit 4 is unset for fast clear encoded blocks.  It
looks like fast clear is not used for SNORM.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6480
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16534>

---

 src/freedreno/vulkan/tu_image.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/freedreno/vulkan/tu_image.c b/src/freedreno/vulkan/tu_image.c
index 1fc0bf38c35..8ab5f1481a5 100644
--- a/src/freedreno/vulkan/tu_image.c
+++ b/src/freedreno/vulkan/tu_image.c
@@ -296,6 +296,13 @@ ubwc_possible(VkFormat format, VkImageType type, VkImageUsageFlags usage,
        format == VK_FORMAT_S8_UINT)
       return false;
 
+   /* In copy_format, we treat snorm as unorm to avoid clamping.  But snorm
+    * and unorm are UBWC incompatible for special values such as all 0's or
+    * all 1's.  Disable UBWC for snorm.
+    */
+   if (vk_format_is_snorm(format))
+      return false;
+
    if (!info->a6xx.has_8bpp_ubwc &&
        (format == VK_FORMAT_R8_UNORM ||
         format == VK_FORMAT_R8_SNORM ||



More information about the mesa-commit mailing list