From 8822f5949c64ae96b711b86f644126cbec836e1f Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 18 Sep 2024 17:17:55 +0200 Subject: [PATCH] pan/desc: Add layer_offset field to pan_tiler_context::valhall Compared to Bifrost, Valhall slightly improved layered rendering in that you no longer need one IDVS job per layer. But they didn't quite unleash things, because tiler descriptors still have a limited amount of layers they can deal with, forcing us to emit more than one IDVS/tiler descriptor per draw call if the number of layer exceeds this limit. In order to specify where the starting point, a {layer_offset,internal_layer_index} field has been added, so we need to extend pan_tiler_context to pass this information and let the common logic adjust the framebuffer internal_layer_index accordingly. Signed-off-by: Boris Brezillon Reviewed-by: Lars-Ivar Hesselberg Simonsen Tested-by: Lars-Ivar Hesselberg Simonsen Part-of: --- src/panfrost/lib/pan_desc.c | 3 ++- src/panfrost/lib/pan_desc.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/panfrost/lib/pan_desc.c b/src/panfrost/lib/pan_desc.c index 3e18726f348..bac5186b171 100644 --- a/src/panfrost/lib/pan_desc.c +++ b/src/panfrost/lib/pan_desc.c @@ -823,7 +823,8 @@ GENX(pan_emit_fbd)(const struct pan_fb_info *fb, unsigned layer_idx, * layer_idx only takes 8-bits, we might use the extra 56-bits we have * in frame_argument to pass other information to the fragment shader at * some point. */ - cfg.internal_layer_index = layer_idx; + assert(layer_idx >= tiler_ctx->valhall.layer_offset); + cfg.internal_layer_index = layer_idx - tiler_ctx->valhall.layer_offset; cfg.frame_argument = layer_idx; #endif } diff --git a/src/panfrost/lib/pan_desc.h b/src/panfrost/lib/pan_desc.h index 895fce48889..175939b24e7 100644 --- a/src/panfrost/lib/pan_desc.h +++ b/src/panfrost/lib/pan_desc.h @@ -72,6 +72,11 @@ struct pan_tiler_context { union { struct { mali_ptr desc; + /* A tiler descriptor can only handle a limited amount of layers. + * If the number of layers is bigger than this, several tiler + * descriptors will be issued, each with a different layer_offset. + */ + uint8_t layer_offset; } valhall; struct { mali_ptr desc;