Patches to fix assumption in fbEvenTile

James Jones jajones at nvidia.com
Mon Jun 11 15:18:33 PDT 2007


fbEvenTile assumes the tileStride is 1.  This isn't necessarily the 
case, so I created two possible fixes, attached here.  The first 
just avoids calling fbEvenTile if tileStride is not 1.  The second 
actually updates fbEvenTile to handle this case.  Could one of 
these be applied?  I prefer the second, slightly larger fix, but it 
does require changing the function prototype.

Thanks,
-James

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
---
 fb/fbtile.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fb/fbtile.c b/fb/fbtile.c
index e7df1af..6666f92 100644
--- a/fb/fbtile.c
+++ b/fb/fbtile.c
@@ -192,7 +192,7 @@ fbTile (FbBits	    *dst,
 	int	    xRot,
 	int	    yRot)
 {
-    if (FbEvenTile (tileWidth))
+    if (FbEvenTile (tileWidth) && (tileStride == 1))
 	fbEvenTile (dst, dstStride, dstX, width, height, 
 		    tile, tileHeight,
 		    alu, pm, xRot, yRot);
-- 
1.4.2.4

-------------- next part --------------
---
 fb/fb.h     |    1 +
 fb/fbtile.c |   12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/fb/fb.h b/fb/fb.h
index 655d5ae..03e9b20 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -2032,6 +2032,7 @@ fbEvenTile (FbBits	*dst,
 	    int		height,
 
 	    FbBits	*tile,
+	    int		tileStride,
 	    int		tileHeight,
 
 	    int		alu,
diff --git a/fb/fbtile.c b/fb/fbtile.c
index e7df1af..5a77822 100644
--- a/fb/fbtile.c
+++ b/fb/fbtile.c
@@ -42,6 +42,7 @@ fbEvenTile (FbBits	*dst,
 	    int		height,
 
 	    FbBits	*tile,
+	    int		tileStride,
 	    int		tileHeight,
 
 	    int		alu,
@@ -68,9 +69,9 @@ fbEvenTile (FbBits	*dst,
     /*
      * Compute tile start scanline and rotation parameters
      */
-    tileEnd = tile + tileHeight;
+    tileEnd = tile + (tileHeight * tileStride);
     modulus (- yRot, tileHeight, tileY);
-    t = tile + tileY;
+    t = tile + (tileY * tileStride);
     modulus (- xRot, FB_UNIT, tileX);
     rot = tileX;
     
@@ -80,8 +81,9 @@ fbEvenTile (FbBits	*dst,
 	/*
 	 * Pick up bits for this scanline
 	 */
-	bits = READ(t++);
-	if (t == tileEnd) t = tile;
+	bits = READ(t);
+	t += tileStride;
+	if (t >= tileEnd) t = tile;
 	bits = FbRotLeft(bits,rot);
 	and = fbAnd(alu,bits,pm);
 	xor = fbXor(alu,bits,pm);
@@ -194,7 +196,7 @@ fbTile (FbBits	    *dst,
 {
     if (FbEvenTile (tileWidth))
 	fbEvenTile (dst, dstStride, dstX, width, height, 
-		    tile, tileHeight,
+		    tile, tileStride, tileHeight,
 		    alu, pm, xRot, yRot);
     else
 	fbOddTile (dst, dstStride, dstX, width, height, 
-- 
1.4.2.4



More information about the xorg mailing list