From a0bb9cb6d8e919fe0cef58a58c534caf574fc211 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Thu, 5 Jun 2025 10:22:06 -0400 Subject: [PATCH] iris: Update clear color initializations for FCV There were a couple issues in iris_resource_prepare_render(): * It previously assumed that the sampler would always look at the raw dwords for 32bpc formats. However, the sampler only does this on gfx12.0 for R32 formats (not RG32 formats for example). Update the comments to reflect this. * It only initialized the clear color if the render_format was non-32bpc. However, initialization is still needed outside of this case because a subsequent sampling operation may use a view format which looks at the sampler field. Check for the FCV aux-usage instead of the render format's number of bits-per-channel to fix this. Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/drivers/iris/iris_resolve.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index ab2bfbc669c..efbcac884ac 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -1306,13 +1306,12 @@ iris_resource_prepare_render(struct iris_context *ice, * blocks generated as a result of the render will be recoverable. * * - The clear color struct is uninitialized and potentially inconsistent - * with itself. For non-32-bpc formats, the struct consists of different - * fields for rendering and sampling. If rendering can generate - * fast-cleared blocks, we want these to agree so that we can avoid - * partially resolving prior to sampling. Images with modifiers can be - * ignored. Either we will have already initialized their structs to - * zero, or they will have already been consistent at the time of import - * (as defined by drm_fourcc.h) + * with itself. The struct consists of different fields for rendering and + * sampling. If rendering can generate fast-cleared blocks, we want these + * to agree so that we can avoid partially resolving prior to sampling. + * Images with modifiers can be ignored. Either we will have already + * initialized their structs to zero, or they will have already been + * consistent at the time of import (as defined by drm_fourcc.h) * * The only aux usage which requires this process is FCV_CCS_E. Other aux * usages share a subset of these restrictions and benefit from only some @@ -1324,7 +1323,7 @@ iris_resource_prepare_render(struct iris_context *ice, res->aux.clear_color, res->aux.clear_color_unknown) || (res->aux.clear_color_unknown && !res->mod_info && - isl_format_get_layout(render_format)->channels.r.bits != 32)) { + aux_usage == ISL_AUX_USAGE_FCV_CCS_E)) { /* Remove references to the clear color with resolves. */ iris_resource_prepare_access(ice, res, 0, INTEL_REMAINING_LEVELS, 0,