aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_qpu.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-01-11 18:27:07 +1300
committerEric Anholt <[email protected]>2015-01-15 22:19:25 +1300
commit3820866e40d16f5d05319f0390956fb6e6407239 (patch)
tree8a3f93458c01e458e86c921de5d7bc3ff86390c2 /src/gallium/drivers/vc4/vc4_qpu.c
parentd1f2fc834d1c662726e30ff51d843e3ecd4b06d6 (diff)
vc4: Don't let pairing happen with badly mismatched pack flags.
No difference on shader-db, but will become more important as I introduce more use of pack flags with the blending changes.
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_qpu.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_qpu.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qpu.c b/src/gallium/drivers/vc4/vc4_qpu.c
index 7e38ede3342..6bdb3957382 100644
--- a/src/gallium/drivers/vc4/vc4_qpu.c
+++ b/src/gallium/drivers/vc4/vc4_qpu.c
@@ -394,6 +394,15 @@ convert_mov(uint64_t *inst)
return true;
}
+static bool
+writes_a_file(uint64_t inst)
+{
+ if (!(inst & QPU_WS))
+ return QPU_GET_FIELD(inst, QPU_WADDR_ADD) < 32;
+ else
+ return QPU_GET_FIELD(inst, QPU_WADDR_MUL) < 32;
+}
+
uint64_t
qpu_merge_inst(uint64_t a, uint64_t b)
{
@@ -470,6 +479,36 @@ qpu_merge_inst(uint64_t a, uint64_t b)
return 0;
}
+ /* packing: Make sure that non-NOP packs agree, then deal with
+ * special-case failing of adding a non-NOP pack to something with a
+ * NOP pack.
+ */
+ if (!merge_fields(&merge, a, b, QPU_PACK_MASK, 0))
+ return 0;
+ bool new_a_pack = (QPU_GET_FIELD(a, QPU_PACK) !=
+ QPU_GET_FIELD(merge, QPU_PACK));
+ bool new_b_pack = (QPU_GET_FIELD(b, QPU_PACK) !=
+ QPU_GET_FIELD(merge, QPU_PACK));
+ if (!(merge & QPU_PM)) {
+ /* Make sure we're not going to be putting a new
+ * a-file packing on either half.
+ */
+ if (new_a_pack && writes_a_file(a))
+ return 0;
+
+ if (new_b_pack && writes_a_file(b))
+ return 0;
+ } else {
+ /* Make sure we're not going to be putting new MUL packing on
+ * either half.
+ */
+ if (new_a_pack && QPU_GET_FIELD(a, QPU_OP_MUL) != QPU_M_NOP)
+ return 0;
+
+ if (new_b_pack && QPU_GET_FIELD(b, QPU_OP_MUL) != QPU_M_NOP)
+ return 0;
+ }
+
if (ok)
return merge;
else