summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-01-11 11:53:13 -0800
committerEric Anholt <[email protected]>2018-01-12 21:57:21 -0800
commit368bab43fd63ec395a2e178ce067f41bae7a1ea0 (patch)
treeba0b6713596a4b914052b331e4edaa8abf78d64a
parentaf9753e246c2a4371a289b44064483ece8d1ad5d (diff)
broadcom/vc5: Add support for loading varyings in V3D 4.1.
The LDVARY signal now writes an arbitrary register, so I took out the magic src register file and replaced it with an instruction with LDVARY set so we have somewhere to hang a QFILE_TEMP destination for register allocation.
-rw-r--r--src/broadcom/compiler/nir_to_vir.c13
-rw-r--r--src/broadcom/compiler/v3d_compiler.h1
-rw-r--r--src/broadcom/compiler/vir.c2
-rw-r--r--src/broadcom/compiler/vir_dump.c1
-rw-r--r--src/broadcom/compiler/vir_opt_dead_code.c6
-rw-r--r--src/broadcom/compiler/vir_to_qpu.c7
6 files changed, 13 insertions, 17 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index 8f37e3b3e3f..955083b717d 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -395,9 +395,20 @@ static struct qreg
emit_fragment_varying(struct v3d_compile *c, nir_variable *var,
uint8_t swizzle)
{
- struct qreg vary = vir_reg(QFILE_VARY, ~0);
+ struct qreg r3 = vir_reg(QFILE_MAGIC, V3D_QPU_WADDR_R3);
struct qreg r5 = vir_reg(QFILE_MAGIC, V3D_QPU_WADDR_R5);
+ struct qreg vary;
+ if (c->devinfo->ver >= 41) {
+ struct qinst *ldvary = vir_add_inst(V3D_QPU_A_NOP, c->undef,
+ c->undef, c->undef);
+ ldvary->qpu.sig.ldvary = true;
+ vary = vir_emit_def(c, ldvary);
+ } else {
+ vir_NOP(c)->qpu.sig.ldvary = true;
+ vary = r3;
+ }
+
/* For gl_PointCoord input or distance along a line, we'll be called
* with no nir_variable, and we don't count toward VPM size so we
* don't track an input slot.
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 1de0bfc1abd..cccb54184a5 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -73,7 +73,6 @@ enum qfile {
* or physical registers later.
*/
QFILE_TEMP,
- QFILE_VARY,
QFILE_UNIF,
QFILE_TLB,
QFILE_TLBU,
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 94593e3f6c7..7ea431036ef 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -110,6 +110,7 @@ vir_has_side_effects(struct v3d_compile *c, struct qinst *inst)
}
if (inst->qpu.sig.ldtmu ||
+ inst->qpu.sig.ldvary ||
inst->qpu.sig.wrtmuc ||
inst->qpu.sig.thrsw) {
return true;
@@ -210,7 +211,6 @@ vir_writes_r3(const struct v3d_device_info *devinfo, struct qinst *inst)
{
for (int i = 0; i < vir_get_nsrc(inst); i++) {
switch (inst->src[i].file) {
- case QFILE_VARY:
case QFILE_VPM:
return true;
default:
diff --git a/src/broadcom/compiler/vir_dump.c b/src/broadcom/compiler/vir_dump.c
index cdb1928ed00..ef860cbb5c1 100644
--- a/src/broadcom/compiler/vir_dump.c
+++ b/src/broadcom/compiler/vir_dump.c
@@ -29,7 +29,6 @@ vir_print_reg(struct v3d_compile *c, struct qreg reg)
{
static const char *files[] = {
[QFILE_TEMP] = "t",
- [QFILE_VARY] = "v",
[QFILE_UNIF] = "u",
[QFILE_TLB] = "tlb",
[QFILE_TLBU] = "tlbu",
diff --git a/src/broadcom/compiler/vir_opt_dead_code.c b/src/broadcom/compiler/vir_opt_dead_code.c
index 9e0ef20b6db..1f9e504e6be 100644
--- a/src/broadcom/compiler/vir_opt_dead_code.c
+++ b/src/broadcom/compiler/vir_opt_dead_code.c
@@ -78,12 +78,6 @@ has_nonremovable_reads(struct v3d_compile *c, struct qinst *inst)
if (total_size == 1)
return true;
}
-
- /* Dead code removal of varyings is tricky, so just assert
- * that it all happened at the NIR level.
- */
- if (inst->src[i].file == QFILE_VARY)
- return true;
}
return false;
diff --git a/src/broadcom/compiler/vir_to_qpu.c b/src/broadcom/compiler/vir_to_qpu.c
index 9229fa5ba47..432f156218c 100644
--- a/src/broadcom/compiler/vir_to_qpu.c
+++ b/src/broadcom/compiler/vir_to_qpu.c
@@ -189,12 +189,6 @@ v3d_generate_code_block(struct v3d_compile *c,
src[i] = qpu_acc(5);
break;
- case QFILE_VARY:
- temp = new_qpu_nop_before(qinst);
- temp->qpu.sig.ldvary = true;
-
- src[i] = qpu_acc(3);
- break;
case QFILE_SMALL_IMM:
abort(); /* XXX */
#if 0
@@ -255,7 +249,6 @@ v3d_generate_code_block(struct v3d_compile *c,
dst = qpu_magic(V3D_QPU_WADDR_TLBU);
break;
- case QFILE_VARY:
case QFILE_UNIF:
case QFILE_SMALL_IMM:
case QFILE_LOAD_IMM: