From 80a61bfb3dcf26271766e36aa31d454889ee43a5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Sun, 17 Jun 2007 22:57:47 -0400 Subject: [PATCH] Add new fbCompositeOver_x888x8x8888mmx() operation --- pixman/pixman-mmx.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++ pixman/pixman-mmx.h | 13 +++++++++++ pixman/pixman-pict.c | 7 +++++- 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 8025150..39efbba 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -2929,4 +2929,70 @@ fbCompositeCopyAreammx (pixman_op_t op, xSrc, ySrc, xDst, yDst, width, height); } +void +fbCompositeOver_x888x8x8888mmx (pixman_op_t op, + pixman_image_t * pSrc, + pixman_image_t * pMask, + pixman_image_t * pDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height) +{ + uint32_t *src, *srcLine; + uint32_t *dst, *dstLine; + uint8_t *mask, *maskLine; + int srcStride, maskStride, dstStride; + __m64 m; + uint32_t s, d; + uint16_t w; + + fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + + while (height--) + { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + + w = width; + + while (w--) + { + ullong m = *mask; + + if (m) + { + __m64 s = load8888 (*src); + + if (m == 0xff) + *dst = store8888 (s); + else + { + __m64 sa = expand_alpha (s); + __m64 vm = expand_alpha_rev ((__m64)m); + __m64 vdest = in_over(s, sa, vm, load8888 (*dst)); + } + } + + mask++; + dst++; + src++; + } + } + + _mm_empty(); +} + + + #endif /* USE_MMX */ diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h index c666f43..044e776 100644 --- a/pixman/pixman-mmx.h +++ b/pixman/pixman-mmx.h @@ -311,5 +311,18 @@ fbCompositeSolidFillmmx (pixman_op_t op, int16_t yDst, uint16_t width, uint16_t height); +void +fbCompositeOver_x888x8x8888mmx (pixman_op_t op, + pixman_image_t * pSrc, + pixman_image_t * pMask, + pixman_image_t * pDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height); #endif /* USE_MMX */ diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c index f2d5d0a..bd4c1f1 100644 --- a/pixman/pixman-pict.c +++ b/pixman/pixman-pict.c @@ -1470,7 +1470,12 @@ pixman_image_composite (pixman_op_t op, (pDst->bits.format == PIXMAN_a8r8g8b8 || pDst->bits.format == PIXMAN_x8r8g8b8)) { - func = fbCompositeOver_x888x8x8888; +#ifdef USE_MMX + if (pixman_have_mmx()) + func = fbCompositeOver_x888x8x8888mmx; + else +#endif + func = fbCompositeOver_x888x8x8888; } } } -- 2.7.4