mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 22:20:14 +01:00
panfrost: add color-attachment and msaa helpers
In order to enable higher MSAA modes, we're going to have to perform some calculations on how to budget the (sometimes) limited tile-buffer space. Due to limited tilebuffer space, we need to prioritize a bit here. First, we reserve space for 4x MSAA for all formats. Then we try to fit 8 color attachments into the tile-buffer. And then finally, we calculate how many extra multi-sample buffers we can fit into the rest. The reason we reserve 4x MSAA first, is that this is required by all Vulkan versions. It also prevents us from regressing existing features. Then we try to pick 8 color attachments next, because that's required by Vulkan 1.4 as well as Vulkan Roadmap 2024 and D3D12. Vulkan Roadmap 2022 requires 7 as well. This adds helpers that implements this, which can be used by both the Gallium and the Vulkan driver. It's really benefitial if both of these drivers prioritize the same way here. 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:
parent
20acee81ac
commit
329568b5eb
1 changed files with 47 additions and 0 deletions
|
|
@ -30,6 +30,8 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "util/macros.h"
|
||||||
|
|
||||||
struct pan_kmod_dev;
|
struct pan_kmod_dev;
|
||||||
struct pan_kmod_dev_props;
|
struct pan_kmod_dev_props;
|
||||||
|
|
||||||
|
|
@ -142,4 +144,49 @@ panfrost_max_effective_tile_size(unsigned arch)
|
||||||
return 16 * 16;
|
return 16 * 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Returns the maximum usable color tilebuffer-size. This is *usually* twice
|
||||||
|
* the optimal tilebuffer-size, but not always.
|
||||||
|
*/
|
||||||
|
static inline unsigned
|
||||||
|
pan_get_max_tib_size(unsigned arch, const struct panfrost_model *model)
|
||||||
|
{
|
||||||
|
unsigned tib_size = panfrost_query_optimal_tib_size(model);
|
||||||
|
|
||||||
|
/* On V5, as well as V6 and later, we can disable pipelining to gain some
|
||||||
|
* extra tib memory.
|
||||||
|
*/
|
||||||
|
if (arch > 4 && arch != 6)
|
||||||
|
return tib_size * 2;
|
||||||
|
|
||||||
|
return tib_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
pan_get_max_cbufs(unsigned arch, unsigned max_tib_size)
|
||||||
|
{
|
||||||
|
if (arch < 5)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
const unsigned min_msaa = 4; /* Vulkan *requires* at least 4x MSAA support */
|
||||||
|
const unsigned max_cbuf_format = 4 * 4; /* R32G32B32A32 */
|
||||||
|
const unsigned min_tile_size = 4 * 4;
|
||||||
|
|
||||||
|
unsigned max_cbufs =
|
||||||
|
max_tib_size / (min_msaa * max_cbuf_format * min_tile_size);
|
||||||
|
|
||||||
|
return MIN2(max_cbufs, 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline unsigned
|
||||||
|
pan_get_max_msaa(unsigned arch, unsigned max_tib_size, unsigned max_cbuf_atts,
|
||||||
|
unsigned format_size)
|
||||||
|
{
|
||||||
|
assert(max_cbuf_atts > 0);
|
||||||
|
assert(format_size > 0);
|
||||||
|
const unsigned min_tile_size = 4 * 4;
|
||||||
|
unsigned max_msaa = max_tib_size / (max_cbuf_atts * format_size *
|
||||||
|
min_tile_size);
|
||||||
|
return MIN2(max_msaa, arch >= 5 ? 16 : 8);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue