panfrost: allocate tile-buffer for dummy render-targets

There's two limitations we have to cater to:

1. The HW needs at least one render-target. We can disable write-back for
   it, but it needs to allocate tile-buffer space for it.
2. The HW can't have "holes" in the render-targets.

In both of those cases, we already set up dummy RGBA8 UNORM as the format,
and disable write-back. But we forgot to take this into account when
calculating the tile buffer allocation.

This makes what we program the HW to do consistent, meaning we don't end
up smashing the tile-buffer space. We might be able to do something
better by adjusting how we program these buffers, but let's leave that
for later.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33925>
This commit is contained in:
Erik Faye-Lund 2025-03-27 09:10:16 +01:00 committed by Marge Bot
parent af87aa5ee4
commit 9ec6197a0b

View file

@ -354,15 +354,23 @@ pan_bytes_per_pixel_tib(enum pipe_format format)
static unsigned static unsigned
pan_cbuf_bytes_per_pixel(const struct pan_fb_info *fb) pan_cbuf_bytes_per_pixel(const struct pan_fb_info *fb)
{ {
/* dummy/non-existent render-targets use RGBA8 UNORM, e.g 4 bytes */
const unsigned dummy_rt_size = 4 * fb->nr_samples;
unsigned sum = 0; unsigned sum = 0;
if (!fb->rt_count) {
/* The HW needs at least one render-target */
return dummy_rt_size;
}
for (int cb = 0; cb < fb->rt_count; ++cb) { for (int cb = 0; cb < fb->rt_count; ++cb) {
unsigned rt_size = dummy_rt_size;
const struct pan_image_view *rt = fb->rts[cb].view; const struct pan_image_view *rt = fb->rts[cb].view;
if (rt)
rt_size = pan_bytes_per_pixel_tib(rt->format) * rt->nr_samples;
if (!rt) sum += rt_size;
continue;
sum += pan_bytes_per_pixel_tib(rt->format) * rt->nr_samples;
} }
return sum; return sum;