vc4: Redo VPM reads as a read file.

This will let us do copy propagation of the VPM reads.
This commit is contained in:
Eric Anholt
2015-01-10 14:07:12 +13:00
parent 06b6a72a3e
commit a58ae83882
5 changed files with 16 additions and 16 deletions

View File

@@ -87,9 +87,10 @@ qir_opt_copy_propagation(struct vc4_compile *c)
if (inst->op == QOP_MOV &&
inst->dst.file == QFILE_TEMP &&
(inst->src[0].file != QFILE_TEMP ||
(defs[inst->src[0].index]->op != QOP_TEX_RESULT &&
defs[inst->src[0].index]->op != QOP_TLB_COLOR_READ))) {
inst->src[0].file != QFILE_VPM &&
!(inst->src[0].file == QFILE_TEMP &&
(defs[inst->src[0].index]->op == QOP_TEX_RESULT ||
defs[inst->src[0].index]->op == QOP_TLB_COLOR_READ))) {
movs[inst->dst.index] = inst->src[0];
}
}

View File

@@ -1080,7 +1080,8 @@ emit_vertex_input(struct vc4_compile *c, int attr)
struct qreg vpm_reads[4];
for (int i = 0; i < align(attr_size, 4) / 4; i++) {
vpm_reads[i] = qir_VPM_READ(c);
struct qreg vpm = { QFILE_VPM, attr * 4 + i };
vpm_reads[i] = qir_MOV(c, vpm);
c->num_inputs++;
}
@@ -1933,10 +1934,8 @@ emit_stub_vpm_read(struct vc4_compile *c)
return;
for (int i = 0; i < 4; i++) {
qir_emit(c, qir_inst(QOP_VPM_READ,
qir_get_temp(c),
c->undef,
c->undef));
struct qreg vpm = { QFILE_VPM, 0 };
(void)qir_MOV(c, vpm);
c->num_inputs++;
}
}

View File

@@ -79,7 +79,6 @@ static const struct qir_op_info qir_op_info[] = {
[QOP_PACK_8C_F] = { "pack_8c_f", 1, 2, false, true },
[QOP_PACK_8D_F] = { "pack_8d_f", 1, 2, false, true },
[QOP_PACK_SCALED] = { "pack_scaled", 1, 2, false, 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 },
[QOP_TLB_Z_WRITE] = { "tlb_z", 0, 1, true },
@@ -152,6 +151,9 @@ qir_has_side_effects(struct vc4_compile *c, struct qinst *inst)
c->input_semantics[inst->src[i].index].semantic == 0xff) {
return true;
}
if (inst->src[i].file == QFILE_VPM)
return true;
}
if (inst->dst.file == QFILE_VPM)

View File

@@ -105,7 +105,6 @@ enum qop {
QOP_PACK_8B_F,
QOP_PACK_8C_F,
QOP_PACK_8D_F,
QOP_VPM_READ,
QOP_TLB_DISCARD_SETUP,
QOP_TLB_STENCIL_SETUP,
QOP_TLB_Z_WRITE,
@@ -495,7 +494,6 @@ QIR_ALU0(FRAG_W)
QIR_ALU0(FRAG_REV_FLAG)
QIR_ALU0(TEX_RESULT)
QIR_ALU0(TLB_COLOR_READ)
QIR_ALU0(VPM_READ)
QIR_NODST_1(TLB_Z_WRITE)
QIR_NODST_1(TLB_DISCARD_SETUP)
QIR_NODST_1(TLB_STENCIL_SETUP)

View File

@@ -147,6 +147,7 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
uint32_t inputs_remaining = c->num_inputs;
uint32_t vpm_read_fifo_count = 0;
uint32_t vpm_read_offset = 0;
int last_vpm_read_index = -1;
bool written_r3 = false;
bool needs_restore;
/* Map from the QIR ops enum order to QPU unpack bits. */
@@ -250,7 +251,10 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
assert(src[i].addr <= 47);
break;
case QFILE_VPM:
assert(!"not reached");
assert((int)qinst->src[i].index >=
last_vpm_read_index);
last_vpm_read_index = qinst->src[i].index;
src[i] = qpu_ra(QPU_R_VPM);
break;
}
}
@@ -314,10 +318,6 @@ vc4_generate_code(struct vc4_context *vc4, struct vc4_compile *c)
break;
case QOP_VPM_READ:
queue(c, qpu_a_MOV(dst, qpu_ra(QPU_R_VPM)));
break;
case QOP_RCP:
case QOP_RSQ:
case QOP_EXP2: