panfrost: Add a helper to expose the maximum effective tile size

On all previous GPUs, the effective tile size was limited to 16x16, but
it got increased on v10. Add an helper to query this maximum effective
tile size.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31948>
This commit is contained in:
Boris Brezillon 2023-10-26 20:54:52 +02:00 committed by Louis-Francis Ratté-Boulianne
parent a3c8258908
commit 303acdef07
4 changed files with 23 additions and 6 deletions

View file

@ -650,6 +650,10 @@ csf_emit_tiler_desc(struct panfrost_batch *batch, const struct pan_fb_info *fb)
if (MAX2(batch->key.width, batch->key.height) >= 4096)
tiler.hierarchy_mask &= ~1;
/* For effective tile size larger than 16x16, disable first level */
if (fb->tile_size > 16 * 16)
tiler.hierarchy_mask &= ~1;
tiler.fb_width = batch->key.width;
tiler.fb_height = batch->key.height;
tiler.heap = batch->ctx->csf.heap.desc_bo->ptr.gpu;

View file

@ -31,6 +31,7 @@
#include "pan_desc.h"
#include "pan_encoder.h"
#include "pan_props.h"
#include "pan_texture.h"
static unsigned
@ -93,10 +94,8 @@ GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
* CRCs are more expensive at smaller tile sizes, reducing the benefit.
* Restricting CRC to 16x16 should work in practice.
*/
if (tile_size != 16 * 16) {
assert(tile_size < 16 * 16);
if (tile_size < 16 * 16)
return -1;
}
#if PAN_ARCH <= 6
if (fb->rt_count == 1 && fb->rts[0].view && !fb->rts[0].discard &&
@ -371,7 +370,8 @@ GENX(pan_select_tile_size)(struct pan_fb_info *fb)
fb->tile_size = fb->tile_buf_budget >> util_logbase2_ceil(bytes_per_pixel);
/* Clamp tile size to hardware limits */
fb->tile_size = MIN2(fb->tile_size, 16 * 16);
fb->tile_size =
MIN2(fb->tile_size, panfrost_max_effective_tile_size(PAN_ARCH));
assert(fb->tile_size >= 4 * 4);
/* Colour buffer allocations must be 1K aligned. */
@ -695,7 +695,7 @@ pan_force_clean_write_rt(const struct pan_image_view *rt, unsigned tile_size)
unsigned superblock = panfrost_afbc_superblock_width(image->layout.modifier);
assert(superblock >= 16);
assert(tile_size <= 16 * 16);
assert(tile_size <= panfrost_max_effective_tile_size(PAN_ARCH));
/* Tile size and superblock differ unless they are both 16x16 */
return !(superblock == 16 && tile_size == 16 * 16);
@ -705,7 +705,7 @@ static bool
pan_force_clean_write(const struct pan_fb_info *fb, unsigned tile_size)
{
/* Maximum tile size */
assert(tile_size <= 16 * 16);
assert(tile_size <= panfrost_max_effective_tile_size(PAN_ARCH));
for (unsigned i = 0; i < fb->rt_count; ++i) {
if (fb->rts[i].view && !fb->rts[i].discard &&

View file

@ -128,4 +128,13 @@ pan_arch(unsigned gpu_id)
}
}
static inline unsigned
panfrost_max_effective_tile_size(unsigned arch)
{
if (arch >= 10)
return 32 * 32;
return 16 * 16;
}
#endif

View file

@ -186,6 +186,10 @@ panvk_select_tiler_hierarchy_mask(const struct panvk_physical_device *phys_dev,
if (last_hierarchy_bit > tiler_features.max_levels)
hierarchy_mask <<= last_hierarchy_bit - tiler_features.max_levels;
/* For effective tile size larger than 16x16, disable first level */
if (state->render.fb.info.tile_size > 16 * 16)
hierarchy_mask &= ~1;
return hierarchy_mask;
}