panfrost: Extract panfrost_afbc_is_wide helper
Rather than open-code the > 16 check in multiple places and have to justify it in each. This is easier to understand at the call sites. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15991>
This commit is contained in:
parent
e6f3abd5ec
commit
e4ee2c213a
|
@ -451,7 +451,7 @@ pan_prepare_rt(const struct pan_fb_info *fb, unsigned idx,
|
|||
cfg->afbc.row_stride = slice->afbc.row_stride /
|
||||
AFBC_HEADER_BYTES_PER_TILE;
|
||||
cfg->afbc.afbc_wide_block_enable =
|
||||
panfrost_afbc_superblock_width(rt->image->layout.modifier) > 16;
|
||||
panfrost_afbc_is_wide(rt->image->layout.modifier);
|
||||
#else
|
||||
cfg->afbc.chunk_size = 9;
|
||||
cfg->afbc.sparse = true;
|
||||
|
|
|
@ -89,6 +89,17 @@ panfrost_afbc_superblock_height(uint64_t modifier)
|
|||
return panfrost_afbc_superblock_size(modifier).height;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given an AFBC modifier, return if "wide blocks" are used. Wide blocks are
|
||||
* defined as superblocks wider than 16 pixels, the minimum (and default) super
|
||||
* block width.
|
||||
*/
|
||||
unsigned
|
||||
panfrost_afbc_is_wide(uint64_t modifier)
|
||||
{
|
||||
return panfrost_afbc_superblock_width(modifier) > 16;
|
||||
}
|
||||
|
||||
/* If not explicitly, line stride is calculated for block-based formats as
|
||||
* (ceil(width / block_width) * block_size). As a special case, this is left
|
||||
* zero if there is only a single block vertically. So, we have a helper to
|
||||
|
|
|
@ -81,8 +81,7 @@ panfrost_compression_tag(const struct util_format_description *desc,
|
|||
/* Prefetch enable */
|
||||
flags |= MALI_AFBC_SURFACE_FLAG_PREFETCH;
|
||||
|
||||
/* Wide blocks (> 16x16) */
|
||||
if (panfrost_afbc_superblock_width(modifier) > 16)
|
||||
if (panfrost_afbc_is_wide(modifier))
|
||||
flags |= MALI_AFBC_SURFACE_FLAG_WIDE_BLOCK;
|
||||
|
||||
/* Used to make sure AFBC headers don't point outside the AFBC
|
||||
|
|
|
@ -177,6 +177,8 @@ unsigned panfrost_afbc_superblock_width(uint64_t modifier);
|
|||
|
||||
unsigned panfrost_afbc_superblock_height(uint64_t modifier);
|
||||
|
||||
unsigned panfrost_afbc_is_wide(uint64_t modifier);
|
||||
|
||||
#ifdef PAN_ARCH
|
||||
unsigned
|
||||
GENX(panfrost_estimate_texture_payload_size)(const struct pan_image_view *iview);
|
||||
|
|
Loading…
Reference in New Issue