From 5292fef80de65d466cc9f461269d85ee50643dfc Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 19 May 2025 16:41:50 +0200 Subject: [PATCH] pan/afbc: Add helpers to query AFBC header alignment requirements Will be used in pan_layout.c to validate the WSI info. Signed-off-by: Boris Brezillon Tested-by: Eric R. Smith Reviewed-by: Eric R. Smith Reviewed-by: Mary Guillemard Part-of: --- src/panfrost/lib/pan_afbc.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/panfrost/lib/pan_afbc.h b/src/panfrost/lib/pan_afbc.h index 73b4593ed95..d406f592e8b 100644 --- a/src/panfrost/lib/pan_afbc.h +++ b/src/panfrost/lib/pan_afbc.h @@ -167,6 +167,28 @@ pan_afbc_subblock_size(uint64_t modifier) return (struct pan_image_block_size){4, 4}; } +static inline uint32_t +pan_afbc_header_row_stride_align(unsigned arch, enum pipe_format format, + uint64_t modifier) +{ + if (arch <= 7 || !(modifier & AFBC_FORMAT_MOD_TILED)) + return 16; + + if (util_format_get_blocksizebits(format) <= 32) + return 1024; + else + return 256; +} + +static inline uint32_t +pan_afbc_header_align(unsigned arch, uint64_t modifier) +{ + if (modifier & AFBC_FORMAT_MOD_TILED) + return 4096; + else + return 128; +} + /* * Determine the required alignment for the body offset of an AFBC image. For * now, this depends only on whether tiling is in use. These minimum alignments