fprintf(stderr, "--------------------------------------\n");
}
-void r600_bytecode_dump(struct r600_bytecode *bc)
-{
- struct r600_bytecode_cf *cf = NULL;
- struct r600_bytecode_alu *alu = NULL;
- struct r600_bytecode_vtx *vtx = NULL;
- struct r600_bytecode_tex *tex = NULL;
-
- unsigned i, id;
- uint32_t literal[4];
- unsigned nliteral;
- char chip = '6';
-
- switch (bc->chip_class) {
- case R700:
- chip = '7';
- break;
- case EVERGREEN:
- chip = 'E';
- break;
- case CAYMAN:
- chip = 'C';
- break;
- case R600:
- default:
- chip = '6';
- break;
- }
- fprintf(stderr, "bytecode %d dw -- %d gprs ---------------------\n", bc->ndw, bc->ngpr);
- fprintf(stderr, " %c\n", chip);
-
- LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
- id = cf->id;
- if (cf->op == CF_NATIVE) {
- fprintf(stderr, "%04d %08X CF NATIVE\n", id, bc->bytecode[id]);
- fprintf(stderr, "%04d %08X CF NATIVE\n", id + 1, bc->bytecode[id + 1]);
- } else {
- const struct cf_op_info *cfop = r600_isa_cf(cf->op);
- if (cfop->flags & CF_ALU) {
- if (cf->eg_alu_extended) {
- fprintf(stderr, "%04d %08X ALU_EXT0 ", id, bc->bytecode[id]);
- fprintf(stderr, "KCACHE_BANK2:%X ", cf->kcache[2].bank);
- fprintf(stderr, "KCACHE_BANK3:%X ", cf->kcache[3].bank);
- fprintf(stderr, "KCACHE_MODE2:%X\n", cf->kcache[2].mode);
- id++;
- fprintf(stderr, "%04d %08X ALU_EXT1 ", id, bc->bytecode[id]);
- fprintf(stderr, "KCACHE_MODE3:%X ", cf->kcache[3].mode);
- fprintf(stderr, "KCACHE_ADDR2:%X ", cf->kcache[2].addr);
- fprintf(stderr, "KCACHE_ADDR3:%X\n", cf->kcache[3].addr);
- id++;
- }
-
- fprintf(stderr, "%04d %08X ALU ", id, bc->bytecode[id]);
- fprintf(stderr, "ADDR:%d ", cf->addr);
- fprintf(stderr, "KCACHE_MODE0:%X ", cf->kcache[0].mode);
- fprintf(stderr, "KCACHE_BANK0:%X ", cf->kcache[0].bank);
- fprintf(stderr, "KCACHE_BANK1:%X\n", cf->kcache[1].bank);
- id++;
- fprintf(stderr, "%04d %08X ALU ", id, bc->bytecode[id]);
- fprintf(stderr, "INST: %s ", cfop->name);
- fprintf(stderr, "KCACHE_MODE1:%X ", cf->kcache[1].mode);
- fprintf(stderr, "KCACHE_ADDR0:%X ", cf->kcache[0].addr);
- fprintf(stderr, "KCACHE_ADDR1:%X ", cf->kcache[1].addr);
- fprintf(stderr, "COUNT:%d\n", cf->ndw / 2);
- } else if (cfop->flags & CF_FETCH) {
- fprintf(stderr, "%04d %08X TEX/VTX ", id, bc->bytecode[id]);
- fprintf(stderr, "ADDR:%d\n", cf->addr);
- id++;
- fprintf(stderr, "%04d %08X TEX/VTX ", id, bc->bytecode[id]);
- fprintf(stderr, "INST: %s ", cfop->name);
- fprintf(stderr, "COUNT:%d\n", cf->ndw / 4);
- } else if (cfop->flags & CF_EXP) {
- fprintf(stderr, "%04d %08X %s ", id, bc->bytecode[id],
- cfop->name);
- fprintf(stderr, "GPR:%X ", cf->output.gpr);
- fprintf(stderr, "ELEM_SIZE:%X ", cf->output.elem_size);
- fprintf(stderr, "ARRAY_BASE:%X ", cf->output.array_base);
- fprintf(stderr, "TYPE:%X\n", cf->output.type);
- id++;
- fprintf(stderr, "%04d %08X %s ", id, bc->bytecode[id],
- cfop->name);
- fprintf(stderr, "SWIZ_X:%X ", cf->output.swizzle_x);
- fprintf(stderr, "SWIZ_Y:%X ", cf->output.swizzle_y);
- fprintf(stderr, "SWIZ_Z:%X ", cf->output.swizzle_z);
- fprintf(stderr, "SWIZ_W:%X ", cf->output.swizzle_w);
- fprintf(stderr, "BARRIER:%X ", cf->output.barrier);
- fprintf(stderr, "INST: %s ", r600_isa_cf(cf->op)->name);
- fprintf(stderr, "BURST_COUNT:%d ", cf->output.burst_count);
- fprintf(stderr, "EOP:%X\n", cf->output.end_of_program);
- } else if (cfop->flags & CF_STRM) {
- fprintf(stderr, "%04d %08X EXPORT %s ", id, bc->bytecode[id],
- cfop->name);
- fprintf(stderr, "GPR:%X ", cf->output.gpr);
- fprintf(stderr, "ELEM_SIZE:%i ", cf->output.elem_size);
- fprintf(stderr, "ARRAY_BASE:%i ", cf->output.array_base);
- fprintf(stderr, "TYPE:%X\n", cf->output.type);
- id++;
- fprintf(stderr, "%04d %08X EXPORT %s ", id, bc->bytecode[id],
- cfop->name);
- fprintf(stderr, "ARRAY_SIZE:%i ", cf->output.array_size);
- fprintf(stderr, "COMP_MASK:%X ", cf->output.comp_mask);
- fprintf(stderr, "BARRIER:%X ", cf->output.barrier);
- fprintf(stderr, "INST: %s ", cfop->name);
- fprintf(stderr, "BURST_COUNT:%d ", cf->output.burst_count);
- fprintf(stderr, "EOP:%X\n", cf->output.end_of_program);
-
- } else {
- fprintf(stderr, "%04d %08X CF ", id, bc->bytecode[id]);
- fprintf(stderr, "ADDR:%d\n", cf->cf_addr);
- id++;
- fprintf(stderr, "%04d %08X CF ", id, bc->bytecode[id]);
- fprintf(stderr, "INST: %s ", cfop->name);
- fprintf(stderr, "COND:%X ", cf->cond);
- fprintf(stderr, "POP_COUNT:%X\n", cf->pop_count);
- }
- }
-
- id = cf->addr;
- nliteral = 0;
- LIST_FOR_EACH_ENTRY(alu, &cf->alu, list) {
- r600_bytecode_alu_nliterals(bc, alu, literal, &nliteral);
-
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, " SRC0(SEL:%d ", alu->src[0].sel);
- fprintf(stderr, "REL:%d ", alu->src[0].rel);
- fprintf(stderr, "CHAN:%d ", alu->src[0].chan);
- fprintf(stderr, "NEG:%d) ", alu->src[0].neg);
- fprintf(stderr, "SRC1(SEL:%d ", alu->src[1].sel);
- fprintf(stderr, "REL:%d ", alu->src[1].rel);
- fprintf(stderr, "CHAN:%d ", alu->src[1].chan);
- fprintf(stderr, "NEG:%d ", alu->src[1].neg);
- fprintf(stderr, "IM:%d) ", alu->index_mode);
- fprintf(stderr, "PRED_SEL:%d ", alu->pred_sel);
- fprintf(stderr, "LAST:%d)\n", alu->last);
- id++;
- fprintf(stderr, "%04d %08X %c ", id, bc->bytecode[id], alu->last ? '*' : ' ');
- fprintf(stderr, "INST: %s ", r600_isa_alu(alu->op)->name);
- fprintf(stderr, "DST(SEL:%d ", alu->dst.sel);
- fprintf(stderr, "CHAN:%d ", alu->dst.chan);
- fprintf(stderr, "REL:%d ", alu->dst.rel);
- fprintf(stderr, "CLAMP:%d) ", alu->dst.clamp);
- fprintf(stderr, "BANK_SWIZZLE:%d ", alu->bank_swizzle);
- if (alu->is_op3) {
- fprintf(stderr, "SRC2(SEL:%d ", alu->src[2].sel);
- fprintf(stderr, "REL:%d ", alu->src[2].rel);
- fprintf(stderr, "CHAN:%d ", alu->src[2].chan);
- fprintf(stderr, "NEG:%d)\n", alu->src[2].neg);
- } else {
- fprintf(stderr, "SRC0_ABS:%d ", alu->src[0].abs);
- fprintf(stderr, "SRC1_ABS:%d ", alu->src[1].abs);
- fprintf(stderr, "WRITE_MASK:%d ", alu->dst.write);
- fprintf(stderr, "OMOD:%d ", alu->omod);
- fprintf(stderr, "EXECUTE_MASK:%d ", alu->execute_mask);
- fprintf(stderr, "UPDATE_PRED:%d\n", alu->update_pred);
- }
-
- id++;
- if (alu->last) {
- for (i = 0; i < nliteral; i++, id++) {
- float *f = (float*)(bc->bytecode + id);
- fprintf(stderr, "%04d %08X\t%f (%d)\n", id, bc->bytecode[id], *f,
- *(bc->bytecode + id));
- }
- id += nliteral & 1;
- nliteral = 0;
- }
- }
-
- LIST_FOR_EACH_ENTRY(tex, &cf->tex, list) {
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, "INST: %s ", r600_isa_fetch(tex->op)->name);
- fprintf(stderr, "RESOURCE_ID:%d ", tex->resource_id);
- fprintf(stderr, "SRC(GPR:%d ", tex->src_gpr);
- fprintf(stderr, "REL:%d)\n", tex->src_rel);
- id++;
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, "DST(GPR:%d ", tex->dst_gpr);
- fprintf(stderr, "REL:%d ", tex->dst_rel);
- fprintf(stderr, "SEL_X:%d ", tex->dst_sel_x);
- fprintf(stderr, "SEL_Y:%d ", tex->dst_sel_y);
- fprintf(stderr, "SEL_Z:%d ", tex->dst_sel_z);
- fprintf(stderr, "SEL_W:%d) ", tex->dst_sel_w);
- fprintf(stderr, "LOD_BIAS:%d ", tex->lod_bias);
- fprintf(stderr, "COORD_TYPE_X:%d ", tex->coord_type_x);
- fprintf(stderr, "COORD_TYPE_Y:%d ", tex->coord_type_y);
- fprintf(stderr, "COORD_TYPE_Z:%d ", tex->coord_type_z);
- fprintf(stderr, "COORD_TYPE_W:%d\n", tex->coord_type_w);
- id++;
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, "OFFSET_X:%d ", tex->offset_x);
- fprintf(stderr, "OFFSET_Y:%d ", tex->offset_y);
- fprintf(stderr, "OFFSET_Z:%d ", tex->offset_z);
- fprintf(stderr, "SAMPLER_ID:%d ", tex->sampler_id);
- fprintf(stderr, "SRC(SEL_X:%d ", tex->src_sel_x);
- fprintf(stderr, "SEL_Y:%d ", tex->src_sel_y);
- fprintf(stderr, "SEL_Z:%d ", tex->src_sel_z);
- fprintf(stderr, "SEL_W:%d)\n", tex->src_sel_w);
- id++;
- fprintf(stderr, "%04d %08X \n", id, bc->bytecode[id]);
- id++;
- }
-
- LIST_FOR_EACH_ENTRY(vtx, &cf->vtx, list) {
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, "INST: %s ", r600_isa_fetch(vtx->op)->name);
- fprintf(stderr, "FETCH_TYPE:%d ", vtx->fetch_type);
- fprintf(stderr, "BUFFER_ID:%d\n", vtx->buffer_id);
- id++;
- /* This assumes that no semantic fetches exist */
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, "SRC(GPR:%d ", vtx->src_gpr);
- fprintf(stderr, "SEL_X:%d) ", vtx->src_sel_x);
- if (bc->chip_class < CAYMAN)
- fprintf(stderr, "MEGA_FETCH_COUNT:%d ", vtx->mega_fetch_count);
- else
- fprintf(stderr, "SEL_Y:%d) ", 0);
- fprintf(stderr, "DST(GPR:%d ", vtx->dst_gpr);
- fprintf(stderr, "SEL_X:%d ", vtx->dst_sel_x);
- fprintf(stderr, "SEL_Y:%d ", vtx->dst_sel_y);
- fprintf(stderr, "SEL_Z:%d ", vtx->dst_sel_z);
- fprintf(stderr, "SEL_W:%d) ", vtx->dst_sel_w);
- fprintf(stderr, "USE_CONST_FIELDS:%d ", vtx->use_const_fields);
- fprintf(stderr, "FORMAT(DATA:%d ", vtx->data_format);
- fprintf(stderr, "NUM:%d ", vtx->num_format_all);
- fprintf(stderr, "COMP:%d ", vtx->format_comp_all);
- fprintf(stderr, "MODE:%d)\n", vtx->srf_mode_all);
- id++;
- fprintf(stderr, "%04d %08X ", id, bc->bytecode[id]);
- fprintf(stderr, "ENDIAN:%d ", vtx->endian);
- fprintf(stderr, "OFFSET:%d\n", vtx->offset);
- /* XXX */
- id++;
- fprintf(stderr, "%04d %08X \n", id, bc->bytecode[id]);
- id++;
- }
- }
-
- fprintf(stderr, "--------------------------------------\n");
-}
-
void r600_vertex_data_type(enum pipe_format pformat,
unsigned *format,
unsigned *num_format, unsigned *format_comp, unsigned *endian)