summaryrefslogtreecommitdiffstats
path: root/src/broadcom/compiler/vir_to_qpu.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-12-11 23:02:37 -0800
committerEric Anholt <[email protected]>2018-12-14 17:48:01 -0800
commit248a7fb392ba9ed0f3d25b599e214b456cefa910 (patch)
treeab43ecf9289c3f31628a4b6fce26b85fe2a1d478 /src/broadcom/compiler/vir_to_qpu.c
parenta370ed76ab043ebcc1c4c866d3fef85c7dc77035 (diff)
v3d: Do uniform pretty-printing in the QPU dump.
If you're trying to trace what's going on in a QPU dump, this will definitely help you find your way.
Diffstat (limited to 'src/broadcom/compiler/vir_to_qpu.c')
-rw-r--r--src/broadcom/compiler/vir_to_qpu.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/broadcom/compiler/vir_to_qpu.c b/src/broadcom/compiler/vir_to_qpu.c
index 4baadce294c..0ab0f26c953 100644
--- a/src/broadcom/compiler/vir_to_qpu.c
+++ b/src/broadcom/compiler/vir_to_qpu.c
@@ -353,6 +353,33 @@ v3d_generate_code_block(struct v3d_compile *c,
}
}
+static bool
+reads_uniform(const struct v3d_device_info *devinfo, uint64_t instruction)
+{
+ struct v3d_qpu_instr qpu;
+ MAYBE_UNUSED bool ok = v3d_qpu_instr_unpack(devinfo, instruction, &qpu);
+ assert(ok);
+
+ if (qpu.sig.ldunif ||
+ qpu.sig.ldunifarf ||
+ qpu.sig.wrtmuc) {
+ return true;
+ }
+
+ if (qpu.type == V3D_QPU_INSTR_TYPE_ALU) {
+ if (qpu.alu.add.magic_write &&
+ v3d_qpu_magic_waddr_loads_unif(qpu.alu.add.waddr)) {
+ return true;
+ }
+
+ if (qpu.alu.mul.magic_write &&
+ v3d_qpu_magic_waddr_loads_unif(qpu.alu.mul.waddr)) {
+ return true;
+ }
+ }
+
+ return false;
+}
static void
v3d_dump_qpu(struct v3d_compile *c)
@@ -361,11 +388,30 @@ v3d_dump_qpu(struct v3d_compile *c)
vir_get_stage_name(c),
c->program_id, c->variant_id);
+ int next_uniform = 0;
for (int i = 0; i < c->qpu_inst_count; i++) {
const char *str = v3d_qpu_disasm(c->devinfo, c->qpu_insts[i]);
- fprintf(stderr, "0x%016"PRIx64" %s\n", c->qpu_insts[i], str);
+ fprintf(stderr, "0x%016"PRIx64" %s", c->qpu_insts[i], str);
+
+ /* We can only do this on 4.x, because we're not tracking TMU
+ * implicit uniforms here on 3.x.
+ */
+ if (c->devinfo->ver >= 40 &&
+ reads_uniform(c->devinfo, c->qpu_insts[i])) {
+ fprintf(stderr, " (");
+ vir_dump_uniform(c->uniform_contents[next_uniform],
+ c->uniform_data[next_uniform]);
+ fprintf(stderr, ")");
+ next_uniform++;
+ }
+ fprintf(stderr, "\n");
ralloc_free((void *)str);
}
+
+ /* Make sure our dumping lined up. */
+ if (c->devinfo->ver >= 40)
+ assert(next_uniform == c->num_uniforms);
+
fprintf(stderr, "\n");
}