r600/asm: add support for other GDS operations.
authorDave Airlie <airlied@redhat.com>
Wed, 6 Apr 2016 23:36:26 +0000 (00:36 +0100)
committerDave Airlie <airlied@redhat.com>
Mon, 26 Jun 2017 06:27:51 +0000 (16:27 +1000)
This adds support for the GDS operations needed to do atomic
counters.

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 46683c1902053752ee5f74f05cc190abebd0fa43..6840cf6f18a32dfe391909b5e6f0a850f83ddc27 100644 (file)
@@ -196,7 +196,12 @@ int egcm_load_index_reg(struct r600_bytecode *bc, unsigned id, bool inside_alu_c
 
 int eg_bytecode_gds_build(struct r600_bytecode *bc, struct r600_bytecode_gds *gds, unsigned id)
 {
-       unsigned opcode = r600_isa_fetch_opcode(bc->isa->hw_class, gds->op) >> 8;
+       unsigned gds_op = (r600_isa_fetch_opcode(bc->isa->hw_class, gds->op) >> 8) & 0x3f;
+       unsigned opcode;
+       if (gds->op == FETCH_OP_TF_WRITE)
+               opcode = 5;
+       else
+               opcode = 4;
        bc->bytecode[id++] = S_SQ_MEM_GDS_WORD0_MEM_INST(2) |
                S_SQ_MEM_GDS_WORD0_MEM_OP(opcode) |
                S_SQ_MEM_GDS_WORD0_SRC_GPR(gds->src_gpr) |
@@ -207,8 +212,12 @@ int eg_bytecode_gds_build(struct r600_bytecode *bc, struct r600_bytecode_gds *gd
 
        bc->bytecode[id++] = S_SQ_MEM_GDS_WORD1_DST_GPR(gds->dst_gpr) |
                S_SQ_MEM_GDS_WORD1_DST_REL(gds->dst_rel) |
-               S_SQ_MEM_GDS_WORD1_GDS_OP(gds->gds_op) |
-               S_SQ_MEM_GDS_WORD1_SRC_GPR(gds->src_gpr2);
+               S_SQ_MEM_GDS_WORD1_GDS_OP(gds_op) |
+               S_SQ_MEM_GDS_WORD1_SRC_GPR(gds->src_gpr2) |
+               S_SQ_MEM_GDS_WORD1_UAV_INDEX_MODE(gds->uav_index_mode) |
+               S_SQ_MEM_GDS_WORD1_UAV_ID(gds->uav_id) |
+               S_SQ_MEM_GDS_WORD1_ALLOC_CONSUME(gds->alloc_consume) |
+               S_SQ_MEM_GDS_WORD1_BCAST_FIRST_REQ(gds->bcast_first_req);
 
        bc->bytecode[id++] = S_SQ_MEM_GDS_WORD2_DST_SEL_X(gds->dst_sel_x) |
                S_SQ_MEM_GDS_WORD2_DST_SEL_Y(gds->dst_sel_y) |
index 9db99158658f2cd47bcba1ec0b738b61a4a65450..9e00528c5c0181a57c4ea012ea64e210fdf0947b 100644 (file)
@@ -1470,6 +1470,11 @@ int r600_bytecode_add_gds(struct r600_bytecode *bc, const struct r600_bytecode_g
                return -ENOMEM;
        memcpy(ngds, gds, sizeof(struct r600_bytecode_gds));
 
+       if (bc->chip_class >= EVERGREEN) {
+               if (gds->uav_index_mode)
+                       egcm_load_index_reg(bc, gds->uav_index_mode - 1, false);
+       }
+
        if (bc->cf_last == NULL ||
            bc->cf_last->op != CF_OP_GDS ||
            bc->force_add_cf) {
@@ -2338,6 +2343,11 @@ void r600_bytecode_disasm(struct r600_bytecode *bc)
                        if (gds->op != FETCH_OP_TF_WRITE) {
                                o += fprintf(stderr, ", R%d.", gds->src_gpr2);
                        }
+                       if (gds->alloc_consume) {
+                               o += fprintf(stderr, " UAV: %d", gds->uav_id);
+                               if (gds->uav_index_mode)
+                                       o += fprintf(stderr, "[%s]", index_mode[gds->uav_index_mode]);
+                       }
                        fprintf(stderr, "\n");
                        id += 4;
                }
index 8992e0dfb221f1f6b79340d9f82d01d3c9dc4951..91fe260c577056613240ad50e5bcaab3c19b188f 100644 (file)
@@ -121,7 +121,6 @@ struct r600_bytecode_vtx {
 struct r600_bytecode_gds {
        struct list_head                list;
        unsigned                        op;
-       unsigned                        gds_op;
        unsigned                        src_gpr;
        unsigned                        src_rel;
        unsigned                        src_sel_x;
@@ -134,6 +133,10 @@ struct r600_bytecode_gds {
        unsigned                        dst_sel_y;
        unsigned                        dst_sel_z;
        unsigned                        dst_sel_w;
+       unsigned                        uav_index_mode;
+       unsigned                        uav_id;
+       unsigned                        alloc_consume;
+       unsigned                        bcast_first_req;
 };
 
 struct r600_bytecode_output {