From 997f85c136882569e56b433292feb09dcd4d33fb Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 19 Jul 2019 11:02:56 -0700 Subject: [PATCH] panfrost/midgard/disasm: Check for certain tag errors Midgard bundles contain a tag, as well as a copy of the tag of the next bundle to facilitate prefetch. Do some simple static analysis to detect certain tag errors (particularly on shaders without branching). Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/disassemble.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/panfrost/midgard/disassemble.c b/src/panfrost/midgard/disassemble.c index 50598c3958e..7fb5d202cc3 100644 --- a/src/panfrost/midgard/disassemble.c +++ b/src/panfrost/midgard/disassemble.c @@ -1266,12 +1266,30 @@ disassemble_midgard(uint8_t *code, size_t size) bool prefetch_flag = false; + int last_next_tag = -1; + unsigned i = 0; while (i < num_words) { unsigned tag = words[i] & 0xF; + unsigned next_tag = (words[i] >> 4) & 0xF; unsigned num_quad_words = midgard_word_size[tag]; + /* Check the tag */ + if (last_next_tag > 1) { + if (last_next_tag != tag) { + printf("/* TAG ERROR got "); + print_tag_short(tag); + printf(" expected "); + print_tag_short(last_next_tag); + printf(" */ "); + } + } else { + /* TODO: Check ALU case */ + } + + last_next_tag = next_tag; + switch (midgard_word_types[tag]) { case midgard_word_type_texture: print_texture_word(&words[i], tabs); -- 2.30.2