[Mesa-dev] [PATCH 4/5] r600: add support for emitting RAT instructions to the assembler.

Dave Airlie airlied at gmail.com
Tue Oct 31 23:32:52 UTC 2017


From: Dave Airlie <airlied at redhat.com>

This adds support for emitting RAT instructions to the assembler.
RAT instructions are used to implement image accessors.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/gallium/drivers/r600/eg_asm.c   | 19 +++++++++++++++++++
 src/gallium/drivers/r600/r600_asm.c |  9 +++++++++
 src/gallium/drivers/r600/r600_asm.h |  7 +++++++
 3 files changed, 35 insertions(+)

diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c
index be92751..ce7e861 100644
--- a/src/gallium/drivers/r600/eg_asm.c
+++ b/src/gallium/drivers/r600/eg_asm.c
@@ -95,6 +95,25 @@ int eg_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf)
 			if (bc->chip_class == EVERGREEN) /* no EOP on cayman */
 				bc->bytecode[id] |= S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf->end_of_program);
 			id++;
+		} else if (cfop->flags & CF_RAT) {
+			bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_ID(cf->rat.id) |
+					S_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INST(cf->rat.inst) |
+					S_SQ_CF_ALLOC_EXPORT_WORD0_RAT_RAT_INDEX_MODE(cf->rat.index_mode) |
+					S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
+					S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf->output.elem_size) |
+					S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type) |
+					S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(cf->output.index_gpr);
+			bc->bytecode[id] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) |
+					S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf->barrier) |
+					S_SQ_CF_ALLOC_EXPORT_WORD1_MARK(cf->mark) |
+			                S_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(cf->vpm) |
+					S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(opcode) |
+					S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(cf->output.comp_mask) |
+					S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(cf->output.array_size);
+			if (bc->chip_class == EVERGREEN) /* no EOP on cayman */
+				bc->bytecode[id] |= S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf->end_of_program);
+			id++;
+
 		} else if (cfop->flags & CF_MEM) {
 			/* MEM_STREAM, MEM_RING instructions */
 			bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index a2c2ea7..96bc337 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -2140,6 +2140,15 @@ void r600_bytecode_disasm(struct r600_bytecode *bc)
 						bc->bytecode[id], bc->bytecode[id + 1], cfop->name);
 				o += print_indent(o, 43);
 				o += fprintf(stderr, "%s ", exp_type[cf->output.type]);
+
+				if (r600_isa_cf(cf->op)->flags & CF_RAT) {
+					o += fprintf(stderr, "RAT%d", cf->rat.id);
+					if (cf->rat.index_mode) {
+						o += fprintf(stderr, "[IDX%d]", cf->rat.index_mode - 1);
+					}
+					o += fprintf(stderr, " INST: %d ", cf->rat.inst);
+				}
+
 				if (cf->output.burst_count > 1) {
 					o += fprintf(stderr, "%d-%d ", cf->output.array_base,
 							cf->output.array_base + cf->output.burst_count - 1);
diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h
index 7a11d45..d7cb64f 100644
--- a/src/gallium/drivers/r600/r600_asm.h
+++ b/src/gallium/drivers/r600/r600_asm.h
@@ -157,6 +157,12 @@ struct r600_bytecode_output {
 	unsigned			index_gpr;
 };
 
+struct r600_bytecode_rat {
+	unsigned			id;
+	unsigned			inst;
+	unsigned			index_mode;
+};
+
 struct r600_bytecode_kcache {
 	unsigned			bank;
 	unsigned			mode;
@@ -187,6 +193,7 @@ struct r600_bytecode_cf {
 	struct list_head		vtx;
 	struct list_head		gds;
 	struct r600_bytecode_output		output;
+	struct r600_bytecode_rat		rat;
 	struct r600_bytecode_alu		*curr_bs_head;
 	struct r600_bytecode_alu		*prev_bs_head;
 	struct r600_bytecode_alu		*prev2_bs_head;
-- 
2.9.5



More information about the mesa-dev mailing list