anv: Use ANV_FAST_CLEAR_DEFAULT_VALUE for CCS on TGL+

On TGL, if a block of fragment shader outputs match the surface's clear
color, the HW may convert them to fast-clears (see HSD 14010672564).
This can lead to rendering corruptions if not handled properly. We
restrict the clear color to zero to avoid issues that can occur with:

   - Texture view rendering (including blorp_copy calls)
   - Images with multiple levels or array layers

Fixes: e614789588 ("anv: Also disallow CCS_E for multi-LOD images")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14723>
(cherry picked from commit c48401404c)
This commit is contained in:
Nanley Chery 2022-01-25 16:33:26 -05:00 committed by Eric Engestrom
parent d55fed66d9
commit cbb35dbbcc
2 changed files with 12 additions and 1 deletions

View file

@ -4486,7 +4486,7 @@
"description": "anv: Use ANV_FAST_CLEAR_DEFAULT_VALUE for CCS on TGL+",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "e61478958854c63d3d8dfe12948445e0086d3a91"
},

View file

@ -2279,6 +2279,17 @@ anv_layout_to_fast_clear_type(const struct intel_device_info * const devinfo,
case ISL_AUX_STATE_COMPRESSED_CLEAR:
if (aspect == VK_IMAGE_ASPECT_DEPTH_BIT) {
return ANV_FAST_CLEAR_DEFAULT_VALUE;
} else if (devinfo->ver >= 12 &&
image->planes[plane].aux_usage == ISL_AUX_USAGE_CCS_E) {
/* On TGL, if a block of fragment shader outputs match the surface's
* clear color, the HW may convert them to fast-clears (see HSD
* 14010672564). This can lead to rendering corruptions if not
* handled properly. We restrict the clear color to zero to avoid
* issues that can occur with:
* - Texture view rendering (including blorp_copy calls)
* - Images with multiple levels or array layers
*/
return ANV_FAST_CLEAR_DEFAULT_VALUE;
} else if (layout == VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) {
/* When we're in a render pass we have the clear color data from the
* VkRenderPassBeginInfo and we can use arbitrary clear colors. They