xserver/hw/kdrive/mach64 mach64draw.c,1.17,1.18

Keith Packard xserver-commit at pdx.freedesktop.org
Thu May 20 12:51:46 PDT 2004


Committed by: keithp

Update of /cvs/xserver/xserver/hw/kdrive/mach64
In directory pdx:/tmp/cvs-serv31483/hw/kdrive/mach64

Modified Files:
	mach64draw.c 
Log Message:
2004-05-20  Keith Packard  <keithp at keithp.com>

	* hw/kdrive/mach64/mach64draw.c: (mach64Setup):
	Miscomputing pitch in 24bpp modes because of rounding errors.


Index: mach64draw.c
===================================================================
RCS file: /cvs/xserver/xserver/hw/kdrive/mach64/mach64draw.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- a/mach64draw.c	20 May 2004 05:27:03 -0000	1.17
+++ b/mach64draw.c	20 May 2004 19:51:44 -0000	1.18
@@ -350,7 +350,6 @@
     CARD32  DP_SET_GUI_ENGINE;
     int	    i;
 
-    KdCheckSync (pScreen);
     for (i = 0; i < NACCELREG; i++)
 	if (mach64AccelReg[i].depth == pDst->drawable.depth &&
 	    mach64AccelReg[i].bitsPerPixel == pDst->drawable.bitsPerPixel)
@@ -361,14 +360,22 @@
     DP_SET_GUI_ENGINE = mach64AccelReg[i].DP_SET_GUI_ENGINE;
 
     reg = mach64c->reg;
-    triple = (pDst->drawable.bitsPerPixel == 24);
     if (!reg)
 	return FALSE;
     
-    /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
-    DST_PITCH = pDst->devKind / pDst->drawable.bitsPerPixel;
+    triple = (pDst->drawable.bitsPerPixel == 24);
+    
     if (triple)
-	DST_PITCH *= 3;
+    {
+	/* bytes / 8 = bytes >> 3 */
+	DST_PITCH = pDst->devKind >> 3;
+    }
+    else
+    {
+	/* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
+	DST_PITCH = pDst->devKind / pDst->drawable.bitsPerPixel;
+    }
+    
     /* bytes / 8 */
     DST_OFFSET = ((CARD8 *) pDst->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3;
     
@@ -380,10 +387,15 @@
 			  0);
     if (pSrc)
     {
-	/* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
-	SRC_PITCH = pSrc->devKind / pSrc->drawable.bitsPerPixel;
 	if (triple)
-	    SRC_PITCH *= 3;
+	{
+	    SRC_PITCH = pSrc->devKind >> 3;
+	}
+        else
+	{
+	    /* pixels / 8 = ((bytes * 8) / bpp) / 8 = bytes / bpp */
+	    SRC_PITCH = pSrc->devKind / pSrc->drawable.bitsPerPixel;
+	}
 	/* bytes / 8 */
 	SRC_OFFSET = ((CARD8 *) pSrc->devPrivate.ptr - pScreenPriv->screen->memory_base) >> 3;
 	




More information about the xserver-commit mailing list