static bool is_instruction_int = false;
+/* Stats */
+
+static unsigned nr_ins = 0;
+
/* Prints a short form of the tag for branching, the minimum needed to be
* legible and unambiguous */
reg_info->src2_reg, override, is_int);
}
+ nr_ins++;
printf("\n");
}
} else
print_scalar_src(alu_field->src2, reg_info->src2_reg);
+ nr_ins++;
printf("\n");
}
break;
}
}
+
+ nr_ins++;
}
static void
printf("%d -> ", br.offset);
print_tag_short(br.dest_tag);
printf("\n");
+
+ nr_ins++;
}
static unsigned
printf(", ");
print_load_store_arg(word->arg_2, 1);
printf(" /* %X */\n", word->varying_parameters);
+
+ nr_ins++;
}
static void
printf("// unknownA = 0x%x\n", texture->unknownA);
printf("// unknown8 = 0x%x\n", texture->unknown8);
}
+
+ nr_ins++;
}
void
-disassemble_midgard(uint8_t *code, size_t size)
+disassemble_midgard(uint8_t *code, size_t size, bool stats, unsigned nr_registers)
{
uint32_t *words = (uint32_t *) code;
unsigned num_words = size / 4;
unsigned i = 0;
+ /* Stats for shader-db */
+ unsigned nr_bundles = 0;
+ unsigned nr_quadwords = 0;
+ nr_ins = 0;
+
while (i < num_words) {
unsigned tag = words[i] & 0xF;
unsigned next_tag = (words[i] >> 4) & 0xF;
i += 4 * num_quad_words;
+ /* We are parsing per bundle anyway */
+ nr_bundles++;
+ nr_quadwords += num_quad_words;
+
/* Break based on instruction prefetch flag */
if (i < num_words && next == 1) {
}
}
- return;
+ if (stats) {
+ unsigned nr_threads =
+ (nr_registers <= 4) ? 4 :
+ (nr_registers <= 8) ? 2 :
+ 1;
+
+ printf("%s shader: "
+ "%u inst, %u bundles, %u quadwords, "
+ "%u registers, %u threads, 0 loops\n",
+ "FRAGMENT", /* TODO */
+ nr_ins, nr_bundles, nr_quadwords,
+ nr_registers, nr_threads);
+
+ }
}
#include <stddef.h>
-void disassemble_midgard(uint8_t *code, size_t size);
+void disassemble_midgard(uint8_t *code, size_t size, bool stats, unsigned regs);
program->tls_size = ctx->tls_size;
if (midgard_debug & MIDGARD_DBG_SHADERS)
- disassemble_midgard(program->compiled.data, program->compiled.size);
+ disassemble_midgard(program->compiled.data, program->compiled.size, false, 0);
if (midgard_debug & MIDGARD_DBG_SHADERDB) {
unsigned nr_bundles = 0, nr_ins = 0, nr_quadwords = 0;
static void
pandecode_shader_disassemble(mali_ptr shader_ptr, int shader_no, int type,
- bool is_bifrost)
+ bool is_bifrost, unsigned nr_regs)
{
struct pandecode_mapped_memory *mem = pandecode_find_mapped_gpu_mem_containing(shader_ptr);
uint8_t *PANDECODE_PTR_VAR(code, mem, shader_ptr);
if (is_bifrost) {
disassemble_bifrost(code, sz, false);
} else {
- disassemble_midgard(code, sz);
+ disassemble_midgard(code, sz, true, nr_regs);
}
printf("\n\n");
pandecode_prop("attribute_count = %" PRId16, s->attribute_count);
pandecode_prop("varying_count = %" PRId16, s->varying_count);
+ unsigned nr_registers = 0;
+
if (is_bifrost) {
pandecode_log(".bifrost1 = {\n");
pandecode_indent++;
pandecode_prop("uniform_count = %" PRId16, s->midgard1.uniform_count);
pandecode_prop("uniform_buffer_count = %" PRId16, s->midgard1.uniform_buffer_count);
pandecode_prop("work_count = %" PRId16, s->midgard1.work_count);
+ nr_registers = s->midgard1.work_count;
pandecode_log(".flags = ");
pandecode_log_decoded_flags(shader_midgard1_flag_info, s->midgard1.flags);
shader = pandecode_midgard_blend_mrt(blend_base, job_no, i);
if (shader & ~0xF)
- pandecode_shader_disassemble(shader, job_no, job_type, false);
+ pandecode_shader_disassemble(shader, job_no, job_type, false, 0);
}
}
if (shader_ptr & ~0xF)
- pandecode_shader_disassemble(shader_ptr, job_no, job_type, is_bifrost);
+ pandecode_shader_disassemble(shader_ptr, job_no, job_type, is_bifrost, nr_registers);
} else
pandecode_msg("<no shader>\n");