From 2a8e6a4d1afa8ecf99a860160177820b967c3557 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 16 May 2022 11:07:03 -0700 Subject: [PATCH] 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: --- 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 ||