[Mesa-dev] [PATCH 2/2] r600g/sb: use ISA info for RAT instructions

Vadim Girlin vadimgirlin at gmail.com
Sun May 26 15:15:22 PDT 2013


Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
---
 src/gallium/drivers/r600/sb/sb_bc.h           | 12 +++++++++++-
 src/gallium/drivers/r600/sb/sb_bc_builder.cpp |  2 +-
 src/gallium/drivers/r600/sb/sb_bc_decoder.cpp |  5 ++++-
 src/gallium/drivers/r600/sb/sb_bc_dump.cpp    | 13 +++++++++++--
 4 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/sb/sb_bc.h b/src/gallium/drivers/r600/sb/sb_bc.h
index 25255a7..9f546be 100644
--- a/src/gallium/drivers/r600/sb/sb_bc.h
+++ b/src/gallium/drivers/r600/sb/sb_bc.h
@@ -470,10 +470,16 @@ struct bc_cf {
 	unsigned comp_mask:4;
 
 	unsigned rat_id:4;
-	unsigned rat_inst:6;
 	unsigned rat_index_mode:2;
 
+	const rat_op_info *rat_op_ptr;
+	unsigned rat_op;
+
 	void set_op(unsigned op) { this->op = op; op_ptr = r600_isa_cf(op); }
+	void set_rat_op(unsigned op) {
+		this->rat_op = op;
+		rat_op_ptr = r600_isa_rat(op);
+	}
 
 	bool is_alu_extended() {
 		assert(op_ptr->flags & CF_ALU);
@@ -652,6 +658,10 @@ public:
 		return r600_isa_cf_opcode(isa->hw_class, op);
 	}
 
+	unsigned rat_opcode(unsigned op) {
+		return r600_isa_rat_opcode(isa->hw_class, op);
+	}
+
 	unsigned alu_opcode(unsigned op) {
 		return r600_isa_alu_opcode(isa->hw_class, op);
 	}
diff --git a/src/gallium/drivers/r600/sb/sb_bc_builder.cpp b/src/gallium/drivers/r600/sb/sb_bc_builder.cpp
index 55e2a85..4322f45 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_builder.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_builder.cpp
@@ -267,7 +267,7 @@ int bc_builder::build_cf_exp(cf_node* n) {
 				.INDEX_GPR(bc.index_gpr)
 				.RAT_ID(bc.rat_id)
 				.RAT_INDEX_MODE(bc.rat_index_mode)
-				.RAT_INST(bc.rat_inst)
+				.RAT_INST(ctx.rat_opcode(bc.rat_op))
 				.RW_GPR(bc.rw_gpr)
 				.RW_REL(bc.rw_rel)
 				.TYPE(bc.type);
diff --git a/src/gallium/drivers/r600/sb/sb_bc_decoder.cpp b/src/gallium/drivers/r600/sb/sb_bc_decoder.cpp
index 5e233f9..0f3c57a 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_decoder.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_decoder.cpp
@@ -242,13 +242,16 @@ int bc_decoder::decode_cf_mem(unsigned & i, bc_cf& bc) {
 	} else {
 		assert(ctx.is_egcm());
 		CF_ALLOC_EXPORT_WORD0_RAT_EGCM w0(dw0);
+		unsigned rat_opcode = w0.get_RAT_INST();
+
+		bc.set_rat_op(r600_isa_rat_by_opcode(ctx.isa, rat_opcode));
+
 		bc.elem_size = w0.get_ELEM_SIZE();
 		bc.index_gpr = w0.get_INDEX_GPR();
 		bc.rw_gpr = w0.get_RW_GPR();
 		bc.rw_rel = w0.get_RW_REL();
 		bc.type = w0.get_TYPE();
 		bc.rat_id = w0.get_RAT_ID();
-		bc.rat_inst = w0.get_RAT_INST();
 		bc.rat_index_mode = w0.get_RAT_INDEX_MODE();
 	}
 
diff --git a/src/gallium/drivers/r600/sb/sb_bc_dump.cpp b/src/gallium/drivers/r600/sb/sb_bc_dump.cpp
index 9d76465..152a33f 100644
--- a/src/gallium/drivers/r600/sb/sb_bc_dump.cpp
+++ b/src/gallium/drivers/r600/sb/sb_bc_dump.cpp
@@ -140,15 +140,24 @@ void bc_dump::dump(cf_node& n) {
 	} else if (n.bc.op_ptr->flags & (CF_STRM | CF_RAT)) {
 		static const char *exp_type[] = {"WRITE", "WRITE_IND", "WRITE_ACK",
 				"WRITE_IND_ACK"};
+
+		bool rat = (n.bc.op_ptr->flags & CF_RAT) != 0;
+
 		fill_to(s, 18);
 		s << " " << exp_type[n.bc.type] << " ";
+
+		if (rat) {
+			s << n.bc.rat_op_ptr->name << " ";
+		}
+
 		s.print_wl(n.bc.array_base, 5);
 		s << " R" << n.bc.rw_gpr << ".";
 		for (int k = 0; k < 4; ++k)
 			s << ((n.bc.comp_mask & (1 << k)) ? chans[k] : '_');
 
-		if ((n.bc.op_ptr->flags & CF_RAT) && (n.bc.type & 1)) {
-			s << ", @R" << n.bc.index_gpr << ".xyz";
+		if (rat) {
+			if (n.bc.type & 1)
+				s << ", @R" << n.bc.index_gpr << ".xyz";
 		}
 
 		s << "  ES:" << n.bc.elem_size;
-- 
1.8.2.1



More information about the mesa-dev mailing list