iris: Drop iris_resource::aux::has_hiz

Instead of storing a bitfield of which resource levels will be accessed
with HiZ, compute this information on-demand. Makes the iris_resource
struct more generic.

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:36:29 -08:00 committed by Marge Bot
parent cfa38e5a99
commit 9bd092736c
4 changed files with 17 additions and 21 deletions

View File

@ -435,7 +435,7 @@ can_fast_clear_depth(struct iris_context *ice,
return false;
}
if (!(res->aux.has_hiz & (1 << level)))
if (!iris_resource_level_has_hiz(res, level))
return false;
if (!blorp_can_hiz_clear_depth(devinfo, &res->surf, res->aux.usage,

View File

@ -590,7 +590,22 @@ bool
iris_resource_level_has_hiz(const struct iris_resource *res, uint32_t level)
{
iris_resource_check_level_layer(res, level, 0);
return res->aux.has_hiz & 1 << level;
if (!isl_aux_usage_has_hiz(res->aux.usage))
return false;
/* Disable HiZ for LOD > 0 unless the width/height are 8x4 aligned.
* For LOD == 0, we can grow the dimensions to make it work.
*/
if (level > 0) {
if (u_minify(res->base.width0, level) & 7)
return false;
if (u_minify(res->base.height0, level) & 3)
return false;
}
return true;
}
/** \brief Assert that the level and layer are valid for the resource. */

View File

@ -385,7 +385,6 @@ iris_resource_disable_aux(struct iris_resource *res)
res->aux.usage = ISL_AUX_USAGE_NONE;
res->aux.possible_usages = 1 << ISL_AUX_USAGE_NONE;
res->aux.sampler_usages = 1 << ISL_AUX_USAGE_NONE;
res->aux.has_hiz = 0;
res->aux.surf.size_B = 0;
res->aux.bo = NULL;
res->aux.extra_aux.surf.size_B = 0;
@ -760,19 +759,6 @@ iris_resource_configure_aux(struct iris_screen *screen,
if (!res->aux.state)
return false;
if (isl_aux_usage_has_hiz(res->aux.usage)) {
for (unsigned level = 0; level < res->surf.levels; ++level) {
uint32_t width = u_minify(res->surf.phys_level0_sa.width, level);
uint32_t height = u_minify(res->surf.phys_level0_sa.height, level);
/* Disable HiZ for LOD > 0 unless the width/height are 8x4 aligned.
* For LOD == 0, we can grow the dimensions to make it work.
*/
if (level == 0 || ((width & 7) == 0 && (height & 3) == 0))
res->aux.has_hiz |= 1 << level;
}
}
return true;
}

View File

@ -152,11 +152,6 @@ struct iris_resource {
* aux state for each slice.
*/
enum isl_aux_state **state;
/**
* If (1 << level) is set, HiZ is enabled for that miplevel.
*/
uint16_t has_hiz;
} aux;
/**