From 72a1e1f33f6ebd97291eb9f4437db3b60bcd5d05 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 23 Sep 2022 16:35:31 -0400 Subject: [PATCH] agx: Emit trap at pack-time, not during isel This makes the shaderdb stats make more sense. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 4 ---- src/asahi/compiler/agx_pack.c | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index f9c2e854e3c..3196524a681 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -1836,10 +1836,6 @@ agx_compile_shader_nir(nir_shader *nir, agx_builder _b = agx_init_builder(ctx, agx_after_block(last_block)); agx_stop(&_b); - /* Also add traps to match the blob, unsure what the function is */ - for (unsigned i = 0; i < 8; ++i) - agx_trap(&_b); - /* Index blocks now that we're done emitting so the order is consistent */ agx_foreach_block(ctx, block) block->index = ctx->num_blocks++; diff --git a/src/asahi/compiler/agx_pack.c b/src/asahi/compiler/agx_pack.c index 3e304b4b5e2..f22206ef536 100644 --- a/src/asahi/compiler/agx_pack.c +++ b/src/asahi/compiler/agx_pack.c @@ -701,5 +701,11 @@ agx_pack_binary(agx_context *ctx, struct util_dynarray *emission) util_dynarray_foreach(&fixups, struct agx_branch_fixup, fixup) agx_fixup_branch(emission, *fixup); + /* Dougall calls the instruction in this footer "trap". Match the blob. */ + for (unsigned i = 0; i < 8; ++i) { + uint16_t trap = agx_opcodes_info[AGX_OPCODE_TRAP].encoding.exact; + util_dynarray_append(emission, uint16_t, trap); + } + util_dynarray_fini(&fixups); }