pan/afbc: Add the pan_afbc_{super,render}block_size_el() helpers

Those are just pan_afbc_{render,super}block_size_el() but with the
size returned in number of elements instead of pixels. This is only
relevant for YUV-formats whose block extent is bigger than one pixel.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Tested-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35555>
This commit is contained in:
Boris Brezillon
2025-06-16 13:33:22 +02:00
parent 8b93e8c33e
commit 4bf983fb26
+33
View File
@@ -127,6 +127,22 @@ pan_afbc_superblock_size(uint64_t modifier)
}
}
/* Same as pan_afbc_superblock_size_el() but counted in block elements
* instead of pixels. For anything non-YUV this is the same. */
static inline struct pan_image_block_size
pan_afbc_superblock_size_el(enum pipe_format format, uint64_t modifier)
{
struct pan_image_block_size sb_size_px = pan_afbc_superblock_size(modifier);
assert(sb_size_px.width % util_format_get_blockwidth(format) == 0);
assert(sb_size_px.height % util_format_get_blockheight(format) == 0);
return (struct pan_image_block_size){
.width = sb_size_px.width / util_format_get_blockwidth(format),
.height = sb_size_px.height / util_format_get_blockheight(format),
};
}
/*
* Given an AFBC modifier, return the render size.
*/
@@ -142,6 +158,23 @@ pan_afbc_renderblock_size(uint64_t modifier)
return blk_size;
}
/* Same as pan_afbc_renderblock_size() but counted in block elements
* instead of pixels. For anything non-YUV this is the same. */
static inline struct pan_image_block_size
pan_afbc_renderblock_size_el(enum pipe_format format, uint64_t modifier)
{
struct pan_image_block_size rb_size_px = pan_afbc_renderblock_size(modifier);
assert(rb_size_px.width % util_format_get_blockwidth(format) == 0);
assert(rb_size_px.height % util_format_get_blockheight(format) == 0);
return (struct pan_image_block_size){
.width = rb_size_px.width / util_format_get_blockwidth(format),
.height = rb_size_px.height / util_format_get_blockheight(format),
};
}
/*
* Given an AFBC modifier, return the width of the superblock.
*/