From edbe099ad3906d7626de854d144fc23d78408357 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Mon, 18 Jun 2007 14:29:02 -0400 Subject: [PATCH] Add non-mmx solid fills. Update TODO --- TODO | 7 ++-- pixman/pixman-mmx.c | 25 -------------- pixman/pixman-mmx.h | 13 ------- pixman/pixman-pict.c | 46 ++++++++++++++++++++++-- pixman/pixman-utils.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 140 insertions(+), 47 deletions(-) diff --git a/TODO b/TODO index 74ceee6..92beb0b 100644 --- a/TODO +++ b/TODO @@ -30,16 +30,19 @@ - done: source clipping happens through an indirection. still needs to make the indirection settable. -- Add non-mmx solid fill - - make the wrapper functions global instead of image specific - this won't work since pixman is linked to both fb and wfb - restore READ/WRITE in the fbcompose combiners since they sometimes store directly to destination drawables. +- Consider optimizing the 8/16 bit solid fills in pixman-util.c by + storing more than one value at a time. + done: +- Add non-mmx solid fill + - Make sure the endian-ness macros are defined correctly. - The rectangles in a region probably shouldn't be returned const as diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 3cbae12..6b2130f 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -2882,31 +2882,6 @@ pixman_blt_mmx (uint32_t *src_bits, } void -fbCompositeSolidFillmmx (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; - - fbComposeGetSolid(pSrc, src, pDst->bits.format); - - pixman_fill_mmx (pDst->bits.bits, pDst->bits.rowstride, - PIXMAN_FORMAT_BPP (pDst->bits.format), - xDst, yDst, - width, height, - src); -} - -void fbCompositeCopyAreammx (pixman_op_t op, pixman_image_t * pSrc, pixman_image_t * pMask, diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h index 044e776..a74d4ba 100644 --- a/pixman/pixman-mmx.h +++ b/pixman/pixman-mmx.h @@ -299,19 +299,6 @@ void fbCompositeCopyAreammx (pixman_op_t op, uint16_t width, uint16_t height); void -fbCompositeSolidFillmmx (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); -void fbCompositeOver_x888x8x8888mmx (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 5e13529..1bdccbb 100644 --- a/pixman/pixman-pict.c +++ b/pixman/pixman-pict.c @@ -1004,6 +1004,47 @@ fbCompositeSrcSrc_nxn (pixman_op_t op, } static void +pixman_image_composite_rect (pixman_op_t op, + pixman_image_t *src, + pixman_image_t *mask, + pixman_image_t *dest, + int16_t src_x, + int16_t src_y, + int16_t mask_x, + int16_t mask_y, + int16_t dest_x, + int16_t dest_y, + uint16_t width, + uint16_t height); +void +fbCompositeSolidFill (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; + + fbComposeGetSolid(pSrc, src, pDst->bits.format); + + if (!pixman_fill (pDst->bits.bits, pDst->bits.rowstride, + PIXMAN_FORMAT_BPP (pDst->bits.format), + xDst, yDst, + width, height, + src)) + { + pixman_image_composite_rect (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); + } +} + +static void pixman_walk_composite_region (pixman_op_t op, pixman_image_t * pSrc, pixman_image_t * pMask, @@ -1731,9 +1772,10 @@ pixman_image_composite (pixman_op_t op, if (can_get_solid (pSrc)) { if (PIXMAN_FORMAT_BPP (pDst->bits.format) == 16 || - PIXMAN_FORMAT_BPP (pDst->bits.format) == 32) + PIXMAN_FORMAT_BPP (pDst->bits.format) == 32 || + PIXMAN_FORMAT_BPP (pDst->bits.format) == 8) { - func = fbCompositeSolidFillmmx; + func = fbCompositeSolidFill; srcRepeat = FALSE; } } diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index f831ebe..11fec4e 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -80,6 +80,78 @@ pixman_blt (uint32_t *src_bits, return FALSE; } +static void +pixman_fill8 (uint32_t *bits, + int stride, + int x, + int y, + int width, + int height, + uint32_t xor) +{ + int byte_stride = stride * sizeof (uint32_t); + uint8_t *dst = (uint8_t *) bits; + uint8_t v = xor & 0xff; + int i; + + dst = dst + y * byte_stride + x; + + while (height--) + { + for (i = 0; i < width; ++i) + dst[i] = v; + + dst += byte_stride; + } +} + +static void +pixman_fill16 (uint32_t *bits, + int stride, + int x, + int y, + int width, + int height, + uint32_t xor) +{ + int short_stride = (stride * sizeof (uint32_t)) / sizeof (uint16_t); + uint16_t *dst = (uint16_t *)bits; + uint16_t v = xor & 0xffff; + int i; + + dst = dst + y * short_stride + x; + + while (height--) + { + for (i = 0; i < width; ++i) + dst[i] = v; + + dst += short_stride; + } +} + +static void +pixman_fill32 (uint32_t *bits, + int stride, + int x, + int y, + int width, + int height, + uint32_t xor) +{ + int i; + + bits = bits + y * stride + x; + + while (height--) + { + for (i = 0; i < width; ++i) + bits[i] = xor; + + bits += stride; + } +} + pixman_bool_t pixman_fill (uint32_t *bits, int stride, @@ -91,13 +163,27 @@ pixman_fill (uint32_t *bits, uint32_t xor) { #ifdef USE_MMX - if (pixman_have_mmx()) + if (!pixman_have_mmx() || !pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor)) +#endif { - return pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor); + switch (bpp) + { + case 8: + pixman_fill8 (bits, stride, x, y, width, height, xor); + return TRUE; + break; + + case 16: + pixman_fill16 (bits, stride, x, y, width, height, xor); + break; + + case 32: + pixman_fill32 (bits, stride, x, y, width, height, xor); + break; + } } - else -#endif - return FALSE; + + return FALSE; } -- 2.7.4