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 <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10003
Fixes: 4cfb4f7d12 ("anv: support fast color clears on vkCmdClearAttachments")
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29518>
This commit is contained in:
Lionel Landwerlin 2024-06-02 03:21:23 +03:00 committed by Marge Bot
parent 18a0ff137f
commit d9567b5ee4

View file

@ -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;
}