From 6d6dd44f82c22a51424a916a516ef292b17bc27f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 22 May 2022 22:41:14 -0400 Subject: [PATCH] asahi: Allow large uniform records Now that we've fixed the binding XML, it's obvious how to bind lots of uniforms in a single record. This is simpler and more efficient. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 118404ecbf1..78003c62799 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1086,30 +1086,16 @@ agx_build_pipeline(struct agx_context *ctx, struct agx_compiled_shader *cs, enum uint8_t *record = ptr.cpu; - /* There is a maximum number of half words we may push with a single - * BIND_UNIFORM record, so split up the range to fit. We only need to call - * agx_push_location once, however, which reduces the cost. */ - unsigned unif_records = 0; - for (unsigned i = 0; i < cs->info.push_ranges; ++i) { struct agx_push push = cs->info.push[i]; - uint64_t buffer = agx_push_location(ctx, push, stage); - unsigned halfs_per_record = 14; - unsigned records = DIV_ROUND_UP(push.length, halfs_per_record); - /* Ensure we don't overflow */ - unif_records += records; - assert(unif_records < 16); - - for (unsigned j = 0; j < records; ++j) { - agx_pack(record, BIND_UNIFORM, cfg) { - cfg.start_halfs = push.base + (j * halfs_per_record); - cfg.size_halfs = MIN2(push.length - (j * halfs_per_record), halfs_per_record); - cfg.buffer = buffer + (j * halfs_per_record * 2); - } - - record += AGX_BIND_UNIFORM_LENGTH; + agx_pack(record, BIND_UNIFORM, cfg) { + cfg.start_halfs = push.base; + cfg.size_halfs = push.length; + cfg.buffer = agx_push_location(ctx, push, stage); } + + record += AGX_BIND_UNIFORM_LENGTH; } for (unsigned i = 0; i < ctx->stage[stage].texture_count; ++i) {