summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-12-17 20:23:57 -0800
committerEric Anholt <[email protected]>2014-12-17 22:35:08 -0800
commita871eff16cc18232ee03b372d75cb6f633213e14 (patch)
treec7d3622f585cc9ad3820f88ce28a5aae4fcf55e0 /src/gallium/drivers
parenta9e77896a729c040efd6ef2b7c57409031614f1f (diff)
vc4: Redefine VPM writes as a (destination) QIR register file.
This will let me coalesce the VPM writes into the instructions generating the values.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.c6
-rw-r--r--src/gallium/drivers/vc4/vc4_qir.h10
-rw-r--r--src/gallium/drivers/vc4/vc4_qpu_emit.c10
3 files changed, 19 insertions, 7 deletions
diff --git a/src/gallium/drivers/vc4/vc4_qir.c b/src/gallium/drivers/vc4/vc4_qir.c
index 8cb9826a21d..91bdefe81e5 100644
--- a/src/gallium/drivers/vc4/vc4_qir.c
+++ b/src/gallium/drivers/vc4/vc4_qir.c
@@ -74,7 +74,6 @@ static const struct qir_op_info qir_op_info[] = {
[QOP_LOG2] = { "log2", 1, 2 },
[QOP_PACK_COLORS] = { "pack_colors", 1, 4 },
[QOP_PACK_SCALED] = { "pack_scaled", 1, 2 },
- [QOP_VPM_WRITE] = { "vpm_write", 0, 1, true },
[QOP_VPM_READ] = { "vpm_read", 0, 1, true },
[QOP_TLB_DISCARD_SETUP] = { "discard", 0, 1, true },
[QOP_TLB_STENCIL_SETUP] = { "tlb_stencil_setup", 0, 1, true },
@@ -150,6 +149,9 @@ qir_has_side_effects(struct vc4_compile *c, struct qinst *inst)
}
}
+ if (inst->dst.file == QFILE_VPM)
+ return true;
+
return qir_op_info[inst->op].has_side_effects;
}
@@ -217,6 +219,8 @@ qir_print_reg(struct vc4_compile *c, struct qreg reg)
fprintf(stderr, "%d", reg.index);
else
fprintf(stderr, "%f", uif(reg.index));
+ } else if (reg.file == QFILE_VPM) {
+ fprintf(stderr, "vpm");
} else {
fprintf(stderr, "%s%d", files[reg.file], reg.index);
}
diff --git a/src/gallium/drivers/vc4/vc4_qir.h b/src/gallium/drivers/vc4/vc4_qir.h
index db0a4367222..dd9866e126f 100644
--- a/src/gallium/drivers/vc4/vc4_qir.h
+++ b/src/gallium/drivers/vc4/vc4_qir.h
@@ -38,6 +38,7 @@ enum qfile {
QFILE_TEMP,
QFILE_VARY,
QFILE_UNIF,
+ QFILE_VPM,
/**
* Stores an immediate value in the index field that can be turned
@@ -100,7 +101,6 @@ enum qop {
QOP_VR_SETUP,
QOP_PACK_SCALED,
QOP_PACK_COLORS,
- QOP_VPM_WRITE,
QOP_VPM_READ,
QOP_TLB_DISCARD_SETUP,
QOP_TLB_STENCIL_SETUP,
@@ -472,7 +472,6 @@ QIR_ALU1(EXP2)
QIR_ALU1(LOG2)
QIR_ALU2(PACK_SCALED)
QIR_ALU1(VARY_ADD_C)
-QIR_NODST_1(VPM_WRITE)
QIR_NODST_2(TEX_S)
QIR_NODST_2(TEX_T)
QIR_NODST_2(TEX_R)
@@ -545,4 +544,11 @@ qir_POW(struct vc4_compile *c, struct qreg x, struct qreg y)
qir_LOG2(c, x)));
}
+static inline void
+qir_VPM_WRITE(struct vc4_compile *c, struct qreg val)
+{
+ static const struct qreg vpm = { QFILE_VPM, 0 };
+ qir_emit(c, qir_inst(QOP_MOV, vpm, val, c->undef));
+}
+
#endif /* VC4_QIR_H */
diff --git a/src/gallium/drivers/vc4/vc4_qpu_emit.c b/src/gallium/drivers/vc4/vc4_qpu_emit.c
index 35300ff42e8..503f32a4c05 100644
--- a/src/gallium/drivers/vc4/vc4_qpu_emit.c
+++ b/src/gallium/drivers/vc4/vc4_qpu_emit.c
@@ -249,6 +249,9 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
*/
assert(src[i].addr <= 47);
break;
+ case QFILE_VPM:
+ assert(!"not reached");
+ break;
}
}
@@ -260,6 +263,9 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
case QFILE_TEMP:
dst = temp_registers[qinst->dst.index];
break;
+ case QFILE_VPM:
+ dst = qpu_ra(QPU_W_VPM);
+ break;
case QFILE_VARY:
case QFILE_UNIF:
case QFILE_SMALL_IMM:
@@ -308,10 +314,6 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
break;
- case QOP_VPM_WRITE:
- queue(c, qpu_a_MOV(qpu_ra(QPU_W_VPM), src[0]));
- break;
-
case QOP_VPM_READ:
queue(c, qpu_a_MOV(dst, qpu_ra(QPU_R_VPM)));
break;