From: Sagar Ghuge Date: Tue, 17 Sep 2019 20:20:16 +0000 (-0700) Subject: iris: Resolve stencil resource prior to copy or used by CPU X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b22b3494430e40fcdeee0ea30c2af85d7d7b9c39;p=mesa.git iris: Resolve stencil resource prior to copy or used by CPU v2: Decide aux usage in get_copy_region_aux_settings (Nanley Chery) v3: Use isl_surf_usage_is_stencil function (Nanley Chery) Signed-off-by: Sagar Ghuge Reviewed-by: Nanley Chery --- diff --git a/src/gallium/drivers/iris/iris_blit.c b/src/gallium/drivers/iris/iris_blit.c index e10e54667f4..62179edd9bb 100644 --- a/src/gallium/drivers/iris/iris_blit.c +++ b/src/gallium/drivers/iris/iris_blit.c @@ -566,19 +566,29 @@ static void get_copy_region_aux_settings(const struct gen_device_info *devinfo, struct iris_resource *res, enum isl_aux_usage *out_aux_usage, - bool *out_clear_supported) + bool *out_clear_supported, + bool is_render_target) { switch (res->aux.usage) { case ISL_AUX_USAGE_MCS: case ISL_AUX_USAGE_MCS_CCS: case ISL_AUX_USAGE_CCS_E: - *out_aux_usage = res->aux.usage; - /* Prior to Gen9, fast-clear only supported 0/1 clear colors. Since - * we're going to re-interpret the format as an integer format possibly - * with a different number of components, we can't handle clear colors - * until Gen9. + /* A stencil resolve operation must be performed prior to doing resource + * copies or used by CPU. + * (see HSD 1209978162) */ - *out_clear_supported = devinfo->gen >= 9; + if (is_render_target && isl_surf_usage_is_stencil(res->surf.usage)) { + *out_aux_usage = ISL_AUX_USAGE_NONE; + *out_clear_supported = false; + } else { + *out_aux_usage = res->aux.usage; + /* Prior to Gen9, fast-clear only supported 0/1 clear colors. Since + * we're going to re-interpret the format as an integer format possibly + * with a different number of components, we can't handle clear colors + * until Gen9. + */ + *out_clear_supported = devinfo->gen >= 9; + } break; default: *out_aux_usage = ISL_AUX_USAGE_NONE; @@ -615,9 +625,9 @@ iris_copy_region(struct blorp_context *blorp, enum isl_aux_usage src_aux_usage, dst_aux_usage; bool src_clear_supported, dst_clear_supported; get_copy_region_aux_settings(devinfo, src_res, &src_aux_usage, - &src_clear_supported); + &src_clear_supported, false); get_copy_region_aux_settings(devinfo, dst_res, &dst_aux_usage, - &dst_clear_supported); + &dst_clear_supported, true); if (iris_batch_references(batch, src_res->bo)) tex_cache_flush_hack(batch, ISL_FORMAT_UNSUPPORTED, src_res->surf.format);