From 27380d6b3e5c07948a911470c407cdc1b58dbf93 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 7 Apr 2016 00:36:26 +0100 Subject: [PATCH] r600/asm: add support for other GDS operations. This adds support for the GDS operations needed to do atomic counters. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/eg_asm.c | 15 ++++++++++++--- src/gallium/drivers/r600/r600_asm.c | 10 ++++++++++ src/gallium/drivers/r600/r600_asm.h | 5 ++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c index 46683c19020..6840cf6f18a 100644 --- a/src/gallium/drivers/r600/eg_asm.c +++ b/src/gallium/drivers/r600/eg_asm.c @@ -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) | diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 9db99158658..9e00528c5c0 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -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; } diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index 8992e0dfb22..91fe260c577 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -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 { -- 2.30.2