From 105d398c4d061eb102747f824e6c04ab897cb5e1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Mon, 11 Jun 2007 14:41:01 -0400 Subject: [PATCH] Add pixman_blt_mmx() based on fbBltmmx() from the X server. Implement fbCompositeAreammx() in terms of it. Uncomment calls to fbCompositeAreammx() in pixman-pict.c Add public pixman_blt() that just returns false if not using mmx. --- pixman/pixman-mmx.c | 69 ++++++++++++++++++--------------------------------- pixman/pixman-mmx.h | 1 + pixman/pixman-pict.c | 25 +++---------------- pixman/pixman-utils.c | 19 ++++++++++++++ pixman/pixman.h | 12 +++++++++ 5 files changed, 60 insertions(+), 66 deletions(-) diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 7645d2e..097b021 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -2726,38 +2726,21 @@ fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op, _mm_empty(); } -#if 0 -/* FIXME */ - -Bool -fbCopyAreammx (DrawablePtr pSrc, - DrawablePtr pDst, - int src_x, - int src_y, - int dst_x, - int dst_y, - int width, - int height) -{ - uint32_t * src_bits; - int src_stride; - int src_bpp; - int src_xoff; - int src_yoff; - - uint32_t * dst_bits; - int dst_stride; - int dst_bpp; - int dst_xoff; - int dst_yoff; - +pixman_bool_t +pixman_blt_mmx (uint32_t *src_bits, + uint32_t *dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, int src_y, + int dst_x, int dst_y, + int width, int height) +{ uint8_t * src_bytes; uint8_t * dst_bytes; int byte_width; - fbGetDrawable(pSrc, src_bits, src_stride, src_bpp, src_xoff, src_yoff); - fbGetDrawable(pDst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff); - if (src_bpp != dst_bpp) return FALSE; @@ -2765,16 +2748,16 @@ fbCopyAreammx (DrawablePtr pSrc, { src_stride = src_stride * sizeof (uint32_t) / 2; dst_stride = dst_stride * sizeof (uint32_t) / 2; - src_bytes = (uint8_t *)(((uint16_t *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff)); - dst_bytes = (uint8_t *)(((uint16_t *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff)); + src_bytes = (uint8_t *)(((uint16_t *)src_bits) + src_stride * (src_y) + (src_x)); + dst_bytes = (uint8_t *)(((uint16_t *)dst_bits) + dst_stride * (dst_y) + (dst_x)); byte_width = 2 * width; src_stride *= 2; dst_stride *= 2; } else if (src_bpp == 32) { src_stride = src_stride * sizeof (uint32_t) / 4; dst_stride = dst_stride * sizeof (uint32_t) / 4; - src_bytes = (uint8_t *)(((uint32_t *)src_bits) + src_stride * (src_y + src_yoff) + (src_x + src_xoff)); - dst_bytes = (uint8_t *)(((uint32_t *)dst_bits) + dst_stride * (dst_y + dst_yoff) + (dst_x + dst_xoff)); + src_bytes = (uint8_t *)(((uint32_t *)src_bits) + src_stride * (src_y) + (src_x)); + dst_bytes = (uint8_t *)(((uint32_t *)dst_bits) + dst_stride * (dst_y) + (dst_x)); byte_width = 4 * width; src_stride *= 4; dst_stride *= 4; @@ -2875,14 +2858,12 @@ fbCopyAreammx (DrawablePtr pSrc, } _mm_empty(); + return TRUE; } -#endif -#if 0 -/* FIXME */ void -fbCompositeCopyAreammx (uint8_t op, +fbCompositeCopyAreammx (pixman_op_t op, pixman_image_t * pSrc, pixman_image_t * pMask, pixman_image_t * pDst, @@ -2895,15 +2876,13 @@ fbCompositeCopyAreammx (uint8_t op, uint16_t width, uint16_t height) { - fbCopyAreammx (pSrc->pDrawable, - pDst->pDrawable, - xSrc, ySrc, - xDst, yDst, - width, height); + pixman_blt_mmx (pSrc->bits.bits, + pDst->bits.bits, + pSrc->bits.rowstride, + pDst->bits.rowstride, + PIXMAN_FORMAT_BPP (pSrc->bits.format), + PIXMAN_FORMAT_BPP (pDst->bits.format), + xSrc, ySrc, xDst, yDst, width, height); } -#endif - - - #endif /* USE_MMX */ diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h index 9314329..fd888f3 100644 --- a/pixman/pixman-mmx.h +++ b/pixman/pixman-mmx.h @@ -277,6 +277,7 @@ pixman_bool_t fbCopyAreammx (DrawablePtr pSrc, int width, int height); #endif + void fbCompositeCopyAreammx (pixman_op_t op, pixman_image_t * pSrc, pixman_image_t * pMask, diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c index 76793b1..96431a3 100644 --- a/pixman/pixman-pict.c +++ b/pixman/pixman-pict.c @@ -1395,12 +1395,7 @@ pixman_image_composite (pixman_op_t op, #ifdef USE_MMX if (fbHaveMMX() && (pSrc->bits.format == PIXMAN_x8r8g8b8 || pSrc->bits.format == PIXMAN_x8b8g8r8)) -#if 0 - /* FIXME */ - - func = fbCompositeCopyAreammx -#endif - ; + func = fbCompositeCopyAreammx; else #endif #if 0 @@ -1442,11 +1437,7 @@ pixman_image_composite (pixman_op_t op, case PIXMAN_x8r8g8b8: #ifdef USE_MMX if (fbHaveMMX()) -#if 0 - /* FIXME */ - func = fbCompositeCopyAreammx -#endif - ; + func = fbCompositeCopyAreammx; #endif break; default: @@ -1458,11 +1449,7 @@ pixman_image_composite (pixman_op_t op, case PIXMAN_x8b8g8r8: #ifdef USE_MMX if (fbHaveMMX()) -#if 0 - /* FIXME */ - func = fbCompositeCopyAreammx -#endif - ; + func = fbCompositeCopyAreammx; #endif break; default: @@ -1616,11 +1603,7 @@ pixman_image_composite (pixman_op_t op, if (pSrc->bits.bits != pDst->bits.bits && fbHaveMMX() && (PIXMAN_FORMAT_BPP (pSrc->bits.format) == 16 || PIXMAN_FORMAT_BPP (pSrc->bits.format) == 32)) -#if 0 - /* FIXME */ - func = fbCompositeCopyAreammx -#endif - ; + func = fbCompositeCopyAreammx; else #endif /* FIXME */ diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index e27d0d6..dad82f8 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -56,3 +56,22 @@ pixman_transform_point_3d (pixman_transform_t *transform, *vector = result; return TRUE; } + +pixman_bool_t +pixman_blt (uint32_t *src_bits, + uint32_t *dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, int src_y, + int dst_x, int dst_y, + int width, int height) +{ +#ifdef USE_MMX + return pixman_blt_mmx (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp, + src_x, src_y, dst_x, dst_y, width, height); +#else + return FALSE; +#endif +} diff --git a/pixman/pixman.h b/pixman/pixman.h index 7f33273..0421723 100644 --- a/pixman/pixman.h +++ b/pixman/pixman.h @@ -289,6 +289,18 @@ pixman_bool_t pixman_region_equal (pixman_region16_t *region1, pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region); void pixman_region_reset(pixman_region16_t *region, pixman_box16_t *box); + +/* Copy / Fill */ +pixman_bool_t pixman_blt (uint32_t *src_bits, + uint32_t *dst_bits, + int src_stride, + int dst_stride, + int src_bpp, + int dst_bpp, + int src_x, int src_y, + int dst_x, int dst_y, + int width, int height); + /* * Images */ -- 2.7.4