From f3c6149c26079c50e5a45785c7314fa7fe32d40a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 31 Mar 2016 16:06:37 +1000 Subject: [PATCH] r600: add support for emitting RAT instructions to the assembler. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This adds support for emitting RAT instructions to the assembler. RAT instructions are used to implement image accessors. Reviewed-by: Nicolai Hähnle Signed-off-by: Dave Airlie --- 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 be927518556..ce7e861b739 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 a2c2ea74b3f..96bc3372785 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 7a11d454c4a..d7cb64f0b7d 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.30.2