From 23a32b948bd0b6dd8954c07eca125849a5dac06a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 28 May 2025 15:48:13 +0200 Subject: [PATCH] upanfrost: make 128-bit opt-in with driconf on v4 On v4, we can't lower the tile-size to get enough per-pixel space for both 4xMSAA *and* 128-bit formats at the same time. And because GLES 2 doesn't support per-format queries, this means that we'd effectively not support MSAA at all. We can avoid this issue by dropping support for the 128-bit formats on V4, unless explicitly requested by a driconf. Reviewed-by: Lars-Ivar Hesselberg Simonsen Part-of: --- src/gallium/drivers/panfrost/driinfo_panfrost.h | 1 + src/gallium/drivers/panfrost/pan_screen.c | 8 ++++++++ src/gallium/drivers/panfrost/pan_screen.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/gallium/drivers/panfrost/driinfo_panfrost.h b/src/gallium/drivers/panfrost/driinfo_panfrost.h index 0d7c32b8aac..c6147d3da4b 100644 --- a/src/gallium/drivers/panfrost/driinfo_panfrost.h +++ b/src/gallium/drivers/panfrost/driinfo_panfrost.h @@ -14,4 +14,5 @@ DRI_CONF_SECTION_END DRI_CONF_SECTION_MISCELLANEOUS DRI_CONF_PAN_COMPUTE_CORE_MASK(~0ull) DRI_CONF_PAN_FRAGMENT_CORE_MASK(~0ull) + DRI_CONF_OPT_B(pan_allow_128bit_rts_v4, false, "Allow using 128 bit render-targets on V4") DRI_CONF_SECTION_END diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index b5ea7805716..ebee5e9ccce 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -207,6 +207,11 @@ panfrost_is_format_supported(struct pipe_screen *screen, if (format == PIPE_FORMAT_Z16_UNORM && dev->arch <= 4) return false; + if (dev->arch <= 4 && util_format_get_blocksize(format) >= 16 && + !pan_screen(screen)->allow_128bit_rts_v4 && + (bind & PIPE_BIND_RENDER_TARGET)) + return false; + /* Check we support the format with the given bind */ unsigned pan_bind_flags = pipe_to_pan_bind_flags(bind); @@ -1023,6 +1028,9 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config, return NULL; } + screen->allow_128bit_rts_v4 = + driQueryOptionb(config->options, "pan_allow_128bit_rts_v4"); + screen->csf_tiler_heap.chunk_size = driQueryOptioni(config->options, "pan_csf_chunk_size"); screen->csf_tiler_heap.initial_chunks = driQueryOptioni(config->options, diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h index 11e6f63cfdb..ebad8a6ce35 100644 --- a/src/gallium/drivers/panfrost/pan_screen.h +++ b/src/gallium/drivers/panfrost/pan_screen.h @@ -125,6 +125,7 @@ struct panfrost_screen { struct disk_cache *disk_cache; unsigned max_afbc_packing_ratio; bool force_afbc_packing; + bool allow_128bit_rts_v4; int force_afrc_rate; uint64_t compute_core_mask; uint64_t fragment_core_mask;