From e9b2f02c2facc70a3e59b85a176d3fa0f4751a2f Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Wed, 5 Jul 2023 20:25:01 +0900 Subject: [PATCH] asahi: Add smalltile debug option This lets us force small tiles when they otherwise would not be necessary, which is useful for decoupling tile size and the logic that depends on it from things like MSAA and MRT which can trigger small tiles. Signed-off-by: Asahi Lina Part-of: --- src/asahi/lib/agx_device.h | 1 + src/gallium/drivers/asahi/agx_pipe.c | 1 + src/gallium/drivers/asahi/agx_state.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/src/asahi/lib/agx_device.h b/src/asahi/lib/agx_device.h index 5465f48..dc11926 100644 --- a/src/asahi/lib/agx_device.h +++ b/src/asahi/lib/agx_device.h @@ -27,6 +27,7 @@ enum agx_dbg { AGX_DBG_BATCH = BITFIELD_BIT(11), AGX_DBG_NOWC = BITFIELD_BIT(12), AGX_DBG_SYNCTVB = BITFIELD_BIT(13), + AGX_DBG_SMALLTILE = BITFIELD_BIT(14), }; /* Dummy partial declarations, pending real UAPI */ diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index eceaf89..80c0fbe 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -65,6 +65,7 @@ static const struct debug_named_value agx_debug_options[] = { {"batch", AGX_DBG_BATCH, "Log batches"}, {"nowc", AGX_DBG_NOWC, "Disable write-combining"}, {"synctvb", AGX_DBG_SYNCTVB, "Synchronous TVB growth"}, + {"smalltile", AGX_DBG_SMALLTILE,"Force 16x16 tiles"}, DEBUG_NAMED_VALUE_END }; /* clang-format on */ diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 0e14769..fe8e075 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1422,6 +1422,9 @@ agx_compile_variant(struct agx_device *dev, struct agx_uncompiled_shader *so, struct agx_tilebuffer_layout tib = agx_build_tilebuffer_layout( key->rt_formats, key->nr_cbufs, key->nr_samples); + if (dev->debug & AGX_DBG_SMALLTILE) + tib.tile_size = (struct agx_tile_size){16, 16}; + nir_lower_blend_options opts = { .scalar_blend_const = true, .logicop_enable = key->blend.logicop_enable, @@ -2250,6 +2253,9 @@ agx_batch_init_state(struct agx_batch *batch) formats, batch->key.nr_cbufs, util_framebuffer_get_num_samples(&batch->key)); + if (agx_device(batch->ctx->base.screen)->debug & AGX_DBG_SMALLTILE) + batch->tilebuffer_layout.tile_size = (struct agx_tile_size){16, 16}; + if (batch->key.zsbuf) { struct agx_resource *rsrc = agx_resource(batch->key.zsbuf->texture); agx_batch_writes(batch, rsrc); -- 2.7.4