Commit f31ee059 authored by Nanley Chery's avatar Nanley Chery
Browse files

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
parent b580dd64
Pipeline #265651 waiting for manual action with stages
in 14 seconds
......@@ -586,6 +586,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;
}
/* Fall-through */
case ISL_AUX_USAGE_CCS_E:
case ISL_AUX_USAGE_GEN12_CCS_E:
*out_aux_usage = res->aux.usage;
......
......@@ -908,6 +908,24 @@ iris_image_view_aux_usage(struct iris_context *ice,
return ISL_AUX_USAGE_NONE;
}
bool
iris_can_sample_mcs_with_clear(const struct gen_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->gen >= 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)
{
......@@ -932,6 +950,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 gen_device_info *devinfo = &screen->devinfo;
enum isl_aux_usage aux_usage =
iris_resource_texture_aux_usage(ice, res, view_format);
......@@ -944,6 +965,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);
......
......@@ -493,6 +493,9 @@ bool iris_resource_level_has_hiz(const struct iris_resource *res,
bool iris_sample_with_depth_aux(const struct gen_device_info *devinfo,
const struct iris_resource *res);
bool iris_can_sample_mcs_with_clear(const struct gen_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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment