summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIcecream95 <ixn@disroot.org>2021-07-31 12:27:43 +1200
committerMarge Bot <eric+marge@anholt.net>2021-08-01 13:04:20 +0000
commit1acc3394c434891233cb67fd587f6cbbf2677514 (patch)
treeb584d54bc99288b42921453bc4f2ded42d55107e
parent8574ca4491815647e69ff529d8c81391080de4c1 (diff)
pan/bi: Use padding bytes for checking whether to stop disassembly
Both Panfrost and the DDK add padding zero bytes to the end of shaders, so we can use this instead of the end-of-shader clause for checking whether to stop disassembling. Shaders can have end-of-shader clauses partway through; these shaders will now be completely disassembled instead of cut off at the first end-of-shader clause. A tag byte of zero is an invalid encoding, so unlike the previous version of this test only check the first word. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12153>
-rw-r--r--src/panfrost/bifrost/disassemble.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c
index 392974e7567..3fb9c8286da 100644
--- a/src/panfrost/bifrost/disassemble.c
+++ b/src/panfrost/bifrost/disassemble.c
@@ -439,7 +439,7 @@ decode_M(enum bi_constmod *mod, unsigned M1, unsigned M2, bool single)
}
}
-static bool dump_clause(FILE *fp, uint32_t *words, unsigned *size, unsigned offset, bool verbose)
+static void dump_clause(FILE *fp, uint32_t *words, unsigned *size, unsigned offset, bool verbose)
{
// State for a decoded clause
struct bifrost_alu_inst instrs[8] = {};
@@ -447,7 +447,6 @@ static bool dump_clause(FILE *fp, uint32_t *words, unsigned *size, unsigned offs
unsigned num_instrs = 0;
unsigned num_consts = 0;
uint64_t header_bits = 0;
- bool stopbit = false;
unsigned i;
for (i = 0; ; i++, words += 4) {
@@ -648,8 +647,6 @@ static bool dump_clause(FILE *fp, uint32_t *words, unsigned *size, unsigned offs
struct bifrost_header header;
memcpy((char *) &header, (char *) &header_bits, sizeof(struct bifrost_header));
dump_header(fp, header, verbose);
- if (header.flow_control == BIFROST_FLOW_END)
- stopbit = true;
fprintf(fp, "{\n");
for (i = 0; i < num_instrs; i++) {
@@ -687,7 +684,7 @@ static bool dump_clause(FILE *fp, uint32_t *words, unsigned *size, unsigned offs
}
fprintf(fp, "\n");
- return stopbit;
+ return;
}
void disassemble_bifrost(FILE *fp, uint8_t *code, size_t size, bool verbose)
@@ -697,11 +694,15 @@ void disassemble_bifrost(FILE *fp, uint8_t *code, size_t size, bool verbose)
// used for displaying branch targets
unsigned offset = 0;
while (words != words_end) {
+ /* Shaders have zero bytes at the end for padding; stop
+ * disassembling when we hit them. */
+ if (*words == 0)
+ break;
+
fprintf(fp, "clause_%d:\n", offset);
- unsigned size;
- if (dump_clause(fp, words, &size, offset, verbose))
- break;
+ unsigned size;
+ dump_clause(fp, words, &size, offset, verbose);
words += size * 4;
offset += size;