iris: Keep aux_usage in iris_blorp_surf_for_resource

Avoid the surprising behavior of overriding the aux usage for depth
resources.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8853>
This commit is contained in:
Nanley Chery 2020-12-14 11:10:02 -08:00 committed by Marge Bot
parent 0e03fe19e5
commit 7170479475
2 changed files with 15 additions and 13 deletions

View file

@ -240,10 +240,6 @@ iris_blorp_surf_for_resource(struct isl_device *isl_dev,
assert(!iris_resource_unfinished_aux_import(res));
if (isl_aux_usage_has_hiz(aux_usage) &&
!iris_resource_level_has_hiz(res, level))
aux_usage = ISL_AUX_USAGE_NONE;
*surf = (struct blorp_surf) {
.surf = &res->surf,
.addr = (struct blorp_address) {
@ -550,6 +546,7 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
static void
get_copy_region_aux_settings(struct iris_context *ice,
struct iris_resource *res,
unsigned level,
enum isl_aux_usage *out_aux_usage,
bool *out_clear_supported,
bool is_render_target)
@ -563,7 +560,9 @@ get_copy_region_aux_settings(struct iris_context *ice,
case ISL_AUX_USAGE_HIZ_CCS_WT:
case ISL_AUX_USAGE_STC_CCS:
if (is_render_target) {
*out_aux_usage = res->aux.usage;
*out_aux_usage = iris_resource_render_aux_usage(ice, res, level,
res->surf.format,
false);
} else {
*out_aux_usage = iris_resource_texture_aux_usage(ice, res,
res->surf.format);
@ -630,9 +629,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(ice, src_res, &src_aux_usage,
get_copy_region_aux_settings(ice, src_res, src_level, &src_aux_usage,
&src_clear_supported, false);
get_copy_region_aux_settings(ice, dst_res, &dst_aux_usage,
get_copy_region_aux_settings(ice, dst_res, dst_level, &dst_aux_usage,
&dst_clear_supported, true);
if (iris_batch_references(batch, src_res->bo))

View file

@ -573,11 +573,14 @@ clear_depth_stencil(struct iris_context *ice,
}
if (clear_depth && z_res) {
iris_resource_prepare_depth(ice, batch, z_res, level, box->z, box->depth);
const enum isl_aux_usage aux_usage =
iris_resource_render_aux_usage(ice, z_res, level, z_res->surf.format,
false);
iris_resource_prepare_render(ice, z_res, level, box->z, box->depth,
aux_usage);
iris_emit_buffer_barrier_for(batch, z_res->bo, IRIS_DOMAIN_DEPTH_WRITE);
iris_blorp_surf_for_resource(&batch->screen->isl_dev,
&z_surf, &z_res->base, z_res->aux.usage,
level, true);
iris_blorp_surf_for_resource(&batch->screen->isl_dev, &z_surf,
&z_res->base, aux_usage, level, true);
}
uint8_t stencil_mask = clear_stencil && stencil_res ? 0xff : 0;
@ -611,8 +614,8 @@ clear_depth_stencil(struct iris_context *ice,
"cache history: post slow ZS clear");
if (clear_depth && z_res) {
iris_resource_finish_depth(ice, z_res, level,
box->z, box->depth, true);
iris_resource_finish_render(ice, z_res, level, box->z, box->depth,
z_surf.aux_usage);
}
if (stencil_mask) {