[xserver-commit] xserver/fb fbblt.c,1.11,1.12 fbpict.c,1.25,1.26

Jaymz Julian xserver-commit@pdx.freedesktop.org
Sun, 21 Dec 2003 01:21:07 -0800


Committed by: jaymz

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

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

re-enable the fast simple case blitter, checking for bpp being a multiple
of 8 this time, so that it works in all cases now, not just when the
compiler decides to take a holiday :)



Index: fbblt.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbblt.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- fbblt.c	20 Dec 2003 15:06:11 -0000	1.11
+++ fbblt.c	21 Dec 2003 09:21:05 -0000	1.12
@@ -40,6 +40,7 @@
     } \
 }
 
+
 void
 fbBlt (FbBits   *srcLine,
        FbStride	srcStride,
@@ -66,6 +67,23 @@
     int	    n, nmiddle;
     Bool    destInvarient;
     int	    startbyte, endbyte;
+
+    if((pm==FB_ALLONES) && (alu==GXcopy) && !reverse && !upsidedown && ((bpp&7)==0))
+    {
+		CARD8 *isrc=(CARD8 *)srcLine;
+		CARD8 *idst=(CARD8 *)dstLine;
+		int sstride=srcStride*sizeof(FbBits);
+		int dstride=dstStride*sizeof(FbBits);
+		int j;
+		width>>=3;
+		isrc+=(srcX>>3);
+		idst+=(dstX>>3);
+		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.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- fbpict.c	21 Dec 2003 02:51:53 -0000	1.25
+++ fbpict.c	21 Dec 2003 09:21:05 -0000	1.26
@@ -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)!=0 || (dstStride&3)!=0)
+		if( (((xSrc*3)&3)!=((xDst*3)&3)) || ((srcStride&3)!=(dstStride&3)))
 		{
 			while (height--)
 			{
@@ -1283,32 +1283,40 @@
 {
     FbBits	*dst;
     FbBits	*src;
-    FbStride	dstStride, srcStride;
-    int		srcXoff, srcYoff;
-    int		dstXoff, dstYoff;
-    int		srcBpp;
-    int		dstBpp;
+	CARD8 *isrc;
+	CARD8 *idst;
+    int	dstStride, srcStride;
+    int	srcXoff, srcYoff;
+    int	dstXoff, dstYoff;
+    int	srcBpp;
+    int	dstBpp;
     // these need to be signed now!
-    int 	iwidth=width;
-    int 	iheight=height;
-    Bool	reverse = FALSE;
-    Bool	upsidedown = FALSE;
+    int	iwidth=width;
+    int	iheight=height;
+	int	bytesPerPixel;
 	int initialWidth=width;
 	int initialX=xDst;
 
-	// 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.
+	// FIXME: this is possibly the second worst piece of code I've ever written.
+	// (the worst being the previous imlementation of this)
 	//  -- 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)
 	{
@@ -1326,26 +1334,14 @@
 		while(iwidth>0)
 		{
 			int wwidth=iwidth;
+			int j;
 			if(wwidth>(srcWidth-xSrc))
 				wwidth=(srcWidth-xSrc);
 
-			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);
+			for(j=0;j<wheight;j++)
+				memcpy( idst + (yDst + j) * dstStride + ((xDst * bytesPerPixel)), 
+						isrc + (ySrc + j) * srcStride + ((xSrc * bytesPerPixel)), 
+						(wwidth*bytesPerPixel));
 			// reset the xSrc pointer.  D'oh.
 			xSrc=0;
 			if(!srcRepeat)
@@ -1356,8 +1352,8 @@
 				iwidth-=wwidth;
 			}
 		}
-		// reset the ySrc pointer.  D'oh.
 		ySrc=0;
+		// reset the ySrc pointer.  D'oh.
 		if(!srcRepeat)
 			iheight=0;
 		else