diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index d0f67c495e5..e0f451c3f9e 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -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; diff --git a/src/panfrost/lib/pan_layout.c b/src/panfrost/lib/pan_layout.c index a5ccdf7692b..685783c1e57 100644 --- a/src/panfrost/lib/pan_layout.c +++ b/src/panfrost/lib/pan_layout.c @@ -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 diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c index 0ef88f11d59..9001389d5db 100644 --- a/src/panfrost/lib/pan_texture.c +++ b/src/panfrost/lib/pan_texture.c @@ -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 diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h index 607b8a2724b..1e030319ae9 100644 --- a/src/panfrost/lib/pan_texture.h +++ b/src/panfrost/lib/pan_texture.h @@ -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);