[cairo-commit] pixman/src

Carl Worth cworth at kemper.freedesktop.org
Wed Jan 17 13:04:58 PST 2007


 pixman/src/fbmmx.c        |  122 ++++++++++++++++++++++++++++++++++++++++++++++
 pixman/src/fbmmx.h        |   13 ++++
 pixman/src/fbpict.c       |   14 ++++-
 pixman/src/pixman-remap.h |    1 
 4 files changed, 148 insertions(+), 2 deletions(-)

New commits:
diff-tree 5c2136ea7c3aea1ae90b46b0dd645a4e1b5cc9a1 (from a2ec383ff128617d33efa5760ec4b5f9688e8a13)
Author: Dan Williams <dcbw at redhat.com>
Date:   Wed Jan 17 15:47:24 2007 -0500

    Implement pixman fbCompositeSrc_8888x0565mmx
    
    MMX-accelerate for fbCompositeSrc_8888x0565.  Upstream X bug for the
    same issue:
    
    http://bugs.freedesktop.org/show_bug.cgi?id=9682

diff --git a/pixman/src/fbmmx.c b/pixman/src/fbmmx.c
index f6f512f..aa18019 100644
--- a/pixman/src/fbmmx.c
+++ b/pixman/src/fbmmx.c
@@ -1444,6 +1444,128 @@ fbCompositeSrc_8888x8888mmx (pixman_oper
 }
 
 void
+fbCompositeSrc_8888x0565mmx (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)
+{
+    CARD16	*dstLine, *dst;
+    CARD32	*srcLine, *src;
+    FbStride	dstStride, srcStride;
+    CARD16	w;
+
+    CHECKPOINT();
+
+    fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1);
+    fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1);
+
+    assert (pSrc->pDrawable == pMask->pDrawable);
+
+    while (height--)
+    {
+	dst = dstLine;
+	dstLine += dstStride;
+	src = srcLine;
+	srcLine += srcStride;
+	w = width;
+
+	CHECKPOINT();
+
+	while (w && (unsigned long)dst & 7)
+	{
+	    __m64 vsrc = load8888 (*src);
+	    ullong d = *dst;
+	    __m64 vdest = expand565 ((__m64)d, 0);
+
+	    vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0);
+
+	    *dst = (ullong)vdest;
+
+	    w--;
+	    dst++;
+	    src++;
+	}
+
+	CHECKPOINT();
+
+	while (w >= 4)
+	{
+	    CARD32 s0, s1, s2, s3;
+	    unsigned char a0, a1, a2, a3;
+	    __m64 vsrc0, vsrc1, vsrc2, vsrc3;
+
+	    s0 = *src;
+	    s1 = *(src + 1);
+	    s2 = *(src + 2);
+	    s3 = *(src + 3);
+
+	    a0 = (s0 >> 24);
+	    a1 = (s1 >> 24);
+	    a2 = (s2 >> 24);
+	    a3 = (s3 >> 24);
+
+	    vsrc0 = load8888(s0);
+	    vsrc1 = load8888(s1);
+	    vsrc2 = load8888(s2);
+	    vsrc3 = load8888(s3);
+
+	    if ((a0 & a1 & a2 & a3) == 0xFF)
+	    {
+		__m64 vdest;
+		vdest = pack565(vsrc0, _mm_setzero_si64(), 0);
+		vdest = pack565(vsrc1, vdest, 1);
+		vdest = pack565(vsrc2, vdest, 2);
+		vdest = pack565(vsrc3, vdest, 3);
+
+		*(__m64 *)dst = vdest;
+	    }
+	    else if (a0 | a1 | a2 | a3)
+	    {
+		__m64 vdest = *(__m64 *)dst;
+
+		vdest = pack565(over(vsrc0, expand_alpha(vsrc0), expand565(vdest, 0)), vdest, 0);
+	        vdest = pack565(over(vsrc1, expand_alpha(vsrc1), expand565(vdest, 1)), vdest, 1);
+		vdest = pack565(over(vsrc2, expand_alpha(vsrc2), expand565(vdest, 2)), vdest, 2);
+		vdest = pack565(over(vsrc3, expand_alpha(vsrc3), expand565(vdest, 3)), vdest, 3);
+
+		*(__m64 *)dst = vdest;
+	    }
+
+	    w -= 4;
+	    dst += 4;
+	    src += 4;
+	}
+
+	CHECKPOINT();
+
+	while (w)
+	{
+	    __m64 vsrc = load8888 (*src);
+	    ullong d = *dst;
+	    __m64 vdest = expand565 ((__m64)d, 0);
+
+	    vdest = pack565(over(vsrc, expand_alpha(vsrc), vdest), vdest, 0);
+
+	    *dst = (ullong)vdest;
+
+	    w--;
+	    dst++;
+	    src++;
+	}
+    }
+
+    _mm_empty();
+}
+
+void
 fbCompositeSolidMask_nx8x8888mmx (pixman_operator_t      op,
 				  PicturePtr pSrc,
 				  PicturePtr pMask,
diff --git a/pixman/src/fbmmx.h b/pixman/src/fbmmx.h
index 5c08180..054ac0b 100644
--- a/pixman/src/fbmmx.h
+++ b/pixman/src/fbmmx.h
@@ -179,6 +179,19 @@ void fbCompositeSrc_8888RevNPx8888mmx (p
 				       CARD16     width,
 				       CARD16     height);
 pixman_private
+void fbCompositeSrc_8888x0565mmx (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);
+pixman_private
 void fbCompositeSrc_8888RevNPx0565mmx (pixman_operator_t      op,
 				       PicturePtr pSrc,
 				       PicturePtr pMask,
diff --git a/pixman/src/fbpict.c b/pixman/src/fbpict.c
index 2019cbc..63b1cbc 100644
--- a/pixman/src/fbpict.c
+++ b/pixman/src/fbpict.c
@@ -1735,7 +1735,12 @@ pixman_composite (pixman_operator_t	op,
 			func = fbCompositeSrc_8888x0888;
 			break;
 		    case PICT_r5g6b5:
-			func = fbCompositeSrc_8888x0565;
+#ifdef USE_MMX
+			if (fbHaveMMX())
+			    func = fbCompositeSrc_8888x0565mmx;
+			else
+#endif
+			    func = fbCompositeSrc_8888x0565;
 			break;
 		    }
 		    break;
@@ -1754,7 +1759,12 @@ pixman_composite (pixman_operator_t	op,
 			func = fbCompositeSrc_8888x0888;
 			break;
 		    case PICT_b5g6r5:
-			func = fbCompositeSrc_8888x0565;
+#ifdef USE_MMX
+			if (fbHaveMMX())
+			    func = fbCompositeSrc_8888x0565mmx;
+			else
+#endif
+			    func = fbCompositeSrc_8888x0565;
 			break;
 		    }
 		    break;
diff --git a/pixman/src/pixman-remap.h b/pixman/src/pixman-remap.h
index 45a4477..290df32 100644
--- a/pixman/src/pixman-remap.h
+++ b/pixman/src/pixman-remap.h
@@ -13,6 +13,7 @@
 #define fbCompositeSolid_nx8888mmx _cairo_pixman_composite_solid_nx8888mmx
 #define fbCompositeSrc_8888RevNPx0565mmx _cairo_pixman_composite_src_8888RevNPx0565mmx
 #define fbCompositeSrc_8888RevNPx8888mmx _cairo_pixman_composite_src_8888RevNPx8888_mmx
+#define fbCompositeSrc_8888x0565mmx _cairo_pixman_composite_src_8888x0565mmx
 #define fbCompositeSrc_8888x8888mmx _cairo_pixman_composite_src_8888x8888mmx
 #define fbCompositeSrc_8888x8x8888mmx _cairo_pixman_composite_src_8888x8x8888mmx
 #define fbCompositeSrcAdd_8000x8000mmx _cairo_pixman_composite_src_add_8000x8000mmx


More information about the cairo-commit mailing list