[xserver-commit] xserver/fb fbblt.c,1.10,1.11 fbpict.c,1.23,1.24

Jaymz Julian xserver-commit@pdx.freedesktop.org
Sat, 20 Dec 2003 07:06:13 -0800


Committed by: jaymz

Update of /cvs/xserver/xserver/fb
In directory pdx:/tmp/cvs-serv24612/fb

Modified Files:
	fbblt.c fbpict.c 
Log Message:

... which caused a regression which only shows up in non-debug mode.  
rolled back until I work out wtf is going on with that.  ugh, computers...



Index: fbblt.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbblt.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- fbblt.c	20 Dec 2003 14:36:41 -0000	1.10
+++ fbblt.c	20 Dec 2003 15:06:11 -0000	1.11
@@ -40,7 +40,6 @@
     } \
 }
 
-
 void
 fbBlt (FbBits   *srcLine,
        FbStride	srcStride,
@@ -67,23 +66,6 @@
     int	    n, nmiddle;
     Bool    destInvarient;
     int	    startbyte, endbyte;
-
-    if((pm==FB_ALLONES) && (alu==GXcopy) && !reverse && !upsidedown)
-    {
-	CARD8 *isrc=(CARD8 *)srcLine;
-	CARD8 *idst=(CARD8 *)dstLine;
-	width>>=3;
-	int sstride=srcStride*sizeof(FbBits);
-	int dstride=dstStride*sizeof(FbBits);
-	isrc+=(srcX>>3);
-	idst+=(dstX>>3);
-	int j;
-	for(j=0;j<height;j++)
-		memcpy(idst+j*dstride, isrc+j*sstride, width);
-	
-	return;
-    }
-    
     FbDeclareMergeRop ();
 
 #ifdef FB_24BIT

Index: fbpict.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- fbpict.c	20 Dec 2003 14:36:41 -0000	1.23
+++ fbpict.c	20 Dec 2003 15:06:11 -0000	1.24
@@ -1131,7 +1131,7 @@
 
 		// are xSrc and xDst at the same alignment?  if not, we need to be complicated :)
 		//if(0==0)
-		if( (((xSrc*3)&3)!=((xDst*3)&3)) || ((srcStride&3)!=(dstStride&3)))
+		if( (((xSrc*3)&3)!=((xDst*3)&3)) || (srcStride&3)!=0 || (dstStride&3)!=0)
 		{
 			while (height--)
 			{
@@ -1283,40 +1283,32 @@
 {
     FbBits	*dst;
     FbBits	*src;
-	CARD8 *isrc;
-	CARD8 *idst;
-    int	dstStride, srcStride;
-    int	srcXoff, srcYoff;
-    int	dstXoff, dstYoff;
-    int	srcBpp;
-    int	dstBpp;
+    FbStride	dstStride, srcStride;
+    int		srcXoff, srcYoff;
+    int		dstXoff, dstYoff;
+    int		srcBpp;
+    int		dstBpp;
     // these need to be signed now!
-    int	iwidth=width;
-    int	iheight=height;
-	int	bytesPerPixel;
+    int 	iwidth=width;
+    int 	iheight=height;
+    Bool	reverse = FALSE;
+    Bool	upsidedown = FALSE;
 	int initialWidth=width;
 	int initialX=xDst;
 
-	// FIXME: this is possibly the second worst piece of code I've ever written.
-	// (the worst being the previous imlementation of this)
+	// FIXME: this is possibly the worst piece of code I've ever written.
+	// My main objection to it, is that it is incrfedibly slow in a few cases, due to the
+	// call-per-repeat structure of it - the *correct* solution is to implement
+	// repeat into fbBlt(), but that's a nontrivial job, and it's far more 
+	// important to get the "requireRepeat" stuff implented functionally
+	// first, *then* make it fast.
 	//  -- jj
-	
 	Bool srcRepeat=pSrc->repeat;
 	CARD32 srcHeight=pSrc->pDrawable->height;
 	CARD32 srcWidth=pSrc->pDrawable->width;
 
 	fbGetDrawable(pSrc->pDrawable,src,srcStride,srcBpp,srcXoff,srcYoff);
 	fbGetDrawable(pDst->pDrawable,dst,dstStride,dstBpp,dstXoff,dstYoff);
-	
-	src+=(srcXoff+(srcYoff*srcStride));
-	dst+=(dstXoff+(dstYoff*dstStride));
-	
-    isrc=(CARD8 *)src;
-	idst=(CARD8 *)dst;
-
-	bytesPerPixel=(srcBpp>>3);
-	srcStride*=sizeof(FbBits);
-	dstStride*=sizeof(FbBits);
 
 	if(srcRepeat)
 	{
@@ -1334,14 +1326,26 @@
 		while(iwidth>0)
 		{
 			int wwidth=iwidth;
-			int j;
 			if(wwidth>(srcWidth-xSrc))
 				wwidth=(srcWidth-xSrc);
 
-			for(j=0;j<wheight;j++)
-				memcpy( idst + (yDst + j) * dstStride + ((xDst * bytesPerPixel)), 
-						isrc + (ySrc + j) * srcStride + ((xSrc * bytesPerPixel)), 
-						(wwidth*bytesPerPixel));
+			fbBlt (src + (ySrc + srcYoff) * srcStride,
+					srcStride,
+					(xSrc + srcXoff) * srcBpp,
+
+					dst + (yDst + dstYoff) * dstStride,
+					dstStride,
+					(xDst + dstXoff) * dstBpp,
+
+					(wwidth) * dstBpp,
+					(wheight),
+
+					GXcopy,
+					FB_ALLONES,
+					dstBpp,
+
+					reverse,
+					upsidedown);
 			if(!srcRepeat)
 				iwidth=0;
 			else