This just adds support to the decoder, not actual SB support.
v1.1: fixup GDS relative mode. (Glenn).
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
unsigned src_gpr:7;
unsigned src_rel:1;
+ unsigned src_rel_global:1; /* for GDS ops */
unsigned src_sel[4];
unsigned dst_gpr:7;
unsigned dst_rel:1;
+ unsigned dst_rel_global:1; /* for GDS ops */
unsigned dst_sel[4];
unsigned alt_const:1;
unsigned endian_swap:2;
unsigned mega_fetch:1;
+ unsigned src2_gpr:7; /* for GDS */
void set_op(unsigned op) { this->op = op; op_ptr = r600_isa_fetch(op); }
};
int decode_cf_mem(unsigned &i, bc_cf &bc);
int decode_fetch_vtx(unsigned &i, bc_fetch &bc);
+ int decode_fetch_gds(unsigned &i, bc_fetch &bc);
};
// bytecode format definition
unsigned fetch_opcode = dw0 & 0x1F;
- bc.set_op(r600_isa_fetch_by_opcode(ctx.isa, fetch_opcode));
+ if (fetch_opcode == 2) { // MEM_INST_MEM
+ unsigned mem_op = (dw0 >> 8) & 0x7;
+ unsigned gds_op;
+ if (mem_op == 4) {
+ gds_op = (dw1 >> 9) & 0x1f;
+ fetch_opcode = FETCH_OP_GDS_ADD + gds_op;
+ } else if (mem_op == 5)
+ fetch_opcode = FETCH_OP_TF_WRITE;
+ bc.set_op(fetch_opcode);
+ } else
+ bc.set_op(r600_isa_fetch_by_opcode(ctx.isa, fetch_opcode));
+
+ if (bc.op_ptr->flags & FF_GDS)
+ return decode_fetch_gds(i, bc);
if (bc.op_ptr->flags & FF_VTX)
return decode_fetch_vtx(i, bc);
return r;
}
+int bc_decoder::decode_fetch_gds(unsigned & i, bc_fetch& bc) {
+ int r = 0;
+ uint32_t dw0 = dw[i];
+ uint32_t dw1 = dw[i+1];
+ uint32_t dw2 = dw[i+2];
+ uint32_t tmp;
+ /* GDS instructions align to 4 words boundaries */
+ i+= 4;
+ assert(i <= ndw);
+
+ MEM_GDS_WORD0_EGCM w0(dw0);
+ bc.src_gpr = w0.get_SRC_GPR();
+ tmp = w0.get_SRC_REL_MODE();
+ bc.src_rel_global = (tmp == 2);
+ bc.src_sel[0] = w0.get_SRC_SEL_X();
+ bc.src_sel[1] = w0.get_SRC_SEL_Y();
+ bc.src_sel[2] = w0.get_SRC_SEL_Z();
+
+ MEM_GDS_WORD1_EGCM w1(dw1);
+ bc.dst_gpr = w1.get_DST_GPR();
+ tmp = w1.get_DST_REL_MODE();
+ bc.dst_rel_global = (tmp == 2);
+ bc.src2_gpr = w1.get_SRC_GPR();
+
+ MEM_GDS_WORD2_EGCM w2(dw2);
+ bc.dst_sel[0] = w2.get_DST_SEL_X();
+ bc.dst_sel[1] = w2.get_DST_SEL_Y();
+ bc.dst_sel[2] = w2.get_DST_SEL_Z();
+ bc.dst_sel[3] = w2.get_DST_SEL_W();
+ return r;
+}
+
int bc_decoder::decode_fetch_vtx(unsigned & i, bc_fetch& bc) {
int r = 0;
uint32_t dw0 = dw[i];
void bc_dump::dump(fetch_node& n) {
sb_ostringstream s;
static const char * fetch_type[] = {"VERTEX", "INSTANCE", ""};
+ unsigned gds = n.bc.op_ptr->flags & FF_GDS;
s << n.bc.op_ptr->name;
fill_to(s, 20);
- s << "R";
- print_sel(s, n.bc.dst_gpr, n.bc.dst_rel, INDEX_LOOP, 0);
- s << ".";
- for (int k = 0; k < 4; ++k)
- s << chans[n.bc.dst_sel[k]];
- s << ", ";
+ if (!gds) {
+ s << "R";
+ print_sel(s, n.bc.dst_gpr, n.bc.dst_rel, INDEX_LOOP, 0);
+ s << ".";
+ for (int k = 0; k < 4; ++k)
+ s << chans[n.bc.dst_sel[k]];
+ s << ", ";
+ }
s << "R";
print_sel(s, n.bc.src_gpr, n.bc.src_rel, INDEX_LOOP, 0);
s << ".";
unsigned vtx = n.bc.op_ptr->flags & FF_VTX;
- unsigned num_src_comp = vtx ? ctx.is_cayman() ? 2 : 1 : 4;
+ unsigned num_src_comp = gds ? 3 : vtx ? ctx.is_cayman() ? 2 : 1 : 4;
for (unsigned k = 0; k < num_src_comp; ++k)
s << chans[n.bc.src_sel[k]];
s << " + " << n.bc.offset[0] << "b ";
}
- s << ", RID:" << n.bc.resource_id;
+ if (!gds)
+ s << ", RID:" << n.bc.resource_id;
+
+ if (gds) {
- if (vtx) {
+ } else if (vtx) {
s << " " << fetch_type[n.bc.fetch_type];
if (!ctx.is_cayman() && n.bc.mega_fetch_count)
s << " MFC:" << n.bc.mega_fetch_count;
BC_FIELD(TEX_WORD2, SRC_SEL_Z, SSZ, 28, 26)
BC_FIELD(TEX_WORD2, SRC_SEL_W, SSW, 31, 29)
BC_FORMAT_END(TEX_WORD2)
+
+BC_FORMAT_BEGIN_HW(MEM_GDS_WORD0, EGCM)
+BC_FIELD(MEM_GDS_WORD0, MEM_INST, M_INST, 4, 0)
+BC_FIELD(MEM_GDS_WORD0, MEM_OP, M_OP, 10, 8)
+BC_FIELD(MEM_GDS_WORD0, SRC_GPR, S_GPR, 17, 11)
+BC_FIELD(MEM_GDS_WORD0, SRC_REL_MODE, SRM, 19, 18)
+BC_FIELD(MEM_GDS_WORD0, SRC_SEL_X, SSX, 22, 20)
+BC_FIELD(MEM_GDS_WORD0, SRC_SEL_Y, SSY, 25, 23)
+BC_FIELD(MEM_GDS_WORD0, SRC_SEL_Z, SSZ, 28, 26)
+BC_FORMAT_END(MEM_GDS_WORD0)
+
+BC_FORMAT_BEGIN_HW(MEM_GDS_WORD1, EGCM)
+BC_FIELD(MEM_GDS_WORD1, DST_GPR, D_GPR, 6, 0)
+BC_FIELD(MEM_GDS_WORD1, DST_REL_MODE, DRM, 8, 7)
+BC_FIELD(MEM_GDS_WORD1, GDS_OP, G_OP, 14, 9)
+BC_FIELD(MEM_GDS_WORD1, SRC_GPR, S_GPR, 22, 16)
+BC_FIELD(MEM_GDS_WORD1, UAV_INDEX_MODE, U_IM, 25, 24)
+BC_FIELD(MEM_GDS_WORD1, UAV_ID, U_ID, 29, 26)
+BC_FIELD(MEM_GDS_WORD1, ALLOC_CONSUME, AC, 30, 30)
+BC_FIELD(MEM_GDS_WORD1, BCARD_FIRST_REQ, BFR, 31, 31)
+BC_FORMAT_END(MEM_GDS_WORD1)
+
+BC_FORMAT_BEGIN_HW(MEM_GDS_WORD2, EGCM)
+BC_FIELD(MEM_GDS_WORD2, DST_SEL_X, DSX, 2, 0)
+BC_FIELD(MEM_GDS_WORD2, DST_SEL_Y, DSY, 5, 3)
+BC_FIELD(MEM_GDS_WORD2, DST_SEL_Z, DSZ, 8, 6)
+BC_FIELD(MEM_GDS_WORD2, DST_SEL_W, DSW, 11, 9)
+BC_FORMAT_END(MEM_GDS_WORD2)
\ No newline at end of file