From: Samuel Pitoiset Date: Mon, 25 Jan 2016 20:43:13 +0000 (+0100) Subject: nv50/ir: add lock/unlock subops for load/store X-Git-Tag: upstream/17.1.0~12375 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0c930557bf96721ce50ca95b5201be09da905cb8;p=platform%2Fupstream%2Fmesa.git nv50/ir: add lock/unlock subops for load/store Signed-off-by: Samuel Pitoiset Reviewed-by: Ilia Mirkin --- diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h index 9d7becf..97ebed4 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h @@ -232,6 +232,8 @@ enum operation #define NV50_IR_SUBOP_SHFL_UP 1 #define NV50_IR_SUBOP_SHFL_DOWN 2 #define NV50_IR_SUBOP_SHFL_BFLY 3 +#define NV50_IR_SUBOP_LOAD_LOCKED 1 +#define NV50_IR_SUBOP_STORE_UNLOCKED 2 #define NV50_IR_SUBOP_MADSP_SD 0xffff // Yes, we could represent those with DataType. // Or put the type into operation and have a couple 1000 values in that enum. diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp index 650044d..a7c49a2 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_emit_nvc0.cpp @@ -1773,7 +1773,13 @@ CodeEmitterNVC0::emitSTORE(const Instruction *i) switch (i->src(0).getFile()) { case FILE_MEMORY_GLOBAL: opc = 0x90000000; break; case FILE_MEMORY_LOCAL: opc = 0xc8000000; break; - case FILE_MEMORY_SHARED: opc = 0xc9000000; break; + case FILE_MEMORY_SHARED: + opc = 0xc8000000; + if (i->subOp == NV50_IR_SUBOP_STORE_UNLOCKED) + opc |= (1 << 26); + else + opc |= (1 << 24); + break; default: assert(!"invalid memory file"); opc = 0; @@ -1804,7 +1810,13 @@ CodeEmitterNVC0::emitLOAD(const Instruction *i) switch (i->src(0).getFile()) { case FILE_MEMORY_GLOBAL: opc = 0x80000000; break; case FILE_MEMORY_LOCAL: opc = 0xc0000000; break; - case FILE_MEMORY_SHARED: opc = 0xc1000000; break; + case FILE_MEMORY_SHARED: + opc = 0xc0000000; + if (i->subOp == NV50_IR_SUBOP_LOAD_LOCKED) + opc |= (1 << 26); + else + opc |= (1 << 24); + break; case FILE_MEMORY_CONST: if (!i->src(0).isIndirect(0) && typeSizeof(i->dType) == 4) { emitMOV(i); // not sure if this is any better diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp index 47285a2..85f77047 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp @@ -198,6 +198,11 @@ static const char *atomSubOpStr[] = "add", "min", "max", "inc", "dec", "and", "or", "xor", "cas", "exch" }; +static const char *ldstSubOpStr[] = +{ + "", "lock", "unlock" +}; + static const char *DataTypeStr[] = { "-", @@ -537,6 +542,11 @@ void Instruction::print() const if (subOp < Elements(atomSubOpStr)) PRINT("%s ", atomSubOpStr[subOp]); break; + case OP_LOAD: + case OP_STORE: + if (subOp < Elements(ldstSubOpStr)) + PRINT("%s ", ldstSubOpStr[subOp]); + break; default: if (subOp) PRINT("(SUBOP:%u) ", subOp);