pixman: Branch 'master' - 7 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Mon Jun 18 21:47:24 PDT 2007
TODO | 7 +-
pixman/pixman-mmx.c | 95 +++++++++++++++++++++++--------
pixman/pixman-mmx.h | 26 ++++----
pixman/pixman-pict.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++--
pixman/pixman-private.h | 1
pixman/pixman-utils.c | 96 ++++++++++++++++++++++++++++++--
6 files changed, 317 insertions(+), 51 deletions(-)
New commits:
diff-tree e73e000d5bd44a198e35b6d0c421a735d00e0b3f (from edbe099ad3906d7626de854d144fc23d78408357)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Tue Jun 19 00:35:58 2007 -0400
Fix solid fill optimization to compute the src correctly
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 1bdccbb..ddd81f4 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1034,14 +1034,17 @@ fbCompositeSolidFill (pixman_op_t op,
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);
- }
+ if (pDst->bits.format == PIXMAN_a8)
+ src = src >> 24;
+ else if (pDst->bits.format == PIXMAN_r5g6b5 ||
+ pDst->bits.format == PIXMAN_b5g6r5)
+ src = cvt8888to0565 (src);
+
+ pixman_fill (pDst->bits.bits, pDst->bits.rowstride,
+ PIXMAN_FORMAT_BPP (pDst->bits.format),
+ xDst, yDst,
+ width, height,
+ src);
}
static void
@@ -1771,12 +1774,19 @@ pixman_image_composite (pixman_op_t
{
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) == 8)
+ switch (pDst->bits.format)
{
+ case PIXMAN_a8r8g8b8:
+ case PIXMAN_x8r8g8b8:
+ case PIXMAN_a8b8g8r8:
+ case PIXMAN_x8b8g8r8:
+ case PIXMAN_a8:
+ case PIXMAN_r5g6b5:
func = fbCompositeSolidFill;
srcRepeat = FALSE;
+ break;
+ default:
+ break;
}
}
else if (pSrc->bits.format == pDst->bits.format)
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index af41d70..9b89dee 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -689,6 +689,7 @@ union pixman_image
if (!PIXMAN_FORMAT_A((img)->bits.format)) \
(res) |= 0xff000000; \
} \
+ \
/* If necessary, convert RGB <--> BGR. */ \
if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt)) \
{ \
diff-tree edbe099ad3906d7626de854d144fc23d78408357 (from f9454b3423b948022f36b7191db8c5f988f46273)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Mon Jun 18 14:29:02 2007 -0400
Add non-mmx solid fills. Update TODO
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
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 o
}
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
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;
}
diff-tree f9454b3423b948022f36b7191db8c5f988f46273 (from 0e4292666de736a584a3d4e0bcfc6db7d2c6538d)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Mon Jun 18 13:37:20 2007 -0400
Make sure the output of fbCompositeOver_x888x8x8888 is actually stored
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 39efbba..3cbae12 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -2981,6 +2981,8 @@ fbCompositeOver_x888x8x8888mmx (pixman_o
__m64 sa = expand_alpha (s);
__m64 vm = expand_alpha_rev ((__m64)m);
__m64 vdest = in_over(s, sa, vm, load8888 (*dst));
+
+ *dst = store8888 (vdest);
}
}
diff-tree 0e4292666de736a584a3d4e0bcfc6db7d2c6538d (from 80a61bfb3dcf26271766e36aa31d454889ee43a5)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sun Jun 17 23:10:23 2007 -0400
Also use this function in the xBGR case
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index bd4c1f1..5e13529 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1465,17 +1465,22 @@ pixman_image_composite (pixman_op_t
}
else
{
- if (pSrc->bits.format == PIXMAN_x8r8g8b8 &&
- pMask->bits.format == PIXMAN_a8 &&
- (pDst->bits.format == PIXMAN_a8r8g8b8 ||
- pDst->bits.format == PIXMAN_x8r8g8b8))
+ if (pMask->bits.format == PIXMAN_a8)
{
+ if ((pSrc->bits.format == PIXMAN_x8r8g8b8 &&
+ (pDst->bits.format == PIXMAN_x8r8g8b8 ||
+ pDst->bits.format == PIXMAN_a8r8g8b8)) ||
+ (pSrc->bits.format == PIXMAN_x8b8g8r8 &&
+ (pDst->bits.format == PIXMAN_x8b8g8r8 ||
+ pDst->bits.format == PIXMAN_a8b8g8r8)))
+ {
#ifdef USE_MMX
- if (pixman_have_mmx())
- func = fbCompositeOver_x888x8x8888mmx;
- else
+ if (pixman_have_mmx())
+ func = fbCompositeOver_x888x8x8888mmx;
+ else
#endif
- func = fbCompositeOver_x888x8x8888;
+ func = fbCompositeOver_x888x8x8888;
+ }
}
}
}
diff-tree 80a61bfb3dcf26271766e36aa31d454889ee43a5 (from 19360d0df2ba55d34963101a662dd0ab51d84836)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sun Jun 17 22:57:47 2007 -0400
Add new fbCompositeOver_x888x8x8888mmx() operation
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
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
(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;
}
}
}
diff-tree 19360d0df2ba55d34963101a662dd0ab51d84836 (from ff4004f3fbd3c576f1c931c680ad293c5038846d)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sun Jun 17 22:43:55 2007 -0400
Add fbCompositeOver_x888x8x8888() fast path
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index b520014..f2d5d0a 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -89,6 +89,67 @@ fbIn (uint32_t x, uint8_t y)
* opSRCxMASKxDST
*/
+static void
+fbCompositeOver_x888x8x8888 (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;
+ uint8_t 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--)
+ {
+ m = READ(mask++);
+ if (m)
+ {
+ s = READ(src) | 0xff000000;
+
+ if (m == 0xff)
+ WRITE (dst, s);
+ else
+ {
+ d = fbIn (s, m);
+ WRITE(dst, fbOver (d, READ(dst)));
+ }
+ }
+ src++;
+ dst++;
+ }
+ }
+
+ fbFinishAccess (pMask->pDrawable);
+ fbFinishAccess (pDst->pDrawable);
+}
+
+
void
fbCompositeSolidMask_nx8x8888 (pixman_op_t op,
pixman_image_t * pSrc,
@@ -1402,6 +1463,16 @@ pixman_image_composite (pixman_op_t
if (func)
maskRepeat = FALSE;
}
+ else
+ {
+ if (pSrc->bits.format == PIXMAN_x8r8g8b8 &&
+ pMask->bits.format == PIXMAN_a8 &&
+ (pDst->bits.format == PIXMAN_a8r8g8b8 ||
+ pDst->bits.format == PIXMAN_x8r8g8b8))
+ {
+ func = fbCompositeOver_x888x8x8888;
+ }
+ }
}
}
else /* no mask */
diff-tree ff4004f3fbd3c576f1c931c680ad293c5038846d (from 30f198fe53949da59821d2f394f0cecb5bdaa646)
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sun Jun 17 22:24:46 2007 -0400
Rename fbCompositeSrc_x888x8x8888 to x888xnx8888
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 1001cff..8025150 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -1271,7 +1271,7 @@ fbCompositeSrc_8888x8x8888mmx (pixman_op
}
void
-fbCompositeSrc_x888x8x8888mmx (pixman_op_t op,
+fbCompositeSrc_x888xnx8888mmx (pixman_op_t op,
pixman_image_t * pSrc,
pixman_image_t * pMask,
pixman_image_t * pDst,
diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h
index 6b86fdc..c666f43 100644
--- a/pixman/pixman-mmx.h
+++ b/pixman/pixman-mmx.h
@@ -118,7 +118,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pix
uint16_t width,
uint16_t height);
void
-fbCompositeSrc_x888x8x8888mmx (pixman_op_t op,
+fbCompositeSrc_x888xnx8888mmx (pixman_op_t op,
pixman_image_t * pSrc,
pixman_image_t * pMask,
pixman_image_t * pDst,
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 201dc91..b520014 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1374,13 +1374,13 @@ pixman_image_composite (pixman_op_t
if ((pDst->bits.format == PIXMAN_a8r8g8b8 ||
pDst->bits.format == PIXMAN_x8r8g8b8) &&
pMask->bits.format == PIXMAN_a8 && pixman_have_mmx())
- func = fbCompositeSrc_x888x8x8888mmx;
+ func = fbCompositeSrc_x888xnx8888mmx;
break;
case PIXMAN_x8b8g8r8:
if ((pDst->bits.format == PIXMAN_a8b8g8r8 ||
pDst->bits.format == PIXMAN_x8b8g8r8) &&
pMask->bits.format == PIXMAN_a8 && pixman_have_mmx())
- func = fbCompositeSrc_x888x8x8888mmx;
+ func = fbCompositeSrc_x888xnx8888mmx;
break;
case PIXMAN_a8r8g8b8:
if ((pDst->bits.format == PIXMAN_a8r8g8b8 ||
More information about the xorg-commit
mailing list