panfrost: do not over-estimate format tib-size
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

While the MAX2 thing here is correct for some formats, it's not correct
for all; for instance R8_SNORM doesn't need 32-bits here.

This should enable some higersample-counts on some 8 and 16-bit formats
on some Mali GPUs.

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:12:47 +01:00 committed by Marge Bot
parent 5330d09931
commit c1bf22b56f
3 changed files with 7 additions and 9 deletions

View file

@ -145,7 +145,9 @@ get_max_msaa(struct panfrost_device *dev, enum pipe_format format)
{
unsigned max_tib_size = pan_query_tib_size(dev->model);
unsigned max_cbuf_atts = pan_get_max_cbufs(dev->arch, max_tib_size);
unsigned format_size = util_format_get_blocksize(format);
unsigned format_size =
pan_format_tib_size(format, dev->blendable_formats[format].internal);
unsigned max_msaa = pan_get_max_msaa(dev->arch, max_tib_size,
max_cbuf_atts, format_size);

View file

@ -144,13 +144,6 @@ pan_get_max_msaa(unsigned arch, unsigned max_tib_size, unsigned max_cbuf_atts,
assert(max_cbuf_atts > 0);
assert(format_size > 0);
/* When using an internal format with less than 32-bit per pixels, we're
* currently using either AU (Additional precision, Unorm) or PU (Padded
* precision, Unorm), meaning that we need additional bits in the tilebuffer
* that's used by dithering.
*/
format_size = MAX2(format_size, 4);
const unsigned min_tile_size = 4 * 4;
unsigned max_msaa = max_tib_size / (max_cbuf_atts * format_size *
min_tile_size);

View file

@ -834,7 +834,10 @@ get_image_format_sample_counts(struct panvk_physical_device *physical_device,
unsigned max_cbuf_atts = pan_get_max_cbufs(arch, max_tib_size);
assert(!vk_format_is_compressed(format));
unsigned format_size = vk_format_get_blocksize(format);
enum pipe_format pfmt = vk_format_to_pipe_format(format);
unsigned format_size =
pan_format_tib_size(pfmt, physical_device->formats.blendable[pfmt].internal);
return panvk_get_sample_counts(arch, max_tib_size, max_cbuf_atts,
format_size);