From: Alyssa Rosenzweig Date: Fri, 19 Jul 2019 18:02:56 +0000 (-0700) Subject: panfrost/midgard/disasm: Check for certain tag errors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=997f85c136882569e56b433292feb09dcd4d33fb;p=mesa.git 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 --- 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);