v3d: Eliminate the TLB and TLBU files.

We can just use the magic register file like we do for other magic waddrs.
This commit is contained in:
Eric Anholt
2019-02-26 21:34:22 -08:00
parent 110f14d4b4
commit e8ee1f8eaf
4 changed files with 20 additions and 41 deletions

View File

@@ -1137,9 +1137,10 @@ emit_frag_end(struct v3d_compile *c)
vir_FTOC(c, color[3]))); vir_FTOC(c, color[3])));
} }
struct qreg tlb_reg = vir_magic_reg(V3D_QPU_WADDR_TLB);
struct qreg tlbu_reg = vir_magic_reg(V3D_QPU_WADDR_TLBU);
if (c->output_position_index != -1) { if (c->output_position_index != -1) {
struct qinst *inst = vir_MOV_dest(c, struct qinst *inst = vir_MOV_dest(c, tlbu_reg,
vir_reg(QFILE_TLBU, 0),
c->outputs[c->output_position_index]); c->outputs[c->output_position_index]);
uint8_t tlb_specifier = TLB_TYPE_DEPTH; uint8_t tlb_specifier = TLB_TYPE_DEPTH;
@@ -1167,8 +1168,7 @@ emit_frag_end(struct v3d_compile *c)
*/ */
c->s->info.fs.uses_discard = true; c->s->info.fs.uses_discard = true;
struct qinst *inst = vir_MOV_dest(c, struct qinst *inst = vir_MOV_dest(c, tlbu_reg,
vir_reg(QFILE_TLBU, 0),
vir_nop_reg()); vir_nop_reg());
uint8_t tlb_specifier = TLB_TYPE_DEPTH; uint8_t tlb_specifier = TLB_TYPE_DEPTH;
@@ -1221,14 +1221,13 @@ emit_frag_end(struct v3d_compile *c)
conf |= ((num_components - 1) << conf |= ((num_components - 1) <<
TLB_VEC_SIZE_MINUS_1_SHIFT); TLB_VEC_SIZE_MINUS_1_SHIFT);
inst = vir_MOV_dest(c, vir_reg(QFILE_TLBU, 0), color[0]); inst = vir_MOV_dest(c, tlbu_reg, color[0]);
inst->uniform = vir_get_uniform_index(c, inst->uniform = vir_get_uniform_index(c,
QUNIFORM_CONSTANT, QUNIFORM_CONSTANT,
conf); conf);
for (int i = 1; i < num_components; i++) { for (int i = 1; i < num_components; i++) {
inst = vir_MOV_dest(c, vir_reg(QFILE_TLB, 0), inst = vir_MOV_dest(c, tlb_reg, color[i]);
color[i]);
} }
break; break;
@@ -1260,28 +1259,28 @@ emit_frag_end(struct v3d_compile *c)
a = vir_uniform_f(c, 1.0); a = vir_uniform_f(c, 1.0);
if (c->fs_key->f32_color_rb & (1 << rt)) { if (c->fs_key->f32_color_rb & (1 << rt)) {
inst = vir_MOV_dest(c, vir_reg(QFILE_TLBU, 0), r); inst = vir_MOV_dest(c, tlbu_reg, r);
inst->uniform = vir_get_uniform_index(c, inst->uniform = vir_get_uniform_index(c,
QUNIFORM_CONSTANT, QUNIFORM_CONSTANT,
conf); conf);
if (num_components >= 2) if (num_components >= 2)
vir_MOV_dest(c, vir_reg(QFILE_TLB, 0), g); vir_MOV_dest(c, tlb_reg, g);
if (num_components >= 3) if (num_components >= 3)
vir_MOV_dest(c, vir_reg(QFILE_TLB, 0), b); vir_MOV_dest(c, tlb_reg, b);
if (num_components >= 4) if (num_components >= 4)
vir_MOV_dest(c, vir_reg(QFILE_TLB, 0), a); vir_MOV_dest(c, tlb_reg, a);
} else { } else {
inst = vir_VFPACK_dest(c, vir_reg(QFILE_TLB, 0), r, g); inst = vir_VFPACK_dest(c, tlb_reg, r, g);
if (conf != ~0) { if (conf != ~0) {
inst->dst.file = QFILE_TLBU; inst->dst = tlbu_reg;
inst->uniform = vir_get_uniform_index(c, inst->uniform = vir_get_uniform_index(c,
QUNIFORM_CONSTANT, QUNIFORM_CONSTANT,
conf); conf);
} }
if (num_components >= 3) if (num_components >= 3)
inst = vir_VFPACK_dest(c, vir_reg(QFILE_TLB, 0), b, a); inst = vir_VFPACK_dest(c, tlb_reg, b, a);
} }
break; break;
} }

View File

@@ -69,8 +69,6 @@ enum qfile {
* or physical registers later. * or physical registers later.
*/ */
QFILE_TEMP, QFILE_TEMP,
QFILE_TLB,
QFILE_TLBU,
/** /**
* VPM reads use this with an index value to say what part of the VPM * VPM reads use this with an index value to say what part of the VPM
@@ -104,6 +102,11 @@ static inline struct qreg vir_reg(enum qfile file, uint32_t index)
return (struct qreg){file, index}; return (struct qreg){file, index};
} }
static inline struct qreg vir_magic_reg(uint32_t index)
{
return (struct qreg){QFILE_MAGIC, index};
}
static inline struct qreg vir_nop_reg(void) static inline struct qreg vir_nop_reg(void)
{ {
return (struct qreg){QFILE_NULL, 0}; return (struct qreg){QFILE_NULL, 0};

View File

@@ -133,12 +133,6 @@ static void
vir_print_reg(struct v3d_compile *c, const struct qinst *inst, vir_print_reg(struct v3d_compile *c, const struct qinst *inst,
struct qreg reg) struct qreg reg)
{ {
static const char *files[] = {
[QFILE_TEMP] = "t",
[QFILE_TLB] = "tlb",
[QFILE_TLBU] = "tlbu",
};
switch (reg.file) { switch (reg.file) {
case QFILE_NULL: case QFILE_NULL:
@@ -177,13 +171,8 @@ vir_print_reg(struct v3d_compile *c, const struct qinst *inst,
reg.index / 4, reg.index % 4); reg.index / 4, reg.index % 4);
break; break;
case QFILE_TLB: case QFILE_TEMP:
case QFILE_TLBU: fprintf(stderr, "t%d", reg.index);
fprintf(stderr, "%s", files[reg.file]);
break;
default:
fprintf(stderr, "%s%d", files[reg.file], reg.index);
break; break;
} }
} }

View File

@@ -240,10 +240,6 @@ v3d_generate_code_block(struct v3d_compile *c,
src[i] = qpu_acc(3); src[i] = qpu_acc(3);
break; break;
case QFILE_TLB:
case QFILE_TLBU:
unreachable("bad vir src file");
} }
} }
@@ -269,14 +265,6 @@ v3d_generate_code_block(struct v3d_compile *c,
dst = qpu_magic(V3D_QPU_WADDR_VPM); dst = qpu_magic(V3D_QPU_WADDR_VPM);
break; break;
case QFILE_TLB:
dst = qpu_magic(V3D_QPU_WADDR_TLB);
break;
case QFILE_TLBU:
dst = qpu_magic(V3D_QPU_WADDR_TLBU);
break;
case QFILE_SMALL_IMM: case QFILE_SMALL_IMM:
case QFILE_LOAD_IMM: case QFILE_LOAD_IMM:
assert(!"not reached"); assert(!"not reached");