r600: add support for emitting RAT instructions to the assembler.
authorDave Airlie <airlied@redhat.com>
Thu, 31 Mar 2016 06:06:37 +0000 (16:06 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 2 Nov 2017 23:33:33 +0000 (09:33 +1000)
This adds support for emitting RAT instructions to the assembler.
RAT instructions are used to implement image accessors.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/eg_asm.c
src/gallium/drivers/r600/r600_asm.c
src/gallium/drivers/r600/r600_asm.h

index be9275185567047ee98d0c088da98e89efc7b56e..ce7e861b7394d18c71a5bd251e24cb0657c4426e 100644 (file)
@@ -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) |
index a2c2ea74b3f1095655cda7190e98eed5042067d6..96bc33727857b144ed112921e7d2067e2b2361b2 100644 (file)
@@ -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);
index 7a11d454c4a8d93dc37f859c3722eaab3001b9bb..d7cb64f0b7d8bb93573fdeb0611be74826daf5ef 100644 (file)
@@ -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;