From d9567b5ee48e747eff5b8af589eff3cbd0250308 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Sun, 2 Jun 2024 03:21:23 +0300 Subject: [PATCH] anv: fix Gfx9 fast clears on srgb formats Only MCS surfaces are affected because SRGB format are not listed as supporting CCS compression. Fixes CTS test : dEQP-VK.api.image_clearing.core.clear_color_attachment.single_layer.*_srgb_*sample_count_* dEQP-VK.api.image_clearing.dedicated_allocation.clear_color_attachment.single_layer.*srgb* This is similar to what we did in Iris in f8961ea0 ("iris: Disable sRGB fast-clears for non-0/1 values"). Signed-off-by: Lionel Landwerlin Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10003 Fixes: 4cfb4f7d12 ("anv: support fast color clears on vkCmdClearAttachments") Reviewed-by: Ivan Briano Part-of: --- src/intel/vulkan/anv_image.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 52ff3d9710d..c24a6857685 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -3497,6 +3497,22 @@ anv_can_fast_clear_color_view(struct anv_device *device, return false; } + /* Disable sRGB fast-clears for non-0/1 color values on Gfx9. For texturing + * and draw calls, HW expects the clear color to be in two different color + * spaces after sRGB fast-clears - sRGB in the former and linear in the + * latter. By limiting the allowable values to 0/1, both color space + * requirements are satisfied. + * + * Gfx11+ is fine as the fast clear generate 2 colors at the clear color + * address, raw & converted such that all fixed functions can find the + * value they need. + */ + if (device->info->ver == 9 && + isl_format_is_srgb(iview->planes[0].isl.format) && + !isl_color_value_is_zero_one(clear_color, + iview->planes[0].isl.format)) + return false; + return true; }