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 <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-07-19 11:02:56 -07:00
parent d168b08d62
commit 997f85c136
1 changed files with 18 additions and 0 deletions

View File

@ -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);