panfrost: factor out meat of pan_bytes_per_pixel_tib to helper

We're going to have to do this from non arch-specific code, so let's
factor the meat out into a helper so we don't need to repeat the logic.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38968>
This commit is contained in:
Erik Faye-Lund
2025-12-16 12:03:40 +01:00
committed by Marge Bot
parent 762fe6e9dc
commit 5330d09931
2 changed files with 16 additions and 11 deletions

View File

@@ -455,17 +455,7 @@ pan_bytes_per_pixel_tib(enum pipe_format format)
{
const struct pan_blendable_format *bf =
GENX(pan_blendable_format_from_pipe_format)(format);
if (bf->internal) {
/* Blendable formats are always 32-bits in the tile buffer,
* extra bits are used as padding or to dither */
return 4;
} else {
/* Non-blendable formats are raw, rounded up to the nearest
* power-of-two size */
unsigned bytes = util_format_get_blocksize(format);
return util_next_power_of_two(bytes);
}
return pan_format_tib_size(format, bf->internal);
}
static unsigned

View File

@@ -129,6 +129,21 @@ pan_format_get_plane_blocksize(enum pipe_format format, unsigned plane_idx)
}
}
static inline unsigned
pan_format_tib_size(enum pipe_format format, bool internal)
{
if (internal) {
/* Blendable formats are always 32-bits in the tile buffer,
* extra bits are used as padding or to dither */
return 4;
} else {
/* Non-blendable formats are raw, rounded up to the nearest
* power-of-two size */
unsigned bytes = util_format_get_blocksize(format);
return util_next_power_of_two(bytes);
}
}
typedef uint32_t mali_pixel_format;
/* pan bind flags */