xserver/fb fbmmx.h,1.3,1.4 fbmmx.c,1.11,1.12 fbpict.c,1.40,1.41

Billy Biggs xserver-commit at pdx.freedesktop.org
Fri Aug 19 12:08:30 EST 2005


Committed by: vektor

Update of /cvs/xserver/xserver/fb
In directory gabe:/tmp/cvs-serv30966/fb

Modified Files:
	fbmmx.h fbmmx.c fbpict.c 
Log Message:
	* fb/fbmmx.c: (mmxCombineMaskU), (mmxCombineOverU): Special case
	alpha values of 0 and 0xff.
	(fbCompositeSrc_8888x8888mmx): Add an MMX implementation for
	a common operation when using pixman.

	* fb/fbmmx.h: Prototype for the new function.

	* fb/fbpict.c: (fbComposite): Call the new function where
	appropriate.



Index: fbmmx.h
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbmmx.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- fbmmx.h	4 Aug 2005 21:47:30 -0000	1.3
+++ fbmmx.h	19 Aug 2005 02:08:28 -0000	1.4
@@ -198,6 +198,18 @@
 				    INT16       yDst,
 				    CARD16      width,
 				    CARD16      height);
+void fbCompositeSrc_8888x8888mmx (CARD8      op,
+				  PicturePtr pSrc,
+				  PicturePtr pMask,
+				  PicturePtr pDst,
+				  INT16      xSrc,
+				  INT16      ySrc,
+				  INT16      xMask,
+				  INT16      yMask,
+				  INT16      xDst,
+				  INT16      yDst,
+				  CARD16     width,
+				  CARD16     height);
 Bool fbCopyAreammx (DrawablePtr	pSrc,
 		    DrawablePtr	pDst,
 		    int		src_x,

Index: fbmmx.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbmmx.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- fbmmx.c	18 Aug 2005 12:59:24 -0000	1.11
+++ fbmmx.c	19 Aug 2005 02:08:28 -0000	1.12
@@ -374,11 +374,17 @@
 {
     const CARD32 *end = mask + width;
     while (mask < end) {
-        __m64 a = load8888(*mask);
-        __m64 s = load8888(*src);
-        a = expand_alpha(a);
-        s = pix_multiply(s, a);
-        *src = store8888(s);
+	CARD32 mmask = *mask;
+	CARD32 maska = mmask >> 24;
+	if (maska == 0) {
+	    *src = 0;
+	} else if (maska != 0xff) {
+	    __m64 a = load8888(mmask);
+	    __m64 s = load8888(*src);
+	    a = expand_alpha(a);
+	    s = pix_multiply(s, a);
+	    *src = store8888(s);
+	}
         ++src;
         ++mask;
     }
@@ -392,10 +398,16 @@
     const CARD32 *end = dest + width;
 
     while (dest < end) {
-        __m64 s, sa;
-	s = load8888(*src);
-	sa = expand_alpha(s);
-	*dest = store8888(over(s, sa, load8888(*dest)));
+	CARD32 ssrc = *src;
+	CARD32 a = ssrc >> 24;
+	if (a == 0xff) {
+	    *dest = ssrc;
+	} else if (a) {
+	    __m64 s, sa;
+	    s = load8888(ssrc);
+	    sa = expand_alpha(s);
+	    *dest = store8888(over(s, sa, load8888(*dest)));
+	}
         ++dest;
         ++src;
     }
@@ -1339,6 +1351,55 @@
 }
 
 void
+fbCompositeSrc_8888x8888mmx (CARD8      op,
+			     PicturePtr pSrc,
+			     PicturePtr pMask,
+			     PicturePtr pDst,
+			     INT16      xSrc,
+			     INT16      ySrc,
+			     INT16      xMask,
+			     INT16      yMask,
+			     INT16      xDst,
+			     INT16      yDst,
+			     CARD16     width,
+			     CARD16     height)
+{
+    CARD32	*dstLine, *dst;
+    CARD32	*srcLine, *src, s;
+    FbStride	dstStride, srcStride;
+    CARD8	a;
+    CARD16	w;
+
+    fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1);
+    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
+
+    while (height--)
+    {
+	dst = dstLine;
+	dstLine += dstStride;
+	src = srcLine;
+	srcLine += srcStride;
+	w = width;
+
+	while (w--)
+	{
+	    s = *src++;
+	    a = s >> 24;
+	    if (a == 0xff)
+		*dst = s;
+	    else if (a) {
+		__m64 ms, sa;
+		ms = load8888(s);
+		sa = expand_alpha(ms);
+		*dst = store8888(over(ms, sa, load8888(*dst)));
+	    }
+	    dst++;
+	}
+    }
+    _mm_empty();
+}
+
+void
 fbCompositeSolidMask_nx8x8888mmx (CARD8      op,
 				  PicturePtr pSrc,
 				  PicturePtr pMask,

Index: fbpict.c
===================================================================
RCS file: /cvs/xserver/xserver/fb/fbpict.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- fbpict.c	16 Aug 2005 23:34:18 -0000	1.40
+++ fbpict.c	19 Aug 2005 02:08:28 -0000	1.41
@@ -1688,7 +1688,12 @@
 		    switch (pDst->format) {
 		    case PICT_a8r8g8b8:
 		    case PICT_x8r8g8b8:
-			func = fbCompositeSrc_8888x8888;
+#ifdef USE_MMX
+			if (fbHaveMMX())
+			    func = fbCompositeSrc_8888x8888mmx;
+			else
+#endif
+			    func = fbCompositeSrc_8888x8888;
 			break;
 		    case PICT_r8g8b8:
 			func = fbCompositeSrc_8888x0888;
@@ -1702,7 +1707,12 @@
 		    switch (pDst->format) {
 		    case PICT_a8b8g8r8:
 		    case PICT_x8b8g8r8:
-			func = fbCompositeSrc_8888x8888;
+#ifdef USE_MMX
+			if (fbHaveMMX())
+			    func = fbCompositeSrc_8888x8888mmx;
+			else
+#endif
+			    func = fbCompositeSrc_8888x8888;
 			break;
 		    case PICT_b8g8r8:
 			func = fbCompositeSrc_8888x0888;



More information about the xserver-commit mailing list