iris: Fix the depth aspect aux usage in iris_blit

Set dst_aux_usage to ISL_AUX_USAGE_NONE for the depth buffer blit if the
level doesn't fully support HiZ. Enables removing the code that masked
this issue later on.

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-17 14:41:19 -08:00 committed by Marge Bot
parent 767fd868a0
commit 0e03fe19e5
4 changed files with 23 additions and 24 deletions

View File

@ -320,20 +320,6 @@ tex_cache_flush_hack(struct iris_batch *batch,
PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE);
}
static enum isl_aux_usage
iris_resource_blorp_write_aux_usage(struct iris_context *ice,
struct iris_resource *res,
enum isl_format render_format)
{
if (res->surf.usage & (ISL_SURF_USAGE_DEPTH_BIT |
ISL_SURF_USAGE_STENCIL_BIT)) {
assert(render_format == res->surf.format);
return res->aux.usage;
} else {
return iris_resource_render_aux_usage(ice, res, render_format, false);
}
}
static struct iris_resource *
iris_resource_for_aspect(struct pipe_resource *p_res, unsigned pipe_mask)
{
@ -501,8 +487,8 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
iris_format_for_usage(devinfo, dst_pfmt,
ISL_SURF_USAGE_RENDER_TARGET_BIT);
enum isl_aux_usage dst_aux_usage =
iris_resource_blorp_write_aux_usage(ice, dst_res, dst_fmt.fmt);
bool dst_clear_supported = isl_aux_usage_has_fast_clears(dst_aux_usage);
iris_resource_render_aux_usage(ice, dst_res, info->dst.level,
dst_fmt.fmt, false);
struct blorp_surf src_surf, dst_surf;
iris_blorp_surf_for_resource(&screen->isl_dev, &src_surf,
@ -512,9 +498,9 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
&dst_res->base, dst_aux_usage,
info->dst.level, true);
iris_resource_prepare_access(ice, dst_res, info->dst.level, 1,
iris_resource_prepare_render(ice, dst_res, info->dst.level,
info->dst.box.z, info->dst.box.depth,
dst_aux_usage, dst_clear_supported);
dst_aux_usage);
iris_emit_buffer_barrier_for(batch, dst_res->bo,
IRIS_DOMAIN_RENDER_WRITE);
@ -548,9 +534,9 @@ iris_blit(struct pipe_context *ctx, const struct pipe_blit_info *info)
tex_cache_flush_hack(batch, src_fmt.fmt, src_res->surf.format);
iris_resource_finish_write(ice, dst_res, info->dst.level,
info->dst.box.z, info->dst.box.depth,
dst_aux_usage);
iris_resource_finish_render(ice, dst_res, info->dst.level,
info->dst.box.z, info->dst.box.depth,
dst_aux_usage);
}
blorp_batch_finish(&blorp_batch);

View File

@ -368,7 +368,7 @@ clear_color(struct iris_context *ice,
bool color_write_disable[4] = { false, false, false, false };
enum isl_aux_usage aux_usage =
iris_resource_render_aux_usage(ice, res, format, false);
iris_resource_render_aux_usage(ice, res, level, format, false);
iris_resource_prepare_render(ice, res, level, box->z, box->depth,
aux_usage);

View File

@ -239,7 +239,8 @@ iris_predraw_resolve_framebuffer(struct iris_context *ice,
struct iris_resource *res = (void *) surf->base.texture;
enum isl_aux_usage aux_usage =
iris_resource_render_aux_usage(ice, res, surf->view.format,
iris_resource_render_aux_usage(ice, res, surf->view.base_level,
surf->view.format,
draw_aux_buffer_disabled[i]);
if (ice->state.draw_aux_usage[i] != aux_usage) {
@ -962,7 +963,7 @@ iris_render_formats_color_compatible(enum isl_format a, enum isl_format b,
enum isl_aux_usage
iris_resource_render_aux_usage(struct iris_context *ice,
struct iris_resource *res,
struct iris_resource *res, uint32_t level,
enum isl_format render_format,
bool draw_aux_disabled)
{
@ -973,6 +974,17 @@ iris_resource_render_aux_usage(struct iris_context *ice,
return ISL_AUX_USAGE_NONE;
switch (res->aux.usage) {
case ISL_AUX_USAGE_HIZ:
case ISL_AUX_USAGE_HIZ_CCS:
case ISL_AUX_USAGE_HIZ_CCS_WT:
assert(render_format == res->surf.format);
return iris_resource_level_has_hiz(res, level) ?
res->aux.usage : ISL_AUX_USAGE_NONE;
case ISL_AUX_USAGE_STC_CCS:
assert(render_format == res->surf.format);
return res->aux.usage;
case ISL_AUX_USAGE_MCS:
case ISL_AUX_USAGE_MCS_CCS:
return res->aux.usage;

View File

@ -502,6 +502,7 @@ bool iris_render_formats_color_compatible(enum isl_format a,
union isl_color_value color);
enum isl_aux_usage iris_resource_render_aux_usage(struct iris_context *ice,
struct iris_resource *res,
uint32_t level,
enum isl_format render_fmt,
bool draw_aux_disabled);
void iris_resource_prepare_render(struct iris_context *ice,