This still may not be perfect (in the sense that legal shaders might
still get cut off) but this fits how writeout is done with both Panfrost
and the blob, so it's good enough for what we need and allows MRT
shaders to be sanely disassembled.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
print_compact_branch_writeout_field(uint16_t word)
{
midgard_jmp_writeout_op op = word & 0x7;
print_compact_branch_writeout_field(uint16_t word)
{
midgard_jmp_writeout_op op = word & 0x7;
+ midg_stats.instruction_count++;
switch (op) {
case midgard_jmp_writeout_op_branch_uncond: {
switch (op) {
case midgard_jmp_writeout_op_branch_uncond: {
print_tag_short(br_uncond.dest_tag);
printf("\n");
print_tag_short(br_uncond.dest_tag);
printf("\n");
+ return br_uncond.offset >= 0;
}
case midgard_jmp_writeout_op_branch_cond:
}
case midgard_jmp_writeout_op_branch_cond:
print_tag_short(br_cond.dest_tag);
printf("\n");
print_tag_short(br_cond.dest_tag);
printf("\n");
+ return br_cond.offset >= 0;
- midg_stats.instruction_count++;
print_extended_branch_writeout_field(uint8_t *words, unsigned next)
{
midgard_branch_extended br;
print_extended_branch_writeout_field(uint8_t *words, unsigned next)
{
midgard_branch_extended br;
midg_tags[I] = br.dest_tag;
midg_stats.instruction_count++;
midg_tags[I] = br.dest_tag;
midg_stats.instruction_count++;
print_alu_word(uint32_t *words, unsigned num_quad_words,
unsigned tabs, unsigned next)
{
print_alu_word(uint32_t *words, unsigned num_quad_words,
unsigned tabs, unsigned next)
{
unsigned num_fields = num_alu_fields_enabled(control_word);
uint16_t *word_ptr = beginning_ptr + num_fields;
unsigned num_words = 2 + num_fields;
unsigned num_fields = num_alu_fields_enabled(control_word);
uint16_t *word_ptr = beginning_ptr + num_fields;
unsigned num_words = 2 + num_fields;
+ bool branch_forward = false;
if ((control_word >> 16) & 1)
printf("unknown bit 16 enabled\n");
if ((control_word >> 16) & 1)
printf("unknown bit 16 enabled\n");
}
if ((control_word >> 26) & 1) {
}
if ((control_word >> 26) & 1) {
- print_compact_branch_writeout_field(*word_ptr);
+ branch_forward |= print_compact_branch_writeout_field(*word_ptr);
word_ptr += 1;
num_words += 1;
}
if ((control_word >> 27) & 1) {
word_ptr += 1;
num_words += 1;
}
if ((control_word >> 27) & 1) {
- print_extended_branch_writeout_field((uint8_t *) word_ptr, next);
+ branch_forward |= print_extended_branch_writeout_field((uint8_t *) word_ptr, next);
word_ptr += 3;
num_words += 3;
}
word_ptr += 3;
num_words += 3;
}
+
+ return branch_forward;
uint32_t *words = (uint32_t *) code;
unsigned num_words = size / 4;
int tabs = 0;
uint32_t *words = (uint32_t *) code;
unsigned num_words = size / 4;
int tabs = 0;
- num_words = MIN2(num_words, 100);
- bool prefetch_flag = false;
+ bool branch_forward = false;
break;
case midgard_word_type_alu:
break;
case midgard_word_type_alu:
- print_alu_word(&words[i], num_quad_words, tabs, i + 4*num_quad_words);
+ branch_forward = print_alu_word(&words[i], num_quad_words, tabs, i + 4*num_quad_words);
/* Reset word static analysis state */
is_embedded_constant_half = false;
/* Reset word static analysis state */
is_embedded_constant_half = false;
midg_stats.bundle_count++;
midg_stats.quadword_count += num_quad_words;
midg_stats.bundle_count++;
midg_stats.quadword_count += num_quad_words;
- if (prefetch_flag && midgard_word_types[tag] == midgard_word_type_alu)
- break;
-
printf("\n");
unsigned next = (words[i] & 0xF0) >> 4;
printf("\n");
unsigned next = (words[i] & 0xF0) >> 4;
- /* Break based on instruction prefetch flag */
-
-#if 0
- if (i < num_words && next == 1) {
- prefetch_flag = true;
-
- if (midgard_word_types[words[i] & 0xF] != midgard_word_type_alu)
- break;
- }
-#endif
+ if (i < num_words && next == 1 && !branch_forward)
+ break;
i += 4 * num_quad_words;
}
i += 4 * num_quad_words;
}