iris: Avoid sampling some MCS surfaces with clear

Supposedly avoids GPU hangs in BF4. See HSD 1707282275 and 14013111325.

v2. Fix bug in WA implementation. (Sagar)

Cc: mesa-stable
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8755>
This commit is contained in:
Nanley Chery 2021-01-26 15:50:20 -08:00 committed by Marge Bot
parent eef4c708b3
commit bcdebf4ff8
3 changed files with 36 additions and 0 deletions

View file

@ -571,6 +571,13 @@ get_copy_region_aux_settings(struct iris_context *ice,
break;
case ISL_AUX_USAGE_MCS:
case ISL_AUX_USAGE_MCS_CCS:
if (!is_render_target &&
!iris_can_sample_mcs_with_clear(devinfo, res)) {
*out_aux_usage = res->aux.usage;
*out_clear_supported = false;
break;
}
FALLTHROUGH;
case ISL_AUX_USAGE_CCS_E:
case ISL_AUX_USAGE_GFX12_CCS_E:
*out_aux_usage = res->aux.usage;

View file

@ -885,6 +885,24 @@ iris_image_view_aux_usage(struct iris_context *ice,
return ISL_AUX_USAGE_NONE;
}
bool
iris_can_sample_mcs_with_clear(const struct intel_device_info *devinfo,
const struct iris_resource *res)
{
assert(isl_aux_usage_has_mcs(res->aux.usage));
/* On TGL, the sampler has an issue with some 8 and 16bpp MSAA fast clears.
* See HSD 1707282275, wa_14013111325. Due to the use of
* format-reinterpretation, a simplified workaround is implemented.
*/
if (devinfo->ver >= 12 &&
isl_format_get_layout(res->surf.format)->bpb <= 16) {
return false;
}
return true;
}
static bool
isl_formats_are_fast_clear_compatible(enum isl_format a, enum isl_format b)
{
@ -909,6 +927,9 @@ iris_resource_prepare_texture(struct iris_context *ice,
uint32_t start_level, uint32_t num_levels,
uint32_t start_layer, uint32_t num_layers)
{
const struct iris_screen *screen = (void *) ice->ctx.screen;
const struct intel_device_info *devinfo = &screen->devinfo;
enum isl_aux_usage aux_usage =
iris_resource_texture_aux_usage(ice, res, view_format);
@ -921,6 +942,11 @@ iris_resource_prepare_texture(struct iris_context *ice,
if (!isl_formats_are_fast_clear_compatible(res->surf.format, view_format))
clear_supported = false;
if (isl_aux_usage_has_mcs(aux_usage) &&
!iris_can_sample_mcs_with_clear(devinfo, res)) {
clear_supported = false;
}
iris_resource_prepare_access(ice, res, start_level, num_levels,
start_layer, num_layers,
aux_usage, clear_supported);

View file

@ -531,6 +531,9 @@ bool iris_resource_level_has_hiz(const struct iris_resource *res,
bool iris_sample_with_depth_aux(const struct intel_device_info *devinfo,
const struct iris_resource *res);
bool iris_can_sample_mcs_with_clear(const struct intel_device_info *devinfo,
const struct iris_resource *res);
bool iris_has_color_unresolved(const struct iris_resource *res,
unsigned start_level, unsigned num_levels,
unsigned start_layer, unsigned num_layers);