[cairo-commit] cairo/pixman/src fbmmx.h, 1.1, 1.2 fbmmx.c, 1.2, 1.3 fbpict.c, 1.2, 1.3

Billy Biggs commit at pdx.freedesktop.org
Thu Aug 18 19:13:09 PDT 2005


Committed by: vektor

Update of /cvs/cairo/cairo/pixman/src
In directory gabe:/tmp/cvs-serv31565/src

Modified Files:
	fbmmx.h fbmmx.c fbpict.c 
Log Message:
	* src/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.

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

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



Index: fbmmx.h
===================================================================
RCS file: /cvs/cairo/cairo/pixman/src/fbmmx.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fbmmx.h	16 Aug 2005 23:50:25 -0000	1.1
+++ fbmmx.h	19 Aug 2005 02:13:06 -0000	1.2
@@ -198,6 +198,18 @@
 				    INT16       yDst,
 				    CARD16      width,
 				    CARD16      height);
+void fbCompositeSrc_8888x8888mmx (pixman_operator_t      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 (FbPixels	*pSrc,
 		    FbPixels	*pDst,
 		    int		src_x,

Index: fbmmx.c
===================================================================
RCS file: /cvs/cairo/cairo/pixman/src/fbmmx.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fbmmx.c	18 Aug 2005 13:01:46 -0000	1.2
+++ fbmmx.c	19 Aug 2005 02:13:06 -0000	1.3
@@ -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,56 @@
 }
 
 void
+fbCompositeSrc_8888x8888mmx (pixman_operator_t      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 (pixman_operator_t      op,
 				  PicturePtr pSrc,
 				  PicturePtr pMask,

Index: fbpict.c
===================================================================
RCS file: /cvs/cairo/cairo/pixman/src/fbpict.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- fbpict.c	18 Aug 2005 13:01:45 -0000	1.2
+++ fbpict.c	19 Aug 2005 02:13:07 -0000	1.3
@@ -1693,7 +1693,12 @@
 		    switch (pDst->format_code) {
 		    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;
@@ -1707,7 +1712,12 @@
 		    switch (pDst->format_code) {
 		    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 cairo-commit mailing list