<p dir="ltr">Reviewed-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>></p>
<div class="gmail_extra"><br><div class="gmail_quote">On Jul 4, 2016 6:20 PM, "Samuel Pitoiset" <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">While we are at it, fix a typo inside the comment which describes<br>
what those constants are for.<br>
<br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
---<br>
.../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 98 +++++++++++-----------<br>
1 file changed, 49 insertions(+), 49 deletions(-)<br>
<br>
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp<br>
index 2ee423a..1184663 100644<br>
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp<br>
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp<br>
@@ -1516,31 +1516,31 @@ NVC0LoweringPass::loadMsInfo32(Value *ptr, uint32_t off)<br>
/* On nvc0, surface info is obtained via the surface binding points passed<br>
* to the SULD/SUST instructions.<br>
* On nve4, surface info is stored in c[] and is used by various special<br>
- * instructions, e.g. for clamping coordiantes or generating an address.<br>
+ * instructions, e.g. for clamping coordinates or generating an address.<br>
* They couldn't just have added an equivalent to TIC now, couldn't they ?<br>
*/<br>
-#define NVE4_SU_INFO_ADDR 0x00<br>
-#define NVE4_SU_INFO_FMT 0x04<br>
-#define NVE4_SU_INFO_DIM_X 0x08<br>
-#define NVE4_SU_INFO_PITCH 0x0c<br>
-#define NVE4_SU_INFO_DIM_Y 0x10<br>
-#define NVE4_SU_INFO_ARRAY 0x14<br>
-#define NVE4_SU_INFO_DIM_Z 0x18<br>
-#define NVE4_SU_INFO_UNK1C 0x1c<br>
-#define NVE4_SU_INFO_WIDTH 0x20<br>
-#define NVE4_SU_INFO_HEIGHT 0x24<br>
-#define NVE4_SU_INFO_DEPTH 0x28<br>
-#define NVE4_SU_INFO_TARGET 0x2c<br>
-#define NVE4_SU_INFO_BSIZE 0x30<br>
-#define NVE4_SU_INFO_RAW_X 0x34<br>
-#define NVE4_SU_INFO_MS_X 0x38<br>
-#define NVE4_SU_INFO_MS_Y 0x3c<br>
-<br>
-#define NVE4_SU_INFO__STRIDE 0x40<br>
-<br>
-#define NVE4_SU_INFO_DIM(i) (0x08 + (i) * 8)<br>
-#define NVE4_SU_INFO_SIZE(i) (0x20 + (i) * 4)<br>
-#define NVE4_SU_INFO_MS(i) (0x38 + (i) * 4)<br>
+#define NVC0_SU_INFO_ADDR 0x00<br>
+#define NVC0_SU_INFO_FMT 0x04<br>
+#define NVC0_SU_INFO_DIM_X 0x08<br>
+#define NVC0_SU_INFO_PITCH 0x0c<br>
+#define NVC0_SU_INFO_DIM_Y 0x10<br>
+#define NVC0_SU_INFO_ARRAY 0x14<br>
+#define NVC0_SU_INFO_DIM_Z 0x18<br>
+#define NVC0_SU_INFO_UNK1C 0x1c<br>
+#define NVC0_SU_INFO_WIDTH 0x20<br>
+#define NVC0_SU_INFO_HEIGHT 0x24<br>
+#define NVC0_SU_INFO_DEPTH 0x28<br>
+#define NVC0_SU_INFO_TARGET 0x2c<br>
+#define NVC0_SU_INFO_BSIZE 0x30<br>
+#define NVC0_SU_INFO_RAW_X 0x34<br>
+#define NVC0_SU_INFO_MS_X 0x38<br>
+#define NVC0_SU_INFO_MS_Y 0x3c<br>
+<br>
+#define NVC0_SU_INFO__STRIDE 0x40<br>
+<br>
+#define NVC0_SU_INFO_DIM(i) (0x08 + (i) * 8)<br>
+#define NVC0_SU_INFO_SIZE(i) (0x20 + (i) * 4)<br>
+#define NVC0_SU_INFO_MS(i) (0x38 + (i) * 4)<br>
<br>
static inline uint16_t getSuClampSubOp(const TexInstruction *su, int c)<br>
{<br>
@@ -1583,7 +1583,7 @@ NVC0LoweringPass::handleSUQ(TexInstruction *suq)<br>
ind, bld.mkImm(6));<br>
base = 0;<br>
} else {<br>
- base = suq->tex.r * NVE4_SU_INFO__STRIDE;<br>
+ base = suq->tex.r * NVC0_SU_INFO__STRIDE;<br>
}<br>
<br>
for (c = 0, d = 0; c < 3; ++c, mask >>= 1) {<br>
@@ -1593,9 +1593,9 @@ NVC0LoweringPass::handleSUQ(TexInstruction *suq)<br>
int offset;<br>
<br>
if (c == 1 && suq->tex.target == TEX_TARGET_1D_ARRAY) {<br>
- offset = NVE4_SU_INFO_SIZE(2);<br>
+ offset = NVC0_SU_INFO_SIZE(2);<br>
} else {<br>
- offset = NVE4_SU_INFO_SIZE(c);<br>
+ offset = NVC0_SU_INFO_SIZE(c);<br>
}<br>
bld.mkMov(suq->getDef(d++), loadSuInfo32(ind, base + offset));<br>
if (c == 2 && suq->tex.target.isCube())<br>
@@ -1605,8 +1605,8 @@ NVC0LoweringPass::handleSUQ(TexInstruction *suq)<br>
<br>
if (mask & 1) {<br>
if (suq->tex.target.isMS()) {<br>
- Value *ms_x = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(0));<br>
- Value *ms_y = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(1));<br>
+ Value *ms_x = loadSuInfo32(ind, base + NVC0_SU_INFO_MS(0));<br>
+ Value *ms_y = loadSuInfo32(ind, base + NVC0_SU_INFO_MS(1));<br>
Value *ms = bld.mkOp2v(OP_ADD, TYPE_U32, bld.getScratch(), ms_x, ms_y);<br>
bld.mkOp2(OP_SHL, TYPE_U32, suq->getDef(d++), bld.loadImm(NULL, 1), ms);<br>
} else {<br>
@@ -1648,11 +1648,11 @@ NVC0LoweringPass::adjustCoordinatesMS(TexInstruction *tex)<br>
ind, bld.mkImm(6));<br>
base = 0;<br>
} else {<br>
- base = tex->tex.r * NVE4_SU_INFO__STRIDE;<br>
+ base = tex->tex.r * NVC0_SU_INFO__STRIDE;<br>
}<br>
<br>
- Value *ms_x = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(0));<br>
- Value *ms_y = loadSuInfo32(ind, base + NVE4_SU_INFO_MS(1));<br>
+ Value *ms_x = loadSuInfo32(ind, base + NVC0_SU_INFO_MS(0));<br>
+ Value *ms_y = loadSuInfo32(ind, base + NVC0_SU_INFO_MS(1));<br>
<br>
bld.mkOp2(OP_SHL, TYPE_U32, tx, x, ms_x);<br>
bld.mkOp2(OP_SHL, TYPE_U32, ty, y, ms_y);<br>
@@ -1683,7 +1683,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
const int idx = su->tex.r;<br>
const int dim = su->tex.target.getDim();<br>
const int arg = dim + (su->tex.target.isArray() || su->tex.target.isCube());<br>
- uint16_t base = idx * NVE4_SU_INFO__STRIDE;<br>
+ uint16_t base = idx * NVC0_SU_INFO__STRIDE;<br>
int c;<br>
Value *zero = bld.mkImm(0);<br>
Value *p1 = NULL;<br>
@@ -1724,9 +1724,9 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
<br>
src[c] = bld.getScratch();<br>
if (c == 0 && raw)<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_RAW_X);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_RAW_X);<br>
else<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_DIM(dimc));<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_DIM(dimc));<br>
bld.mkOp3(OP_SUCLAMP, TYPE_S32, src[c], su->getSrc(c), v, zero)<br>
->subOp = getSuClampSubOp(su, dimc);<br>
}<br>
@@ -1748,16 +1748,16 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
bld.mkOp2(OP_AND, TYPE_U32, off, src[0], bld.loadImm(NULL, 0xffff));<br>
} else<br>
if (dim == 3) {<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_UNK1C);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_UNK1C);<br>
bld.mkOp3(OP_MADSP, TYPE_U32, off, src[2], v, src[1])<br>
->subOp = NV50_IR_SUBOP_MADSP(4,2,8); // u16l u16l u16l<br>
<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_PITCH);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_PITCH);<br>
bld.mkOp3(OP_MADSP, TYPE_U32, off, off, v, src[0])<br>
->subOp = NV50_IR_SUBOP_MADSP(0,2,8); // u32 u16l u16l<br>
} else {<br>
assert(dim == 2);<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_PITCH);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_PITCH);<br>
bld.mkOp3(OP_MADSP, TYPE_U32, off, src[1], v, src[0])<br>
->subOp = (su->tex.target.isArray() || su->tex.target.isCube()) ?<br>
NV50_IR_SUBOP_MADSP_SD : NV50_IR_SUBOP_MADSP(4,2,8); // u16l u16l u16l<br>
@@ -1768,7 +1768,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
if (raw) {<br>
bf = src[0];<br>
} else {<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_FMT);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_FMT);<br>
bld.mkOp3(OP_VSHL, TYPE_U32, bf, src[0], v, zero)<br>
->subOp = NV50_IR_SUBOP_V1(7,6,8|2);<br>
}<br>
@@ -1785,7 +1785,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
case 2:<br>
z = off;<br>
if (!su->tex.target.isArray() && !su->tex.target.isCube()) {<br>
- z = loadSuInfo32(ind, base + NVE4_SU_INFO_UNK1C);<br>
+ z = loadSuInfo32(ind, base + NVC0_SU_INFO_UNK1C);<br>
subOp = NV50_IR_SUBOP_SUBFM_3D;<br>
}<br>
break;<br>
@@ -1800,7 +1800,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
}<br>
<br>
// part 2<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_ADDR);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_ADDR);<br>
<br>
if (su->tex.target == TEX_TARGET_BUFFER) {<br>
eau = v;<br>
@@ -1809,7 +1809,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
}<br>
// add array layer offset<br>
if (su->tex.target.isArray() || su->tex.target.isCube()) {<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_ARRAY);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_ARRAY);<br>
if (dim == 1)<br>
bld.mkOp3(OP_MADSP, TYPE_U32, eau, src[1], v, eau)<br>
->subOp = NV50_IR_SUBOP_MADSP(4,0,0); // u16 u24 u32<br>
@@ -1849,7 +1849,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
<br>
// let's just set it 0 for raw access and hope it works<br>
v = raw ?<br>
- bld.mkImm(0) : loadSuInfo32(ind, base + NVE4_SU_INFO_FMT);<br>
+ bld.mkImm(0) : loadSuInfo32(ind, base + NVC0_SU_INFO_FMT);<br>
<br>
// get rid of old coordinate sources, make space for fmt info and predicate<br>
su->moveSources(arg, 3 - arg);<br>
@@ -1862,7 +1862,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
CmpInstruction *pred1 =<br>
bld.mkCmp(OP_SET, CC_EQ, TYPE_U32, bld.getSSA(1, FILE_PREDICATE),<br>
TYPE_U32, bld.mkImm(0),<br>
- loadSuInfo32(ind, base + NVE4_SU_INFO_ADDR));<br>
+ loadSuInfo32(ind, base + NVC0_SU_INFO_ADDR));<br>
<br>
if (su->op != OP_SUSTP && su->tex.format) {<br>
const TexInstruction::ImgFormatDesc *format = su->tex.format;<br>
@@ -1873,7 +1873,7 @@ NVC0LoweringPass::processSurfaceCoordsNVE4(TexInstruction *su)<br>
assert(format->components != 0);<br>
bld.mkCmp(OP_SET_OR, CC_NE, TYPE_U32, pred1->getDef(0),<br>
TYPE_U32, bld.loadImm(NULL, blockwidth / 8),<br>
- loadSuInfo32(ind, base + NVE4_SU_INFO_BSIZE),<br>
+ loadSuInfo32(ind, base + NVC0_SU_INFO_BSIZE),<br>
pred1->getDef(0));<br>
}<br>
su->setPredicate(CC_NOT_P, pred1->getDef(0));<br>
@@ -2048,7 +2048,7 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)<br>
const int idx = su->tex.r;<br>
const int dim = su->tex.target.getDim();<br>
const int arg = dim + (su->tex.target.isArray() || su->tex.target.isCube());<br>
- uint16_t base = idx * NVE4_SU_INFO__STRIDE;<br>
+ uint16_t base = idx * NVC0_SU_INFO__STRIDE;<br>
int c;<br>
Value *zero = bld.mkImm(0);<br>
Value *src[3];<br>
@@ -2078,13 +2078,13 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)<br>
<br>
// calculate pixel offset<br>
if (su->op == OP_SULDP || su->op == OP_SUREDP) {<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_BSIZE);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_BSIZE);<br>
su->setSrc(0, bld.mkOp2v(OP_MUL, TYPE_U32, bld.getSSA(), src[0], v));<br>
}<br>
<br>
// add array layer offset<br>
if (su->tex.target.isArray() || su->tex.target.isCube()) {<br>
- v = loadSuInfo32(ind, base + NVE4_SU_INFO_ARRAY);<br>
+ v = loadSuInfo32(ind, base + NVC0_SU_INFO_ARRAY);<br>
assert(dim > 1);<br>
su->setSrc(2, bld.mkOp2v(OP_MUL, TYPE_U32, bld.getSSA(), src[2], v));<br>
}<br>
@@ -2093,7 +2093,7 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)<br>
CmpInstruction *pred =<br>
bld.mkCmp(OP_SET, CC_EQ, TYPE_U32, bld.getSSA(1, FILE_PREDICATE),<br>
TYPE_U32, bld.mkImm(0),<br>
- loadSuInfo32(ind, base + NVE4_SU_INFO_ADDR));<br>
+ loadSuInfo32(ind, base + NVC0_SU_INFO_ADDR));<br>
if (su->op != OP_SUSTP && su->tex.format) {<br>
const TexInstruction::ImgFormatDesc *format = su->tex.format;<br>
int blockwidth = format->bits[0] + format->bits[1] +<br>
@@ -2103,7 +2103,7 @@ NVC0LoweringPass::processSurfaceCoordsNVC0(TexInstruction *su)<br>
// make sure that the format doesn't mismatch when it's not FMT_NONE<br>
bld.mkCmp(OP_SET_OR, CC_NE, TYPE_U32, pred->getDef(0),<br>
TYPE_U32, bld.loadImm(NULL, blockwidth / 8),<br>
- loadSuInfo32(ind, base + NVE4_SU_INFO_BSIZE),<br>
+ loadSuInfo32(ind, base + NVC0_SU_INFO_BSIZE),<br>
pred->getDef(0));<br>
}<br>
su->setPredicate(CC_NOT_P, pred->getDef(0));<br>
--<br>
2.9.0<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>