summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qpu_emit.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-10-26 14:16:19 -0700
committerEric Anholt <eric@anholt.net>2015-10-26 16:48:34 -0700
commit72fa2ae20b979ced1b4dde16f81b28d02a2e3b7b (patch)
tree566273fb782c22812788acd7252ab3a718896f5c /src/gallium/drivers/vc4/vc4_qpu_emit.c
parent99a9a5a345fab8bbf36ab4e42581f8ee04a59a63 (diff)
downloadexternal_mesa3d-72fa2ae20b979ced1b4dde16f81b28d02a2e3b7b.zip
external_mesa3d-72fa2ae20b979ced1b4dde16f81b28d02a2e3b7b.tar.gz
external_mesa3d-72fa2ae20b979ced1b4dde16f81b28d02a2e3b7b.tar.bz2
vc4: Move dst pack setup out to a helper function with more asserts.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qpu_emit.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_qpu_emit.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index a3eff84..7d4144a 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -125,6 +125,27 @@ fixup_raddr_conflict(struct vc4_compile *c,
}
}
+static void
+set_last_dst_pack(struct vc4_compile *c, struct qinst *inst)
+{
+ bool had_pm = *last_inst(c) & QPU_PM;
+ bool had_ws = *last_inst(c) & QPU_WS;
+ uint32_t unpack = QPU_GET_FIELD(*last_inst(c), QPU_UNPACK);
+
+ if (!inst->dst.pack)
+ return;
+
+ *last_inst(c) |= QPU_SET_FIELD(inst->dst.pack, QPU_PACK);
+
+ if (qir_is_mul(inst)) {
+ assert(!unpack || had_pm);
+ *last_inst(c) |= QPU_PM;
+ } else {
+ assert(!unpack || !had_pm);
+ assert(!had_ws); /* dst must be a-file to pack. */
+ }
+}
+
void
vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
{
@@ -450,21 +471,12 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
queue(c, qpu_m_alu2(translate[qinst->op].op,
dst,
src[0], src[1]));
- if (qinst->dst.pack) {
- *last_inst(c) |= QPU_PM;
- *last_inst(c) |= QPU_SET_FIELD(qinst->dst.pack,
- QPU_PACK);
- }
} else {
queue(c, qpu_a_alu2(translate[qinst->op].op,
dst,
src[0], src[1]));
- if (qinst->dst.pack) {
- assert(dst.mux == QPU_MUX_A);
- *last_inst(c) |= QPU_SET_FIELD(qinst->dst.pack,
- QPU_PACK);
- }
}
+ set_last_dst_pack(c, qinst);
break;
}