pixman: Branch 'master' - 32 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Wed May 27 14:28:06 PDT 2009
pixman/Makefile.am | 3
pixman/combine.inc | 369 ++++++++++++---------
pixman/combine.pl | 2
pixman/pixman-compose.c | 241 --------------
pixman/pixman-cpu.c | 20 +
pixman/pixman-fast-path.c | 604 ++++++++++++++++++++++++++---------
pixman/pixman-general.c | 395 +++++++++++++++++++++++
pixman/pixman-implementation.c | 268 +++++++++++++++
pixman/pixman-mmx.c | 608 +++++++++++++++++++++---------------
pixman/pixman-mmx.h | 90 -----
pixman/pixman-pict.c | 577 +++-------------------------------
pixman/pixman-private.h | 260 ++++++++++++---
pixman/pixman-sse2.c | 689 ++++++++++++++++++++++++-----------------
pixman/pixman-sse2.h | 79 ----
pixman/pixman-utils.c | 424 +++++++++++++++----------
pixman/pixman.h | 3
16 files changed, 2656 insertions(+), 1976 deletions(-)
New commits:
commit 6f93d36915fe3a8d8c75d26af8d5b9ba58aba4e3
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 20 06:04:15 2009 -0400
In _pixman_implementation_fill() don't call the delegate; call the actual implementation
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index 5fa16e8..86c2f37 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -264,5 +264,5 @@ _pixman_implementation_fill (pixman_implementation_t *imp,
int height,
uint32_t xor)
{
- return (* imp->fill) (imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ return (* imp->fill) (imp, bits, stride, bpp, x, y, width, height, xor);
}
commit a5a249613ba44ff791a7415f32192b1a0cc717db
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sun May 17 04:56:13 2009 -0400
Call the toplevel implementation for combining
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 3f19a40..3b70bec 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -227,7 +227,7 @@ general_composite_rect (pixman_implementation_t *imp,
width, (void *)dest_buffer, 0, 0);
/* blend */
- compose (imp, op, (void *)dest_buffer, (void *)src_buffer, (void *)mask_buffer, width);
+ compose (imp->toplevel, op, (void *)dest_buffer, (void *)src_buffer, (void *)mask_buffer, width);
/* write back */
store (&(dest->bits), dest_x, dest_y + i, width,
@@ -236,7 +236,7 @@ general_composite_rect (pixman_implementation_t *imp,
else
{
/* blend */
- compose (imp, op, bits + (dest_y + i) * stride +
+ compose (imp->toplevel, op, bits + (dest_y + i) * stride +
dest_x,
(void *)src_buffer, (void *)mask_buffer, width);
}
commit e5c367120adaa5ae265866336d097f0435300706
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sat May 16 11:22:54 2009 -0400
Set up combiner functions for an implementation directly in combine.inc.
Previously it would go through two big tables, and the general
implementation would select the correct one dynmcailly.
diff --git a/pixman/combine.inc b/pixman/combine.inc
index ef19d01..0d55694 100644
--- a/pixman/combine.inc
+++ b/pixman/combine.inc
@@ -43,13 +43,15 @@ combineMask (const comp4_t *src, const comp4_t *mask, int i)
}
FASTCALL static void
-fbCombineClear (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineClear (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
memset(dest, 0, width*sizeof(comp4_t));
}
FASTCALL static void
-fbCombineSrcU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineSrcU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -68,7 +70,8 @@ fbCombineSrcU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
/* if the Src is opaque, call fbCombineSrcU */
FASTCALL static void
-fbCombineOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOverU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -83,7 +86,8 @@ fbCombineOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int widt
/* if the Dst is opaque, this is a noop */
FASTCALL static void
-fbCombineOverReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -97,7 +101,8 @@ fbCombineOverReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, i
/* if the Dst is opaque, call fbCombineSrcU */
FASTCALL static void
-fbCombineInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineInU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -110,7 +115,8 @@ fbCombineInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
/* if the Src is opaque, this is a noop */
FASTCALL static void
-fbCombineInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -124,7 +130,8 @@ fbCombineInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int
/* if the Dst is opaque, call fbCombineClear */
FASTCALL static void
-fbCombineOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOutU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -137,7 +144,8 @@ fbCombineOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
/* if the Src is opaque, call fbCombineClear */
FASTCALL static void
-fbCombineOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -153,7 +161,8 @@ fbCombineOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, in
/* if the Dst is opaque, call fbCombineOverU */
/* if both the Src and Dst are opaque, call fbCombineSrcU */
FASTCALL static void
-fbCombineAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -171,7 +180,8 @@ fbCombineAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int widt
/* if the Dst is opaque, call fbCombineInReverseU */
/* if both the Src and Dst are opaque, call fbCombineDstU */
FASTCALL static void
-fbCombineAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -189,7 +199,8 @@ fbCombineAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, i
/* if the Dst is opaque, call fbCombineOverReverseU */
/* if both the Src and Dst are opaque, call fbCombineClear */
FASTCALL static void
-fbCombineXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineXorU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -204,7 +215,8 @@ fbCombineXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
}
FASTCALL static void
-fbCombineAddU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineAddU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -219,7 +231,8 @@ fbCombineAddU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
/* if the Dst is opaque, call fbCombineAddU */
/* if both the Src and Dst are opaque, call fbCombineAddU */
FASTCALL static void
-fbCombineSaturateU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -381,7 +394,8 @@ fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mas
}
FASTCALL static void
-fbCombineDisjointOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointOverU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
for (i = 0; i < width; ++i) {
@@ -403,43 +417,50 @@ fbCombineDisjointOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask,
}
FASTCALL static void
-fbCombineDisjointInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointInU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineAIn);
}
FASTCALL static void
-fbCombineDisjointInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineBIn);
}
FASTCALL static void
-fbCombineDisjointOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointOutU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineAOut);
}
FASTCALL static void
-fbCombineDisjointOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineBOut);
}
FASTCALL static void
-fbCombineDisjointAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineAAtop);
}
FASTCALL static void
-fbCombineDisjointAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineBAtop);
}
FASTCALL static void
-fbCombineDisjointXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointXorU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralU (dest, src, mask, width, CombineXor);
}
@@ -495,58 +516,67 @@ fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mas
}
FASTCALL static void
-fbCombineConjointOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOverU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineAOver);
}
FASTCALL static void
-fbCombineConjointOverReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineBOver);
}
FASTCALL static void
-fbCombineConjointInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointInU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineAIn);
}
FASTCALL static void
-fbCombineConjointInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineBIn);
}
FASTCALL static void
-fbCombineConjointOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOutU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineAOut);
}
FASTCALL static void
-fbCombineConjointOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineBOut);
}
FASTCALL static void
-fbCombineConjointAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineAAtop);
}
FASTCALL static void
-fbCombineConjointAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineBAtop);
}
FASTCALL static void
-fbCombineConjointXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointXorU (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralU (dest, src, mask, width, CombineXor);
}
@@ -632,13 +662,15 @@ fbCombineMaskAlphaC (const comp4_t *src, comp4_t *mask)
}
FASTCALL static void
-fbCombineClearC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineClearC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
memset(dest, 0, width*sizeof(comp4_t));
}
FASTCALL static void
-fbCombineSrcC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -653,7 +685,8 @@ fbCombineSrcC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
}
FASTCALL static void
-fbCombineOverC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOverC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -679,7 +712,8 @@ fbCombineOverC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int widt
}
FASTCALL static void
-fbCombineOverReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -704,7 +738,8 @@ fbCombineOverReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, i
}
FASTCALL static void
-fbCombineInC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineInC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -728,7 +763,8 @@ fbCombineInC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
}
FASTCALL static void
-fbCombineInReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -754,7 +790,8 @@ fbCombineInReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int
}
FASTCALL static void
-fbCombineOutC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOutC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -779,7 +816,8 @@ fbCombineOutC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
}
FASTCALL static void
-fbCombineOutReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -805,7 +843,8 @@ fbCombineOutReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, in
}
FASTCALL static void
-fbCombineAtopC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -826,7 +865,8 @@ fbCombineAtopC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int widt
}
FASTCALL static void
-fbCombineAtopReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -848,7 +888,8 @@ fbCombineAtopReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, i
}
FASTCALL static void
-fbCombineXorC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineXorC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -869,7 +910,8 @@ fbCombineXorC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
}
FASTCALL static void
-fbCombineAddC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -886,7 +928,8 @@ fbCombineAddC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width
}
FASTCALL static void
-fbCombineSaturateC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineSaturateC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
int i;
@@ -1009,49 +1052,57 @@ fbCombineDisjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mas
}
FASTCALL static void
-fbCombineDisjointOverC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointOverC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver);
}
FASTCALL static void
-fbCombineDisjointInC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointInC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn);
}
FASTCALL static void
-fbCombineDisjointInReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn);
}
FASTCALL static void
-fbCombineDisjointOutC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointOutC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut);
}
FASTCALL static void
-fbCombineDisjointOutReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut);
}
FASTCALL static void
-fbCombineDisjointAtopC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop);
}
FASTCALL static void
-fbCombineDisjointAtopReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop);
}
FASTCALL static void
-fbCombineDisjointXorC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineDisjointXorC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor);
}
@@ -1133,154 +1184,156 @@ fbCombineConjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mas
}
FASTCALL static void
-fbCombineConjointOverC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOverC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver);
}
FASTCALL static void
-fbCombineConjointOverReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver);
}
FASTCALL static void
-fbCombineConjointInC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointInC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn);
}
FASTCALL static void
-fbCombineConjointInReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn);
}
FASTCALL static void
-fbCombineConjointOutC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOutC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut);
}
FASTCALL static void
-fbCombineConjointOutReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut);
}
FASTCALL static void
-fbCombineConjointAtopC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop);
}
FASTCALL static void
-fbCombineConjointAtopReverseC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop);
}
FASTCALL static void
-fbCombineConjointXorC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
+fbCombineConjointXorC (pixman_implementation_t *imp, pixman_op_t op,
+ comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
{
fbCombineConjointGeneralC (dest, src, mask, width, CombineXor);
}
-static CombineFunc pixman_fbCombineFuncU[] = {
- fbCombineClear,
- fbCombineSrcU,
- NULL, /* CombineDst */
- fbCombineOverU,
- fbCombineOverReverseU,
- fbCombineInU,
- fbCombineInReverseU,
- fbCombineOutU,
- fbCombineOutReverseU,
- fbCombineAtopU,
- fbCombineAtopReverseU,
- fbCombineXorU,
- fbCombineAddU,
- fbCombineSaturateU,
- NULL,
- NULL,
- fbCombineClear,
- fbCombineSrcU,
- NULL, /* CombineDst */
- fbCombineDisjointOverU,
- fbCombineSaturateU, /* DisjointOverReverse */
- fbCombineDisjointInU,
- fbCombineDisjointInReverseU,
- fbCombineDisjointOutU,
- fbCombineDisjointOutReverseU,
- fbCombineDisjointAtopU,
- fbCombineDisjointAtopReverseU,
- fbCombineDisjointXorU,
- NULL,
- NULL,
- NULL,
- NULL,
- fbCombineClear,
- fbCombineSrcU,
- NULL, /* CombineDst */
- fbCombineConjointOverU,
- fbCombineConjointOverReverseU,
- fbCombineConjointInU,
- fbCombineConjointInReverseU,
- fbCombineConjointOutU,
- fbCombineConjointOutReverseU,
- fbCombineConjointAtopU,
- fbCombineConjointAtopReverseU,
- fbCombineConjointXorU,
-};
-
-static CombineFunc pixman_fbCombineFuncC[] = {
- fbCombineClearC,
- fbCombineSrcC,
- NULL, /* Dest */
- fbCombineOverC,
- fbCombineOverReverseC,
- fbCombineInC,
- fbCombineInReverseC,
- fbCombineOutC,
- fbCombineOutReverseC,
- fbCombineAtopC,
- fbCombineAtopReverseC,
- fbCombineXorC,
- fbCombineAddC,
- fbCombineSaturateC,
- NULL,
- NULL,
- fbCombineClearC, /* 0x10 */
- fbCombineSrcC,
- NULL, /* Dest */
- fbCombineDisjointOverC,
- fbCombineSaturateC, /* DisjointOverReverse */
- fbCombineDisjointInC,
- fbCombineDisjointInReverseC,
- fbCombineDisjointOutC,
- fbCombineDisjointOutReverseC,
- fbCombineDisjointAtopC,
- fbCombineDisjointAtopReverseC,
- fbCombineDisjointXorC, /* 0x1b */
- NULL,
- NULL,
- NULL,
- NULL,
- fbCombineClearC,
- fbCombineSrcC,
- NULL, /* Dest */
- fbCombineConjointOverC,
- fbCombineConjointOverReverseC,
- fbCombineConjointInC,
- fbCombineConjointInReverseC,
- fbCombineConjointOutC,
- fbCombineConjointOutReverseC,
- fbCombineConjointAtopC,
- fbCombineConjointAtopReverseC,
- fbCombineConjointXorC,
-};
-
-FbComposeFunctions pixman_composeFunctions = {
- pixman_fbCombineFuncU,
- pixman_fbCombineFuncC,
-};
+void
+_pixman_setup_combiner_functions_width (pixman_implementation_t *imp)
+{
+ /* Unified alpha */
+ imp->combine_width[PIXMAN_OP_CLEAR] = fbCombineClear;
+ imp->combine_width[PIXMAN_OP_SRC] = fbCombineSrcU;
+ /* dest */
+ imp->combine_width[PIXMAN_OP_OVER] = fbCombineOverU;
+ imp->combine_width[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseU;
+ imp->combine_width[PIXMAN_OP_IN] = fbCombineInU;
+ imp->combine_width[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseU;
+ imp->combine_width[PIXMAN_OP_OUT] = fbCombineOutU;
+ imp->combine_width[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseU;
+ imp->combine_width[PIXMAN_OP_ATOP] = fbCombineAtopU;
+ imp->combine_width[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseU;
+ imp->combine_width[PIXMAN_OP_XOR] = fbCombineXorU;
+ imp->combine_width[PIXMAN_OP_ADD] = fbCombineAddU;
+ imp->combine_width[PIXMAN_OP_SATURATE] = fbCombineSaturateU;
+
+ /* Disjoint, unified */
+ imp->combine_width[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClear;
+ imp->combine_width[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcU;
+ /* dest */
+ imp->combine_width[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseU;
+ imp->combine_width[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorU;
+
+ /* Conjoint, unified */
+ imp->combine_width[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClear;
+ imp->combine_width[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcU;
+ /* dest */
+ imp->combine_width[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseU;
+ imp->combine_width[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorU;
+
+ /* Component alpha combiners */
+ imp->combine_width_ca[PIXMAN_OP_CLEAR] = fbCombineClearC;
+ imp->combine_width_ca[PIXMAN_OP_SRC] = fbCombineSrcC;
+ /* dest */
+ imp->combine_width_ca[PIXMAN_OP_OVER] = fbCombineOverC;
+ imp->combine_width_ca[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseC;
+ imp->combine_width_ca[PIXMAN_OP_IN] = fbCombineInC;
+ imp->combine_width_ca[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseC;
+ imp->combine_width_ca[PIXMAN_OP_OUT] = fbCombineOutC;
+ imp->combine_width_ca[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseC;
+ imp->combine_width_ca[PIXMAN_OP_ATOP] = fbCombineAtopC;
+ imp->combine_width_ca[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseC;
+ imp->combine_width_ca[PIXMAN_OP_XOR] = fbCombineXorC;
+ imp->combine_width_ca[PIXMAN_OP_ADD] = fbCombineAddC;
+ imp->combine_width_ca[PIXMAN_OP_SATURATE] = fbCombineSaturateC;
+
+ /* Disjoint CA */
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClearC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcC;
+ /* dest */
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateC,
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseC;
+ imp->combine_width_ca[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorC;
+
+ /* Conjoint CA */
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClearC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcC;
+ /* dest */
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseC;
+ imp->combine_width_ca[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorC;
+}
diff --git a/pixman/combine.pl b/pixman/combine.pl
index d50c480..3b75362 100644
--- a/pixman/combine.pl
+++ b/pixman/combine.pl
@@ -62,6 +62,8 @@ while (<STDIN>) {
# Add 32/64 suffix to combining function types.
s/\bCombineFunc\b/CombineFunc$pixel_size/;
s/\bFbComposeFunctions\b/FbComposeFunctions$pixel_size/;
+ s/combine_width/combine_$pixel_size/;
+ s/_pixman_setup_combiner_functions_width/_pixman_setup_combiner_functions_$pixel_size/;
# Convert comp*_t values into the appropriate real types.
s/comp1_t/uint${size}_t/g;
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index e85d0d1..3f19a40 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -40,47 +40,6 @@
#include "pixman-combine32.h"
#include "pixman-private.h"
-
-static void
-general_combine_32 (pixman_implementation_t *imp, pixman_op_t op,
- uint32_t *dest, const uint32_t *src, const uint32_t *mask,
- int width)
-{
- CombineFunc32 f = pixman_composeFunctions.combineU[op];
-
- f (dest, src, mask, width);
-}
-
-static void
-general_combine_32_ca (pixman_implementation_t *imp, pixman_op_t op,
- uint32_t *dest, const uint32_t *src, const uint32_t *mask,
- int width)
-{
- CombineFunc32 f = pixman_composeFunctions.combineC[op];
-
- f (dest, src, mask, width);
-}
-
-static void
-general_combine_64 (pixman_implementation_t *imp, pixman_op_t op,
- uint64_t *dest, const uint64_t *src, const uint64_t *mask,
- int width)
-{
- CombineFunc64 f = pixman_composeFunctions64.combineU[op];
-
- f (dest, src, mask, width);
-}
-
-static void
-general_combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
- uint64_t *dest, const uint64_t *src, const uint64_t *mask,
- int width)
-{
- CombineFunc64 f = pixman_composeFunctions64.combineC[op];
-
- f (dest, src, mask, width);
-}
-
#define SCANLINE_BUFFER_LENGTH 8192
static void
@@ -197,11 +156,11 @@ general_composite_rect (pixman_implementation_t *imp,
}
component_alpha =
- fetchSrc &&
- fetchMask &&
- mask &&
- mask->common.type == BITS &&
- mask->common.component_alpha &&
+ fetchSrc &&
+ fetchMask &&
+ mask &&
+ mask->common.type == BITS &&
+ mask->common.component_alpha &&
PIXMAN_FORMAT_RGB (mask->bits.format);
if (wide)
@@ -424,15 +383,10 @@ pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel)
{
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL);
- int i;
+
+ _pixman_setup_combiner_functions_32 (imp);
+ _pixman_setup_combiner_functions_64 (imp);
- for (i = 0; i < PIXMAN_OP_LAST; ++i)
- {
- imp->combine_32[i] = general_combine_32;
- imp->combine_32_ca[i] = general_combine_32_ca;
- imp->combine_64[i] = general_combine_64;
- imp->combine_64_ca[i] = general_combine_64_ca;
- }
imp->composite = general_composite;
imp->blt = general_blt;
imp->fill = general_fill;
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 2367261..3280af7 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -184,19 +184,6 @@ typedef struct _FbComposeData {
uint16_t height;
} FbComposeData;
-typedef struct _FbComposeFunctions32 {
- CombineFunc32 *combineU;
- CombineFunc32 *combineC;
-} FbComposeFunctions32;
-
-typedef struct _FbComposeFunctions64 {
- CombineFunc64 *combineU;
- CombineFunc64 *combineC;
-} FbComposeFunctions64;
-
-extern FbComposeFunctions32 pixman_composeFunctions;
-extern FbComposeFunctions64 pixman_composeFunctions64;
-
void pixman_composite_rect_general_accessors (const FbComposeData *data,
void *src_buffer,
void *mask_buffer,
@@ -936,6 +923,9 @@ _pixman_walk_composite_region (pixman_implementation_t *imp,
pixman_bool_t maskRepeat,
pixman_composite_func_t compositeRect);
+void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
+void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
+
/* These "formats" both have depth 0, so they
* will never clash with any real ones
*/
commit fb272d1464f12bd913d3fdbc4ec512758b5c4c98
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sat May 16 10:24:30 2009 -0400
Consolidate the general implementation into one function
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 479e8a6..e85d0d1 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -47,7 +47,7 @@ general_combine_32 (pixman_implementation_t *imp, pixman_op_t op,
int width)
{
CombineFunc32 f = pixman_composeFunctions.combineU[op];
-
+
f (dest, src, mask, width);
}
@@ -57,7 +57,7 @@ general_combine_32_ca (pixman_implementation_t *imp, pixman_op_t op,
int width)
{
CombineFunc32 f = pixman_composeFunctions.combineC[op];
-
+
f (dest, src, mask, width);
}
@@ -67,7 +67,7 @@ general_combine_64 (pixman_implementation_t *imp, pixman_op_t op,
int width)
{
CombineFunc64 f = pixman_composeFunctions64.combineU[op];
-
+
f (dest, src, mask, width);
}
@@ -77,51 +77,89 @@ general_combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
int width)
{
CombineFunc64 f = pixman_composeFunctions64.combineC[op];
-
+
f (dest, src, mask, width);
}
+#define SCANLINE_BUFFER_LENGTH 8192
+
static void
-pixman_composite_rect_general_internal (pixman_implementation_t *imp,
- const FbComposeData *data,
- void *src_buffer, void *mask_buffer,
- void *dest_buffer, const int wide)
+general_composite_rect (pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
{
- int i;
- scanStoreProc store;
+ return_if_fail (src != NULL);
+ return_if_fail (dest != NULL);
+
+ uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
+ const pixman_format_code_t srcFormat = src->type == BITS ? src->bits.format : 0;
+ const pixman_format_code_t maskFormat = mask && mask->type == BITS ? mask->bits.format : 0;
+ const pixman_format_code_t destFormat = dest->type == BITS ? dest->bits.format : 0;
+ const int srcWide = PIXMAN_FORMAT_16BPC(srcFormat);
+ const int maskWide = mask && PIXMAN_FORMAT_16BPC(maskFormat);
+ const int destWide = PIXMAN_FORMAT_16BPC(destFormat);
+ const int wide = srcWide || maskWide || destWide;
+ const int Bpp = wide ? 8 : 4;
+ uint8_t *scanline_buffer = stack_scanline_buffer;
+ uint8_t *src_buffer, *mask_buffer, *dest_buffer;
scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL;
- uint32_t *bits;
- int32_t stride;
+ pixman_combine_32_func_t compose;
+ scanStoreProc store;
source_pict_class_t srcClass, maskClass;
pixman_bool_t component_alpha;
-
- srcClass = _pixman_image_classify (data->src,
- data->xSrc, data->ySrc,
- data->width, data->height);
-
+ uint32_t *bits;
+ int32_t stride;
+ int i;
+
+ if (width * Bpp > SCANLINE_BUFFER_LENGTH)
+ {
+ scanline_buffer = pixman_malloc_abc (width, 3, Bpp);
+
+ if (!scanline_buffer)
+ return;
+ }
+
+ src_buffer = scanline_buffer;
+ mask_buffer = src_buffer + width * Bpp;
+ dest_buffer = mask_buffer + width * Bpp;
+
+ srcClass = _pixman_image_classify (src,
+ src_x, src_y,
+ width, height);
+
maskClass = SOURCE_IMAGE_CLASS_UNKNOWN;
- if (data->mask)
+ if (mask)
{
- maskClass = _pixman_image_classify (data->mask,
- data->xSrc, data->ySrc,
- data->width, data->height);
+ maskClass = _pixman_image_classify (mask,
+ src_x, src_y,
+ width, height);
}
- if (data->op == PIXMAN_OP_CLEAR)
+ if (op == PIXMAN_OP_CLEAR)
fetchSrc = NULL;
else if (wide)
fetchSrc = _pixman_image_get_scanline_64;
else
fetchSrc = _pixman_image_get_scanline_32;
-
- if (!data->mask || data->op == PIXMAN_OP_CLEAR)
+
+ if (!mask || op == PIXMAN_OP_CLEAR)
fetchMask = NULL;
else if (wide)
fetchMask = _pixman_image_get_scanline_64;
else
fetchMask = _pixman_image_get_scanline_32;
-
- if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC)
+
+ if (op == PIXMAN_OP_CLEAR || op == PIXMAN_OP_SRC)
fetchDest = NULL;
else if (wide)
fetchDest = _pixman_image_get_scanline_64;
@@ -133,188 +171,118 @@ pixman_composite_rect_general_internal (pixman_implementation_t *imp,
else
store = _pixman_image_store_scanline_32;
- // Skip the store step and composite directly into the
- // destination if the output format of the compose func matches
- // the destination format.
+ /* Skip the store step and composite directly into the
+ * destination if the output format of the compose func matches
+ * the destination format.
+ */
if (!wide &&
- !data->dest->common.alpha_map &&
- !data->dest->common.write_func &&
- (data->op == PIXMAN_OP_ADD || data->op == PIXMAN_OP_OVER) &&
- (data->dest->bits.format == PIXMAN_a8r8g8b8 ||
- data->dest->bits.format == PIXMAN_x8r8g8b8))
+ !dest->common.alpha_map &&
+ !dest->common.write_func &&
+ (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) &&
+ (dest->bits.format == PIXMAN_a8r8g8b8 ||
+ dest->bits.format == PIXMAN_x8r8g8b8))
{
store = NULL;
}
-
+
if (!store)
{
- bits = data->dest->bits.bits;
- stride = data->dest->bits.rowstride;
+ bits = dest->bits.bits;
+ stride = dest->bits.rowstride;
}
else
{
bits = NULL;
stride = 0;
}
-
+
component_alpha =
fetchSrc &&
fetchMask &&
- data->mask &&
- data->mask->common.type == BITS &&
- data->mask->common.component_alpha &&
- PIXMAN_FORMAT_RGB (data->mask->bits.format);
-
+ mask &&
+ mask->common.type == BITS &&
+ mask->common.component_alpha &&
+ PIXMAN_FORMAT_RGB (mask->bits.format);
+
+ if (wide)
{
- pixman_combine_32_func_t compose;
-
- if (wide)
- {
- if (component_alpha)
- compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64_ca;
- else
- compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64;
- }
+ if (component_alpha)
+ compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64_ca;
else
+ compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64;
+ }
+ else
+ {
+ if (component_alpha)
+ compose = _pixman_implementation_combine_32_ca;
+ else
+ compose = _pixman_implementation_combine_32;
+ }
+
+ if (!compose)
+ return;
+
+ if (!fetchMask)
+ mask_buffer = NULL;
+
+ for (i = 0; i < height; ++i)
+ {
+ /* fill first half of scanline with source */
+ if (fetchSrc)
{
- if (component_alpha)
- compose = _pixman_implementation_combine_32_ca;
- else
- compose = _pixman_implementation_combine_32;
- }
-
- if (!compose)
- return;
-
- if (!fetchMask)
- mask_buffer = NULL;
-
- for (i = 0; i < data->height; ++i)
- {
- /* fill first half of scanline with source */
- if (fetchSrc)
+ if (fetchMask)
{
- if (fetchMask)
- {
- /* fetch mask before source so that fetching of
- source can be optimized */
- fetchMask (data->mask, data->xMask, data->yMask + i,
- data->width, mask_buffer, 0, 0);
-
- if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
- fetchMask = NULL;
- }
-
- if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
- {
- fetchSrc (data->src, data->xSrc, data->ySrc + i,
- data->width, src_buffer, 0, 0);
- fetchSrc = NULL;
- }
- else
- {
- fetchSrc (data->src, data->xSrc, data->ySrc + i,
- data->width, src_buffer, mask_buffer,
- 0xffffffff);
- }
+ /* fetch mask before source so that fetching of
+ source can be optimized */
+ fetchMask (mask, mask_x, mask_y + i,
+ width, (void *)mask_buffer, 0, 0);
+
+ if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
+ fetchMask = NULL;
}
- else if (fetchMask)
+
+ if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
{
- fetchMask (data->mask, data->xMask, data->yMask + i,
- data->width, mask_buffer, 0, 0);
- }
-
- if (store)
- {
- /* fill dest into second half of scanline */
- if (fetchDest)
- fetchDest (data->dest, data->xDest, data->yDest + i,
- data->width, dest_buffer, 0, 0);
-
- /* blend */
- compose (imp, data->op, dest_buffer, src_buffer, mask_buffer, data->width);
-
- /* write back */
- store (&(data->dest->bits), data->xDest, data->yDest + i, data->width,
- dest_buffer);
+ fetchSrc (src, src_x, src_y + i,
+ width, (void *)src_buffer, 0, 0);
+ fetchSrc = NULL;
}
else
{
- /* blend */
- compose (imp, data->op, bits + (data->yDest + i) * stride +
- data->xDest,
- src_buffer, mask_buffer, data->width);
+ fetchSrc (src, src_x, src_y + i,
+ width, (void *)src_buffer, (void *)mask_buffer,
+ 0xffffffff);
}
}
+ else if (fetchMask)
+ {
+ fetchMask (mask, mask_x, mask_y + i,
+ width, (void *)mask_buffer, 0, 0);
+ }
+
+ if (store)
+ {
+ /* fill dest into second half of scanline */
+ if (fetchDest)
+ fetchDest (dest, dest_x, dest_y + i,
+ width, (void *)dest_buffer, 0, 0);
+
+ /* blend */
+ compose (imp, op, (void *)dest_buffer, (void *)src_buffer, (void *)mask_buffer, width);
+
+ /* write back */
+ store (&(dest->bits), dest_x, dest_y + i, width,
+ (void *)dest_buffer);
+ }
+ else
+ {
+ /* blend */
+ compose (imp, op, bits + (dest_y + i) * stride +
+ dest_x,
+ (void *)src_buffer, (void *)mask_buffer, width);
+ }
}
-}
-
-#define SCANLINE_BUFFER_LENGTH 8192
-
-static void
-pixman_image_composite_rect (pixman_implementation_t *imp,
- pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int32_t src_x,
- int32_t src_y,
- int32_t mask_x,
- int32_t mask_y,
- int32_t dest_x,
- int32_t dest_y,
- int32_t width,
- int32_t height)
-{
- FbComposeData compose_data;
- FbComposeData *data = &compose_data;
-
- return_if_fail (src != NULL);
- return_if_fail (dest != NULL);
-
- compose_data.op = op;
- compose_data.src = src;
- compose_data.mask = mask;
- compose_data.dest = dest;
- compose_data.xSrc = src_x;
- compose_data.ySrc = src_y;
- compose_data.xMask = mask_x;
- compose_data.yMask = mask_y;
- compose_data.xDest = dest_x;
- compose_data.yDest = dest_y;
- compose_data.width = width;
- compose_data.height = height;
-
- uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
- const pixman_format_code_t srcFormat =
- data->src->type == BITS ? data->src->bits.format : 0;
- const pixman_format_code_t maskFormat =
- data->mask && data->mask->type == BITS ? data->mask->bits.format : 0;
- const pixman_format_code_t destFormat = data->dest->type == BITS ? data->dest->bits.format : 0;
- const int srcWide = PIXMAN_FORMAT_16BPC(srcFormat);
- const int maskWide = data->mask && PIXMAN_FORMAT_16BPC(maskFormat);
- const int destWide = PIXMAN_FORMAT_16BPC(destFormat);
- const int wide = srcWide || maskWide || destWide;
- const int Bpp = wide ? 8 : 4;
- uint8_t *scanline_buffer = stack_scanline_buffer;
- uint8_t *src_buffer, *mask_buffer, *dest_buffer;
- if (data->width * Bpp > SCANLINE_BUFFER_LENGTH)
- {
- scanline_buffer = pixman_malloc_abc (data->width, 3, Bpp);
-
- if (!scanline_buffer)
- return;
- }
-
- src_buffer = scanline_buffer;
- mask_buffer = src_buffer + data->width * Bpp;
- dest_buffer = mask_buffer + data->width * Bpp;
-
- pixman_composite_rect_general_internal (imp, data, src_buffer,
- mask_buffer, dest_buffer,
- wide);
-
if (scanline_buffer != stack_scanline_buffer)
free (scanline_buffer);
}
@@ -338,26 +306,26 @@ general_composite (pixman_implementation_t * imp,
pixman_bool_t maskRepeat = FALSE;
pixman_bool_t srcTransform = src->common.transform != NULL;
pixman_bool_t maskTransform = FALSE;
-
+
#ifdef USE_VMX
fbComposeSetupVMX();
#endif
-
+
if (srcRepeat && srcTransform &&
src->bits.width == 1 &&
src->bits.height == 1)
{
srcTransform = FALSE;
}
-
+
if (mask && mask->type == BITS)
{
maskRepeat = mask->common.repeat == PIXMAN_REPEAT_NORMAL;
-
+
maskTransform = mask->common.transform != 0;
if (mask->common.filter == PIXMAN_FILTER_CONVOLUTION)
maskTransform = TRUE;
-
+
if (maskRepeat && maskTransform &&
mask->bits.width == 1 &&
mask->bits.height == 1)
@@ -375,7 +343,7 @@ general_composite (pixman_implementation_t * imp,
width, height))
return;
#endif
-
+
#ifdef USE_ARM_NEON
if (pixman_have_arm_neon() && _pixman_run_fast_path (arm_neon_fast_paths, imp,
op, src, mask, dest,
@@ -385,7 +353,7 @@ general_composite (pixman_implementation_t * imp,
width, height))
return;
#endif
-
+
#ifdef USE_ARM_SIMD
if (pixman_have_arm_simd() && _pixman_run_fast_path (arm_simd_fast_paths, imp,
op, src, mask, dest,
@@ -395,7 +363,7 @@ general_composite (pixman_implementation_t * imp,
width, height))
return;
#endif
-
+
/* CompositeGeneral optimizes 1x1 repeating images itself */
if (src->type == BITS &&
src->bits.width == 1 && src->bits.height == 1)
@@ -415,10 +383,10 @@ general_composite (pixman_implementation_t * imp,
if (maskTransform)
maskRepeat = FALSE;
-
+
_pixman_walk_composite_region (imp, op, src, mask, dest, src_x, src_y,
mask_x, mask_y, dest_x, dest_y, width, height,
- srcRepeat, maskRepeat, pixman_image_composite_rect);
+ srcRepeat, maskRepeat, general_composite_rect);
}
static pixman_bool_t
@@ -457,7 +425,7 @@ _pixman_implementation_create_general (pixman_implementation_t *toplevel)
{
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL);
int i;
-
+
for (i = 0; i < PIXMAN_OP_LAST; ++i)
{
imp->combine_32[i] = general_combine_32;
commit 6a22abd899b2c226c01be055145c6ee3e469ee3c
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Sat May 16 09:56:31 2009 -0400
Move the argument struct into pixman_image_composite_rect
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 069e301..479e8a6 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -252,9 +252,39 @@ pixman_composite_rect_general_internal (pixman_implementation_t *imp,
#define SCANLINE_BUFFER_LENGTH 8192
static void
-general_composite_rect (pixman_implementation_t *imp,
- const FbComposeData *data)
+pixman_image_composite_rect (pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
{
+ FbComposeData compose_data;
+ FbComposeData *data = &compose_data;
+
+ return_if_fail (src != NULL);
+ return_if_fail (dest != NULL);
+
+ compose_data.op = op;
+ compose_data.src = src;
+ compose_data.mask = mask;
+ compose_data.dest = dest;
+ compose_data.xSrc = src_x;
+ compose_data.ySrc = src_y;
+ compose_data.xMask = mask_x;
+ compose_data.yMask = mask_y;
+ compose_data.xDest = dest_x;
+ compose_data.yDest = dest_y;
+ compose_data.width = width;
+ compose_data.height = height;
+
uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
const pixman_format_code_t srcFormat =
data->src->type == BITS ? data->src->bits.format : 0;
@@ -290,42 +320,6 @@ general_composite_rect (pixman_implementation_t *imp,
}
static void
-pixman_image_composite_rect (pixman_implementation_t *imp,
- pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int32_t src_x,
- int32_t src_y,
- int32_t mask_x,
- int32_t mask_y,
- int32_t dest_x,
- int32_t dest_y,
- int32_t width,
- int32_t height)
-{
- FbComposeData compose_data;
-
- return_if_fail (src != NULL);
- return_if_fail (dest != NULL);
-
- compose_data.op = op;
- compose_data.src = src;
- compose_data.mask = mask;
- compose_data.dest = dest;
- compose_data.xSrc = src_x;
- compose_data.ySrc = src_y;
- compose_data.xMask = mask_x;
- compose_data.yMask = mask_y;
- compose_data.xDest = dest_x;
- compose_data.yDest = dest_y;
- compose_data.width = width;
- compose_data.height = height;
-
- general_composite_rect (imp, &compose_data);
-}
-
-static void
general_composite (pixman_implementation_t * imp,
pixman_op_t op,
pixman_image_t * src,
commit 4983f6b26cdd36eafbb97c21e5eb8d54ba59fa21
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 11:32:59 2009 -0400
Make a couple of functions static
diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
index 96c62a6..e8f749a 100644
--- a/pixman/pixman-cpu.c
+++ b/pixman/pixman-cpu.c
@@ -460,7 +460,7 @@ static unsigned int detectCPUFeatures(void) {
return features;
}
-pixman_bool_t
+static pixman_bool_t
pixman_have_mmx (void)
{
static pixman_bool_t initialized = FALSE;
@@ -477,7 +477,7 @@ pixman_have_mmx (void)
}
#ifdef USE_SSE2
-pixman_bool_t
+static pixman_bool_t
pixman_have_sse2 (void)
{
static pixman_bool_t initialized = FALSE;
commit 41a9a17e0308f2075bb1bd59c4411e43a67d49ec
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 11:31:30 2009 -0400
Delete pixman-sse2.h and pixman-mmx.h
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 7d0f1fb..069e301 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -35,9 +35,7 @@
#include <stdlib.h>
#include <string.h>
#include "pixman-private.h"
-#include "pixman-mmx.h"
#include "pixman-vmx.h"
-#include "pixman-sse2.h"
#include "pixman-arm-simd.h"
#include "pixman-combine32.h"
#include "pixman-private.h"
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index c12ba53..957aed2 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -38,8 +38,6 @@
#include <mmintrin.h>
#include "pixman-private.h"
-#include "pixman-mmx.h"
-
#define noVERBOSE
#ifdef VERBOSE
@@ -917,48 +915,6 @@ mmxCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
_mm_empty();
}
-void
-fbComposeSetupMMX(void)
-{
- static pixman_bool_t initialized = FALSE;
-
- if (initialized)
- return;
-
- /* check if we have MMX support and initialize accordingly */
- if (pixman_have_mmx())
- {
-#if 0
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = mmxCombineOverU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN] = mmxCombineInU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT] = mmxCombineOutU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP] = mmxCombineAtopU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = mmxCombineXorU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = mmxCombineAddU;
- pixman_composeFunctions.combineU[PIXMAN_OP_SATURATE] = mmxCombineSaturateU;
-
- pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = mmxCombineSrcC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = mmxCombineOverC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN] = mmxCombineInC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT] = mmxCombineOutC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP] = mmxCombineAtopC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_XOR] = mmxCombineXorC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = mmxCombineAddC;
-#endif
- }
-
- initialized = TRUE;
-}
-
-
/* ------------------ MMX code paths called from fbpict.c ----------------------- */
static void
diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h
deleted file mode 100644
index 250410a..0000000
--- a/pixman/pixman-mmx.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright © 2004 Red Hat, Inc.
- * Copyright © 2005 Trolltech AS
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Red Hat makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Author: Søren Sandmann (sandmann at redhat.com)
- * Lars Knoll (lars at trolltech.com)
- *
- * Based on work by Owen Taylor
- */
-#ifndef _PIXMAN_MMX_H_
-#define _PIXMAN_MMX_H_
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "pixman-private.h"
-
-#ifdef USE_MMX
-
-#if !defined(__amd64__) && !defined(__x86_64__)
-pixman_bool_t pixman_have_mmx(void);
-#else
-#define pixman_have_mmx() TRUE
-#endif
-
-#else
-#define pixman_have_mmx() FALSE
-#endif
-
-#ifdef USE_MMX
-
-pixman_bool_t
-pixman_fill_mmx (uint32_t *bits,
- int stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor);
-
-#endif /* USE_MMX */
-
-#endif /* _PIXMAN_MMX_H_ */
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index a2a5bb0..a574787 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -33,8 +33,7 @@
#include <mmintrin.h>
#include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */
#include <emmintrin.h> /* for SSE2 intrinsics */
-
-#include "pixman-sse2.h"
+#include "pixman-private.h"
#ifdef USE_SSE2
diff --git a/pixman/pixman-sse2.h b/pixman/pixman-sse2.h
deleted file mode 100644
index dec5f86..0000000
--- a/pixman/pixman-sse2.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright © 2008 Rodrigo Kumpera
- * Copyright © 2008 André Tupinambá
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Red Hat not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Red Hat makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- *
- * Author: Rodrigo Kumpera (kumpera at gmail.com)
- * André Tupinambá (andrelrt at gmail.com)
- *
- * Based on work by Owen Taylor and Søren Sandmann
- */
-#ifndef _PIXMAN_SSE_H_
-#define _PIXMAN_SSE_H_
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "pixman-private.h"
-
-#ifdef USE_SSE2
-
-#if !defined(__amd64__) && !defined(__x86_64__)
-pixman_bool_t pixman_have_sse2(void);
-#else
-#define pixman_have_sse2() TRUE
-#endif
-
-#else
-#define pixman_have_sse2() FALSE
-#endif
-
-#ifdef USE_SSE2
-
-pixman_bool_t
-pixmanFillsse2 (uint32_t *bits,
- int stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- uint32_t data);
-
-#endif /* USE_SSE2 */
-
-#endif /* _PIXMAN_SSE_H_ */
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 5c43e64..ffb1444 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -28,8 +28,6 @@
#include <stdlib.h>
#include "pixman-private.h"
-#include "pixman-mmx.h"
-#include "pixman-sse2.h"
/*
* Compute the smallest value no less than y which is on a
commit 5dc9671b2588bfe084d69789e5c367474c5efa92
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 11:27:01 2009 -0400
Make the fast_path implementation run the c_fast_paths
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index c24258e..5f78bc3 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1021,7 +1021,7 @@ fbCompositeSrc_8888xx888 (pixman_implementation_t *imp,
}
}
-static const FastPathInfo c_fast_path_array[] =
+static const FastPathInfo c_fast_paths[] =
{
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8x0565, 0 },
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8x0565, 0 },
@@ -1070,8 +1070,6 @@ static const FastPathInfo c_fast_path_array[] =
{ PIXMAN_OP_NONE },
};
-const FastPathInfo *const c_fast_paths = c_fast_path_array;
-
static void
fbCompositeSrcScaleNearest (pixman_implementation_t *imp,
pixman_op_t op,
@@ -1215,6 +1213,16 @@ fast_path_composite (pixman_implementation_t *imp,
}
}
+ if (_pixman_run_fast_path (c_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ {
+ return;
+ }
+
_pixman_implementation_composite (imp->delegate, op,
src, mask, dest,
src_x, src_y,
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 4693823..7d0f1fb 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -404,14 +404,6 @@ general_composite (pixman_implementation_t * imp,
return;
#endif
- if (pixman_have_arm_simd() && _pixman_run_fast_path (c_fast_paths, imp,
- op, src, mask, dest,
- src_x, src_y,
- mask_x, mask_y,
- dest_x, dest_y,
- width, height))
- return;
-
/* CompositeGeneral optimizes 1x1 repeating images itself */
if (src->type == BITS &&
src->bits.width == 1 && src->bits.height == 1)
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index adee672..2367261 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -956,8 +956,6 @@ typedef struct
uint32_t flags;
} FastPathInfo;
-extern const FastPathInfo *const c_fast_paths;
-
struct pixman_implementation_t
{
pixman_implementation_t * toplevel;
commit 364e218ad6a68028b4c11d051faee33f80513af4
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 11:24:28 2009 -0400
Split fill implementations out in the implementations
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 8025233..c24258e 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1223,6 +1223,112 @@ fast_path_composite (pixman_implementation_t *imp,
width, height);
}
+static void
+pixman_fill8 (uint32_t *bits,
+ int stride,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ int byte_stride = stride * (int) 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 * (int) sizeof (uint32_t)) / (int) 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;
+ }
+}
+
+static pixman_bool_t
+fast_path_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ switch (bpp)
+ {
+ case 8:
+ pixman_fill8 (bits, stride, x, y, width, height, xor);
+ 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;
+
+ default:
+ return _pixman_implementation_fill (
+ imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ break;
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_fast_path (pixman_implementation_t *toplevel)
{
@@ -1230,6 +1336,7 @@ _pixman_implementation_create_fast_path (pixman_implementation_t *toplevel)
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, general);
imp->composite = fast_path_composite;
+ imp->fill = fast_path_fill;
return imp;
}
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index e8a0b75..4693823 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -454,6 +454,20 @@ general_blt (pixman_implementation_t *imp,
return FALSE;
}
+static pixman_bool_t
+general_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ return FALSE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel)
{
@@ -469,6 +483,7 @@ _pixman_implementation_create_general (pixman_implementation_t *toplevel)
}
imp->composite = general_composite;
imp->blt = general_blt;
-
+ imp->fill = general_fill;
+
return imp;
}
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index ca4cbdc..5fa16e8 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -117,6 +117,20 @@ delegate_blt (pixman_implementation_t * imp,
width, height);
}
+static pixman_bool_t
+delegate_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ return _pixman_implementation_fill (imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+}
+
pixman_implementation_t *
_pixman_implementation_create (pixman_implementation_t *toplevel,
pixman_implementation_t *delegate)
@@ -141,6 +155,7 @@ _pixman_implementation_create (pixman_implementation_t *toplevel,
*/
imp->composite = delegate_composite;
imp->blt = delegate_blt;
+ imp->fill = delegate_fill;
for (i = 0; i < PIXMAN_OP_LAST; ++i)
{
@@ -237,3 +252,17 @@ _pixman_implementation_blt (pixman_implementation_t * imp,
src_bpp, dst_bpp, src_x, src_y, dst_x, dst_y,
width, height);
}
+
+pixman_bool_t
+_pixman_implementation_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ return (* imp->fill) (imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+}
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 1fe8aa7..c12ba53 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3194,6 +3194,26 @@ mmx_blt (pixman_implementation_t *imp,
return TRUE;
}
+static pixman_bool_t
+mmx_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ if (!pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor))
+ {
+ return _pixman_implementation_fill (
+ imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
{
@@ -3226,6 +3246,7 @@ _pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
imp->composite = mmx_composite;
imp->blt = mmx_blt;
+ imp->fill = mmx_fill;
return imp;
}
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 658ac70..17bd566 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -136,3 +136,40 @@ pixman_image_composite (pixman_op_t op,
dest_x, dest_y,
width, height);
}
+
+PIXMAN_EXPORT 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)
+{
+ if (!imp)
+ imp = _pixman_choose_implementation();
+
+ return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
+ src_bpp, dst_bpp,
+ src_x, src_y,
+ dst_x, dst_y,
+ width, height);
+}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_fill (uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ if (!imp)
+ imp = _pixman_choose_implementation();
+
+ return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
+}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index ac47dc4..adee672 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -908,6 +908,15 @@ typedef pixman_bool_t (* pixman_blt_func_t) (pixman_implementation_t * imp,
int dst_y,
int width,
int height);
+typedef pixman_bool_t (* pixman_fill_func_t) (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor);
void
_pixman_walk_composite_region (pixman_implementation_t *imp,
@@ -956,6 +965,7 @@ struct pixman_implementation_t
pixman_composite_func_t composite;
pixman_blt_func_t blt;
+ pixman_fill_func_t fill;
pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST];
@@ -1024,7 +1034,17 @@ _pixman_implementation_blt (pixman_implementation_t * imp,
int dst_y,
int width,
int height);
-
+pixman_bool_t
+_pixman_implementation_fill (pixman_implementation_t * imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor);
+
/* Specific implementations */
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel);
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index f6e1055..a2a5bb0 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -5016,6 +5016,27 @@ sse2_blt (pixman_implementation_t *imp,
return TRUE;
}
+__attribute__((__force_align_arg_pointer__))
+static pixman_bool_t
+sse2_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ if (!pixmanFillsse2 (bits, stride, bpp, x, y, width, height, xor))
+ {
+ return _pixman_implementation_fill (
+ imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
{
@@ -5080,6 +5101,7 @@ _pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
imp->composite = sse2_composite;
imp->blt = sse2_blt;
+ imp->fill = sse2_fill;
return imp;
}
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index a9e00a6..5c43e64 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -31,129 +31,6 @@
#include "pixman-mmx.h"
#include "pixman-sse2.h"
-static void
-pixman_fill8 (uint32_t *bits,
- int stride,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor)
-{
- int byte_stride = stride * (int) 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 * (int) sizeof (uint32_t)) / (int) 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;
- }
-}
-
-#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
-__attribute__((__force_align_arg_pointer__))
-#endif
-PIXMAN_EXPORT pixman_bool_t
-pixman_fill (uint32_t *bits,
- int stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor)
-{
-#if 0
- printf ("filling: %d %d %d %d (stride: %d, bpp: %d) pixel: %x\n",
- x, y, width, height, stride, bpp, xor);
-#endif
-
-#ifdef USE_SSE2
- if (pixman_have_sse2() && pixmanFillsse2 (bits, stride, bpp, x, y, width, height, xor))
- return TRUE;
-#endif
-
-#ifdef USE_MMX
- if (pixman_have_mmx() && pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor))
- return TRUE;
-#endif
-
- switch (bpp)
- {
- case 8:
- pixman_fill8 (bits, stride, x, y, width, height, xor);
- 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;
-
- default:
- return FALSE;
- break;
- }
-
- return TRUE;
-}
-
-
/*
* Compute the smallest value no less than y which is on a
* grid row
commit 24e73d69ee99c2dc19d474b75f262e6efddfccf1
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 11:04:07 2009 -0400
Add alignment workaround to sse2
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index a53fd1e..f6e1055 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4989,6 +4989,7 @@ sse2_composite (pixman_implementation_t *imp,
width, height);
}
+__attribute__((__force_align_arg_pointer__))
static pixman_bool_t
sse2_blt (pixman_implementation_t *imp,
uint32_t *src_bits,
commit 1369b0b9d4ce89c50f56ec1c552b534f96273c1c
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 11:03:15 2009 -0400
Add a general_blt() that just returns FALSE
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 825dc3b..e8a0b75 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -437,14 +437,29 @@ general_composite (pixman_implementation_t * imp,
srcRepeat, maskRepeat, pixman_image_composite_rect);
}
+static pixman_bool_t
+general_blt (pixman_implementation_t *imp,
+ 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)
+{
+ /* We can't blit unless we have sse2 or mmx */
+
+ return FALSE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel)
{
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL);
int i;
- imp->composite = general_composite;
-
for (i = 0; i < PIXMAN_OP_LAST; ++i)
{
imp->combine_32[i] = general_combine_32;
@@ -452,6 +467,8 @@ _pixman_implementation_create_general (pixman_implementation_t *toplevel)
imp->combine_64[i] = general_combine_64;
imp->combine_64_ca[i] = general_combine_64_ca;
}
+ imp->composite = general_composite;
+ imp->blt = general_blt;
return imp;
}
commit 9955b1516902d7671d41777bf1989f23cb0a87ed
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 10:56:15 2009 -0400
Move sse2 and mmx blt implementations to their respective files
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index b9a5925..ca4cbdc 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -97,6 +97,26 @@ delegate_combine_64_ca (pixman_implementation_t * imp,
op, dest, src, mask, width);
}
+static pixman_bool_t
+delegate_blt (pixman_implementation_t * imp,
+ 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)
+{
+ return _pixman_implementation_blt (imp->delegate, src_bits, dst_bits, src_stride, dst_stride,
+ src_bpp, dst_bpp, src_x, src_y, dst_x, dst_y,
+ width, height);
+}
+
pixman_implementation_t *
_pixman_implementation_create (pixman_implementation_t *toplevel,
pixman_implementation_t *delegate)
@@ -120,6 +140,7 @@ _pixman_implementation_create (pixman_implementation_t *toplevel,
/* Fill out function pointers with ones that just delegate
*/
imp->composite = delegate_composite;
+ imp->blt = delegate_blt;
for (i = 0; i < PIXMAN_OP_LAST; ++i)
{
@@ -196,3 +217,23 @@ _pixman_implementation_composite (pixman_implementation_t * imp,
src_x, src_y, mask_x, mask_y, dest_x, dest_y,
width, height);
}
+
+pixman_bool_t
+_pixman_implementation_blt (pixman_implementation_t * imp,
+ 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)
+{
+ return (* imp->blt) (imp, src_bits, dst_bits, src_stride, dst_stride,
+ src_bpp, dst_bpp, src_x, src_y, dst_x, dst_y,
+ width, height);
+}
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 0205d0e..1fe8aa7 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -2837,7 +2837,7 @@ fbCompositeSrcAdd_8888x8888mmx (pixman_implementation_t *imp,
_mm_empty();
}
-pixman_bool_t
+static pixman_bool_t
pixman_blt_mmx (uint32_t *src_bits,
uint32_t *dst_bits,
int src_stride,
@@ -2973,7 +2973,7 @@ pixman_blt_mmx (uint32_t *src_bits,
return TRUE;
}
-void
+static void
fbCompositeCopyAreammx (pixman_implementation_t *imp,
pixman_op_t op,
pixman_image_t * pSrc,
@@ -3062,7 +3062,7 @@ fbCompositeOver_x888x8x8888mmx (pixman_implementation_t *imp,
_mm_empty();
}
-static const FastPathInfo mmx_fast_path_array[] =
+static const FastPathInfo mmx_fast_paths[] =
{
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8x0565mmx, 0 },
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8x0565mmx, 0 },
@@ -3138,7 +3138,6 @@ static const FastPathInfo mmx_fast_path_array[] =
{ PIXMAN_OP_NONE },
};
-const FastPathInfo *const mmx_fast_paths = mmx_fast_path_array;
static void
mmx_composite (pixman_implementation_t *imp,
@@ -3169,6 +3168,32 @@ mmx_composite (pixman_implementation_t *imp,
width, height);
}
+static pixman_bool_t
+mmx_blt (pixman_implementation_t *imp,
+ 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)
+{
+ if (!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))
+
+ {
+ return _pixman_implementation_blt (
+ imp->delegate,
+ src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+ src_x, src_y, dst_x, dst_y, width, height);
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
{
@@ -3200,7 +3225,8 @@ _pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
imp->combine_32_ca[PIXMAN_OP_ADD] = mmxCombineAddC;
imp->composite = mmx_composite;
-
+ imp->blt = mmx_blt;
+
return imp;
}
diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h
index f30ff76..250410a 100644
--- a/pixman/pixman-mmx.h
+++ b/pixman/pixman-mmx.h
@@ -49,18 +49,6 @@ pixman_bool_t pixman_have_mmx(void);
#ifdef USE_MMX
-extern const FastPathInfo *const mmx_fast_paths;
-
-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);
pixman_bool_t
pixman_fill_mmx (uint32_t *bits,
int stride,
@@ -71,21 +59,6 @@ pixman_fill_mmx (uint32_t *bits,
int height,
uint32_t xor);
-void fbComposeSetupMMX(void);
-void fbCompositeCopyAreammx (pixman_implementation_t *imp,
- pixman_op_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- int32_t xSrc,
- int32_t ySrc,
- int32_t xMask,
- int32_t yMask,
- int32_t xDst,
- int32_t yDst,
- int32_t width,
- int32_t height);
-
#endif /* USE_MMX */
#endif /* _PIXMAN_MMX_H_ */
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 2c738f3..658ac70 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -102,6 +102,8 @@ pixman_optimize_operator(pixman_op_t op, pixman_image_t *pSrc, pixman_image_t *p
}
+static pixman_implementation_t *imp;
+
PIXMAN_EXPORT void
pixman_image_composite (pixman_op_t op,
pixman_image_t * src,
@@ -116,8 +118,6 @@ pixman_image_composite (pixman_op_t op,
uint16_t width,
uint16_t height)
{
- static pixman_implementation_t *imp;
-
/*
* Check if we can replace our operator by a simpler one if the src or dest are opaque
* The output operator should be mathematically equivalent to the source.
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 0e46704..ac47dc4 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -895,6 +895,19 @@ typedef void (* pixman_composite_func_t) (pixman_implementation_t * imp,
int32_t dest_y,
int32_t width,
int32_t height);
+typedef pixman_bool_t (* pixman_blt_func_t) (pixman_implementation_t * imp,
+ 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);
void
_pixman_walk_composite_region (pixman_implementation_t *imp,
@@ -942,6 +955,7 @@ struct pixman_implementation_t
pixman_implementation_t * delegate;
pixman_composite_func_t composite;
+ pixman_blt_func_t blt;
pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST];
@@ -996,6 +1010,21 @@ _pixman_implementation_composite (pixman_implementation_t * imp,
int32_t width,
int32_t height);
+pixman_bool_t
+_pixman_implementation_blt (pixman_implementation_t * imp,
+ 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);
+
/* Specific implementations */
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel);
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index c3a3064..a53fd1e 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4556,7 +4556,7 @@ fbCompositeSrcAdd_8888x8888sse2 (pixman_implementation_t *imp,
* fbCompositeCopyAreasse2
*/
-pixman_bool_t
+static pixman_bool_t
pixmanBltsse2 (uint32_t *src_bits,
uint32_t *dst_bits,
int src_stride,
@@ -4989,6 +4989,32 @@ sse2_composite (pixman_implementation_t *imp,
width, height);
}
+static pixman_bool_t
+sse2_blt (pixman_implementation_t *imp,
+ 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)
+{
+ if (!pixmanBltsse2 (
+ src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+ src_x, src_y, dst_x, dst_y, width, height))
+
+ {
+ return _pixman_implementation_blt (
+ imp->delegate,
+ src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
+ src_x, src_y, dst_x, dst_y, width, height);
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
{
@@ -5052,6 +5078,7 @@ _pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
imp->combine_32_ca[PIXMAN_OP_ADD] = sse2CombineAddC;
imp->composite = sse2_composite;
+ imp->blt = sse2_blt;
return imp;
}
diff --git a/pixman/pixman-sse2.h b/pixman/pixman-sse2.h
index dff5d4b..dec5f86 100644
--- a/pixman/pixman-sse2.h
+++ b/pixman/pixman-sse2.h
@@ -59,17 +59,6 @@ pixmanFillsse2 (uint32_t *bits,
int height,
uint32_t data);
-pixman_bool_t
-pixmanBltsse2 (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);
-
#endif /* USE_SSE2 */
#endif /* _PIXMAN_SSE_H_ */
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 9e9ba7b..a9e00a6 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -31,39 +31,6 @@
#include "pixman-mmx.h"
#include "pixman-sse2.h"
-#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
-__attribute__((__force_align_arg_pointer__))
-#endif
-PIXMAN_EXPORT 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_SSE2
- if (pixman_have_sse2())
- {
- return pixmanBltsse2 (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
- src_x, src_y, dst_x, dst_y, width, height);
- }
- else
-#endif
-#ifdef USE_MMX
- if (pixman_have_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
-#endif
- return FALSE;
-}
-
static void
pixman_fill8 (uint32_t *bits,
int stride,
commit 46f0707481d50950fdb5d4588486affef0baa9ef
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 10:32:36 2009 -0400
Move gcc alignment workaround to pixman-sse2.c
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 554a351..825dc3b 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -327,26 +327,6 @@ pixman_image_composite_rect (pixman_implementation_t *imp,
general_composite_rect (imp, &compose_data);
}
-#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
-
-/*
- * Work around GCC bug causing crashes in Mozilla with SSE2
- *
- * When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
- * aligned. Unfortunately some code, such as Mozilla and Mono contain
- * code that aligns the stack to 4 bytes.
- *
- * The __force_align_arg_pointer__ makes gcc generate a prologue that
- * realigns the stack pointer to 16 bytes.
- *
- * On x86-64 this is not necessary because the standard ABI already
- * calls for a 16 byte aligned stack.
- *
- * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
- */
-
-__attribute__((__force_align_arg_pointer__))
-#endif
static void
general_composite (pixman_implementation_t * imp,
pixman_op_t op,
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 36b6055..c3a3064 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4863,7 +4863,7 @@ fbCompositeOver_x888x8x8888sse2 (pixman_implementation_t *imp,
}
#endif
-static const FastPathInfo sse2_fast_path_array[] =
+static const FastPathInfo sse2_fast_paths[] =
{
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8x0565sse2, 0 },
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_b5g6r5, fbCompositeSolidMask_nx8x0565sse2, 0 },
@@ -4940,22 +4940,36 @@ static const FastPathInfo sse2_fast_path_array[] =
{ PIXMAN_OP_NONE },
};
-const FastPathInfo *const sse2_fast_paths = sse2_fast_path_array;
-
+/*
+ * Work around GCC bug causing crashes in Mozilla with SSE2
+ *
+ * When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
+ * aligned. Unfortunately some code, such as Mozilla and Mono contain
+ * code that aligns the stack to 4 bytes.
+ *
+ * The __force_align_arg_pointer__ makes gcc generate a prologue that
+ * realigns the stack pointer to 16 bytes.
+ *
+ * On x86-64 this is not necessary because the standard ABI already
+ * calls for a 16 byte aligned stack.
+ *
+ * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
+ */
+__attribute__((__force_align_arg_pointer__))
static void
sse2_composite (pixman_implementation_t *imp,
- pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int32_t src_x,
- int32_t src_y,
- int32_t mask_x,
- int32_t mask_y,
- int32_t dest_x,
- int32_t dest_y,
- int32_t width,
- int32_t height)
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
{
if (_pixman_run_fast_path (sse2_fast_paths, imp,
op, src, mask, dest,
diff --git a/pixman/pixman-sse2.h b/pixman/pixman-sse2.h
index 417e31d..dff5d4b 100644
--- a/pixman/pixman-sse2.h
+++ b/pixman/pixman-sse2.h
@@ -49,10 +49,6 @@ pixman_bool_t pixman_have_sse2(void);
#ifdef USE_SSE2
-extern const FastPathInfo *const sse2_fast_paths;
-
-void fbComposeSetupSSE2(void);
-
pixman_bool_t
pixmanFillsse2 (uint32_t *bits,
int stride,
commit 53150f4fcafba0a5a69fddaee4b2ae687f0a2149
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 10:28:41 2009 -0400
Set up SSE2 combiners
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 39b1906..36b6055 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -2310,176 +2310,181 @@ createMask_2x32_128 (uint32_t mask0, uint32_t mask1)
/* SSE2 code patch for fbcompose.c */
static FASTCALL void
-sse2CombineOverU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOverU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOverUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOverReverseU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOverReverseUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineInU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineInU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineInUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineInReverseU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineReverseInUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOutU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOutU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOutUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOutReverseU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineReverseOutUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineAtopU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineAtopUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineAtopReverseU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineReverseAtopUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineXorU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineXorU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineXorUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineAddU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineAddU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineAddUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineSaturateU (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineSaturateUsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineSrcC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineSrcCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOverC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOverC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOverCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOverReverseC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOverReverseCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineInC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineInC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineInCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineInReverseC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineInReverseCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOutC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOutC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOutCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineOutReverseC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineOutReverseCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineAtopC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineAtopCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineAtopReverseC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineReverseAtopCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineXorC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineXorC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineXorCsse2 (dst, src, mask, width);
_mm_empty();
}
static FASTCALL void
-sse2CombineAddC (uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
+sse2CombineAddC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dst, const uint32_t *src, const uint32_t *mask, int width)
{
coreCombineAddCsse2 (dst, src, mask, width);
_mm_empty();
}
-void
-fbComposeSetupSSE2(void)
-{
- static pixman_bool_t initialized = FALSE;
-
- if (initialized)
- return;
-
- /* check if we have SSE2 support and initialize accordingly */
- if (pixman_have_sse2())
- {
- }
-
- initialized = TRUE;
-}
-
-
/* -------------------------------------------------------------------------------------------------
* fbCompositeSolid_nx8888
*/
@@ -5001,34 +5006,36 @@ _pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
xMask00ff = createMask_16_64 (0x00ff);
xMask0101 = createMask_16_64 (0x0101);
xMaskAlpha = createMask_2x32_64 (0x00ff0000, 0x00000000);
+
+ _mm_empty();
+
+ /* Set up function pointers */
/* SSE code patch for fbcompose.c */
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = sse2CombineOverU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN] = sse2CombineInU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT] = sse2CombineOutU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP] = sse2CombineAtopU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = sse2CombineXorU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = sse2CombineAddU;
+ imp->combine_32[PIXMAN_OP_OVER] = sse2CombineOverU;
+ imp->combine_32[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseU;
+ imp->combine_32[PIXMAN_OP_IN] = sse2CombineInU;
+ imp->combine_32[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseU;
+ imp->combine_32[PIXMAN_OP_OUT] = sse2CombineOutU;
+ imp->combine_32[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseU;
+ imp->combine_32[PIXMAN_OP_ATOP] = sse2CombineAtopU;
+ imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseU;
+ imp->combine_32[PIXMAN_OP_XOR] = sse2CombineXorU;
+ imp->combine_32[PIXMAN_OP_ADD] = sse2CombineAddU;
- pixman_composeFunctions.combineU[PIXMAN_OP_SATURATE] = sse2CombineSaturateU;
+ imp->combine_32[PIXMAN_OP_SATURATE] = sse2CombineSaturateU;
- pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = sse2CombineSrcC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = sse2CombineOverC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN] = sse2CombineInC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT] = sse2CombineOutC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP] = sse2CombineAtopC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_XOR] = sse2CombineXorC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = sse2CombineAddC;
-
- _mm_empty();
+ imp->combine_32_ca[PIXMAN_OP_SRC] = sse2CombineSrcC;
+ imp->combine_32_ca[PIXMAN_OP_OVER] = sse2CombineOverC;
+ imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseC;
+ imp->combine_32_ca[PIXMAN_OP_IN] = sse2CombineInC;
+ imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseC;
+ imp->combine_32_ca[PIXMAN_OP_OUT] = sse2CombineOutC;
+ imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP] = sse2CombineAtopC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseC;
+ imp->combine_32_ca[PIXMAN_OP_XOR] = sse2CombineXorC;
+ imp->combine_32_ca[PIXMAN_OP_ADD] = sse2CombineAddC;
imp->composite = sse2_composite;
commit 63c1ab031347dd2f26a25f29589516e1e59ba8db
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 10:23:01 2009 -0400
Make pixman_implementation call the right combiner
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index 4c98fec..b9a5925 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -162,7 +162,7 @@ _pixman_implementation_combine_32_ca (pixman_implementation_t * imp,
const uint32_t * mask,
int width)
{
- (* imp->combine_32[op]) (imp, op, dest, src, mask, width);
+ (* imp->combine_32_ca[op]) (imp, op, dest, src, mask, width);
}
void
@@ -173,7 +173,7 @@ _pixman_implementation_combine_64_ca (pixman_implementation_t * imp,
const uint64_t * mask,
int width)
{
- (* imp->combine_64[op]) (imp, op, dest, src, mask, width);
+ (* imp->combine_64_ca[op]) (imp, op, dest, src, mask, width);
}
void
commit c8a2c336a7a90abc094ec57a4ae15ffabf6e1763
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 10:15:58 2009 -0400
Use the implementation's combiner's
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 75e01db..554a351 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -2,6 +2,9 @@
* Copyright © 2009 Red Hat, Inc.
* Copyright © 2000 SuSE, Inc.
* Copyright © 2007 Red Hat, Inc.
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ * 2005 Lars Knoll & Zack Rusin, Trolltech
+ * 2008 Aaron Plattner, NVIDIA Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -28,6 +31,15 @@
#include <math.h>
#include <assert.h>
#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "pixman-private.h"
+#include "pixman-mmx.h"
+#include "pixman-vmx.h"
+#include "pixman-sse2.h"
+#include "pixman-arm-simd.h"
+#include "pixman-combine32.h"
#include "pixman-private.h"
@@ -71,38 +83,9 @@ general_combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
f (dest, src, mask, width);
}
-/*
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- * 2005 Lars Knoll & Zack Rusin, Trolltech
- * 2008 Aaron Plattner, NVIDIA Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
static void
-pixman_composite_rect_general_internal (const FbComposeData *data,
+pixman_composite_rect_general_internal (pixman_implementation_t *imp,
+ const FbComposeData *data,
void *src_buffer, void *mask_buffer,
void *dest_buffer, const int wide)
{
@@ -185,21 +168,21 @@ pixman_composite_rect_general_internal (const FbComposeData *data,
PIXMAN_FORMAT_RGB (data->mask->bits.format);
{
- CombineFunc32 compose;
+ pixman_combine_32_func_t compose;
if (wide)
{
if (component_alpha)
- compose = (CombineFunc32)pixman_composeFunctions64.combineC[data->op];
+ compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64_ca;
else
- compose = (CombineFunc32)pixman_composeFunctions64.combineU[data->op];
+ compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64;
}
else
{
if (component_alpha)
- compose = pixman_composeFunctions.combineC[data->op];
+ compose = _pixman_implementation_combine_32_ca;
else
- compose = pixman_composeFunctions.combineU[data->op];
+ compose = _pixman_implementation_combine_32;
}
if (!compose)
@@ -251,7 +234,7 @@ pixman_composite_rect_general_internal (const FbComposeData *data,
data->width, dest_buffer, 0, 0);
/* blend */
- compose (dest_buffer, src_buffer, mask_buffer, data->width);
+ compose (imp, data->op, dest_buffer, src_buffer, mask_buffer, data->width);
/* write back */
store (&(data->dest->bits), data->xDest, data->yDest + i, data->width,
@@ -260,7 +243,7 @@ pixman_composite_rect_general_internal (const FbComposeData *data,
else
{
/* blend */
- compose (bits + (data->yDest + i) * stride +
+ compose (imp, data->op, bits + (data->yDest + i) * stride +
data->xDest,
src_buffer, mask_buffer, data->width);
}
@@ -271,7 +254,8 @@ pixman_composite_rect_general_internal (const FbComposeData *data,
#define SCANLINE_BUFFER_LENGTH 8192
static void
-general_composite_rect (const FbComposeData *data)
+general_composite_rect (pixman_implementation_t *imp,
+ const FbComposeData *data)
{
uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
const pixman_format_code_t srcFormat =
@@ -299,7 +283,7 @@ general_composite_rect (const FbComposeData *data)
mask_buffer = src_buffer + data->width * Bpp;
dest_buffer = mask_buffer + data->width * Bpp;
- pixman_composite_rect_general_internal (data, src_buffer,
+ pixman_composite_rect_general_internal (imp, data, src_buffer,
mask_buffer, dest_buffer,
wide);
@@ -307,16 +291,6 @@ general_composite_rect (const FbComposeData *data)
free (scanline_buffer);
}
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "pixman-private.h"
-#include "pixman-mmx.h"
-#include "pixman-vmx.h"
-#include "pixman-sse2.h"
-#include "pixman-arm-simd.h"
-#include "pixman-combine32.h"
-
static void
pixman_image_composite_rect (pixman_implementation_t *imp,
pixman_op_t op,
@@ -350,7 +324,7 @@ pixman_image_composite_rect (pixman_implementation_t *imp,
compose_data.width = width;
compose_data.height = height;
- general_composite_rect (&compose_data);
+ general_composite_rect (imp, &compose_data);
}
#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
commit cb236a85df18f0f5e04698fb63c3895c2a2762dc
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 10:06:29 2009 -0400
Move SSE2 variable initializations to pixman_implementations_create_sse2
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 0c2f80b..39b1906 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -2474,59 +2474,6 @@ fbComposeSetupSSE2(void)
/* check if we have SSE2 support and initialize accordingly */
if (pixman_have_sse2())
{
- /* SSE2 constants */
- Mask565r = createMask_2x32_128 (0x00f80000, 0x00f80000);
- Mask565g1 = createMask_2x32_128 (0x00070000, 0x00070000);
- Mask565g2 = createMask_2x32_128 (0x000000e0, 0x000000e0);
- Mask565b = createMask_2x32_128 (0x0000001f, 0x0000001f);
- MaskRed = createMask_2x32_128 (0x00f80000, 0x00f80000);
- MaskGreen = createMask_2x32_128 (0x0000fc00, 0x0000fc00);
- MaskBlue = createMask_2x32_128 (0x000000f8, 0x000000f8);
- Mask565FixRB = createMask_2x32_128 (0x00e000e0, 0x00e000e0);
- Mask565FixG = createMask_2x32_128 (0x0000c000, 0x0000c000);
- Mask0080 = createMask_16_128 (0x0080);
- Mask00ff = createMask_16_128 (0x00ff);
- Mask0101 = createMask_16_128 (0x0101);
- Maskffff = createMask_16_128 (0xffff);
- Maskff000000 = createMask_2x32_128 (0xff000000, 0xff000000);
- MaskAlpha = createMask_2x32_128 (0x00ff0000, 0x00000000);
-
- /* MMX constants */
- xMask565rgb = createMask_2x32_64 (0x000001f0, 0x003f001f);
- xMask565Unpack = createMask_2x32_64 (0x00000084, 0x04100840);
-
- xMask0080 = createMask_16_64 (0x0080);
- xMask00ff = createMask_16_64 (0x00ff);
- xMask0101 = createMask_16_64 (0x0101);
- xMaskAlpha = createMask_2x32_64 (0x00ff0000, 0x00000000);
-
- /* SSE code patch for fbcompose.c */
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = sse2CombineOverU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN] = sse2CombineInU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT] = sse2CombineOutU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP] = sse2CombineAtopU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = sse2CombineXorU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = sse2CombineAddU;
-
- pixman_composeFunctions.combineU[PIXMAN_OP_SATURATE] = sse2CombineSaturateU;
-
- pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = sse2CombineSrcC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = sse2CombineOverC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN] = sse2CombineInC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT] = sse2CombineOutC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP] = sse2CombineAtopC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_XOR] = sse2CombineXorC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = sse2CombineAddC;
-
- _mm_empty();
}
initialized = TRUE;
@@ -5029,6 +4976,60 @@ _pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
pixman_implementation_t *mmx = _pixman_implementation_create_mmx (NULL);
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, mmx);
+ /* SSE2 constants */
+ Mask565r = createMask_2x32_128 (0x00f80000, 0x00f80000);
+ Mask565g1 = createMask_2x32_128 (0x00070000, 0x00070000);
+ Mask565g2 = createMask_2x32_128 (0x000000e0, 0x000000e0);
+ Mask565b = createMask_2x32_128 (0x0000001f, 0x0000001f);
+ MaskRed = createMask_2x32_128 (0x00f80000, 0x00f80000);
+ MaskGreen = createMask_2x32_128 (0x0000fc00, 0x0000fc00);
+ MaskBlue = createMask_2x32_128 (0x000000f8, 0x000000f8);
+ Mask565FixRB = createMask_2x32_128 (0x00e000e0, 0x00e000e0);
+ Mask565FixG = createMask_2x32_128 (0x0000c000, 0x0000c000);
+ Mask0080 = createMask_16_128 (0x0080);
+ Mask00ff = createMask_16_128 (0x00ff);
+ Mask0101 = createMask_16_128 (0x0101);
+ Maskffff = createMask_16_128 (0xffff);
+ Maskff000000 = createMask_2x32_128 (0xff000000, 0xff000000);
+ MaskAlpha = createMask_2x32_128 (0x00ff0000, 0x00000000);
+
+ /* MMX constants */
+ xMask565rgb = createMask_2x32_64 (0x000001f0, 0x003f001f);
+ xMask565Unpack = createMask_2x32_64 (0x00000084, 0x04100840);
+
+ xMask0080 = createMask_16_64 (0x0080);
+ xMask00ff = createMask_16_64 (0x00ff);
+ xMask0101 = createMask_16_64 (0x0101);
+ xMaskAlpha = createMask_2x32_64 (0x00ff0000, 0x00000000);
+
+ /* SSE code patch for fbcompose.c */
+ pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = sse2CombineOverU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_IN] = sse2CombineInU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_OUT] = sse2CombineOutU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_ATOP] = sse2CombineAtopU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = sse2CombineXorU;
+ pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = sse2CombineAddU;
+
+ pixman_composeFunctions.combineU[PIXMAN_OP_SATURATE] = sse2CombineSaturateU;
+
+ pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = sse2CombineSrcC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = sse2CombineOverC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_IN] = sse2CombineInC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_IN_REVERSE] = sse2CombineInReverseC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_OUT] = sse2CombineOutC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_OUT_REVERSE] = sse2CombineOutReverseC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_ATOP] = sse2CombineAtopC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = sse2CombineAtopReverseC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_XOR] = sse2CombineXorC;
+ pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = sse2CombineAddC;
+
+ _mm_empty();
+
imp->composite = sse2_composite;
return imp;
commit 03fa1bcb9af2cf48148b03c9a02cf5b4a7340356
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:50:55 2009 -0400
Move mmx fast path code to pixman-mmx.c
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 206bca1..75e01db 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -393,18 +393,10 @@ general_composite (pixman_implementation_t * imp,
pixman_bool_t srcTransform = src->common.transform != NULL;
pixman_bool_t maskTransform = FALSE;
-#ifdef USE_MMX
- fbComposeSetupMMX();
-#endif
-
#ifdef USE_VMX
fbComposeSetupVMX();
#endif
-#ifdef USE_SSE2
- fbComposeSetupSSE2();
-#endif
-
if (srcRepeat && srcTransform &&
src->bits.width == 1 &&
src->bits.height == 1)
@@ -428,16 +420,6 @@ general_composite (pixman_implementation_t * imp,
}
}
-#ifdef USE_MMX
- if (_pixman_run_fast_path (mmx_fast_paths, imp,
- op, src, mask, dest,
- src_x, src_y,
- mask_x, mask_y,
- dest_x, dest_y,
- width, height))
- return;
-#endif
-
#ifdef USE_VMX
if (_pixman_run_fast_path (vmx_fast_paths, imp,
op, src, mask, dest,
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 8f18b06..0205d0e 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3140,39 +3140,66 @@ static const FastPathInfo mmx_fast_path_array[] =
};
const FastPathInfo *const mmx_fast_paths = mmx_fast_path_array;
+static void
+mmx_composite (pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
+ if (_pixman_run_fast_path (mmx_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
+
+ _pixman_implementation_composite (imp->delegate,
+ op, src, mask, dest, src_x, src_y,
+ mask_x, mask_y, dest_x, dest_y,
+ width, height);
+}
+
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
{
pixman_implementation_t *general = _pixman_implementation_create_fast_path (NULL);
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, general);
- /* check if we have MMX support and initialize accordingly */
- if (pixman_have_mmx())
- {
- imp->combine_32[PIXMAN_OP_OVER] = mmxCombineOverU;
- imp->combine_32[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU;
- imp->combine_32[PIXMAN_OP_IN] = mmxCombineInU;
- imp->combine_32[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseU;
- imp->combine_32[PIXMAN_OP_OUT] = mmxCombineOutU;
- imp->combine_32[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseU;
- imp->combine_32[PIXMAN_OP_ATOP] = mmxCombineAtopU;
- imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseU;
- imp->combine_32[PIXMAN_OP_XOR] = mmxCombineXorU;
- imp->combine_32[PIXMAN_OP_ADD] = mmxCombineAddU;
- imp->combine_32[PIXMAN_OP_SATURATE] = mmxCombineSaturateU;
-
- imp->combine_32_ca[PIXMAN_OP_SRC] = mmxCombineSrcC;
- imp->combine_32_ca[PIXMAN_OP_OVER] = mmxCombineOverC;
- imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseC;
- imp->combine_32_ca[PIXMAN_OP_IN] = mmxCombineInC;
- imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseC;
- imp->combine_32_ca[PIXMAN_OP_OUT] = mmxCombineOutC;
- imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseC;
- imp->combine_32_ca[PIXMAN_OP_ATOP] = mmxCombineAtopC;
- imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseC;
- imp->combine_32_ca[PIXMAN_OP_XOR] = mmxCombineXorC;
- imp->combine_32_ca[PIXMAN_OP_ADD] = mmxCombineAddC;
- }
+ imp->combine_32[PIXMAN_OP_OVER] = mmxCombineOverU;
+ imp->combine_32[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU;
+ imp->combine_32[PIXMAN_OP_IN] = mmxCombineInU;
+ imp->combine_32[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseU;
+ imp->combine_32[PIXMAN_OP_OUT] = mmxCombineOutU;
+ imp->combine_32[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseU;
+ imp->combine_32[PIXMAN_OP_ATOP] = mmxCombineAtopU;
+ imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseU;
+ imp->combine_32[PIXMAN_OP_XOR] = mmxCombineXorU;
+ imp->combine_32[PIXMAN_OP_ADD] = mmxCombineAddU;
+ imp->combine_32[PIXMAN_OP_SATURATE] = mmxCombineSaturateU;
+
+ imp->combine_32_ca[PIXMAN_OP_SRC] = mmxCombineSrcC;
+ imp->combine_32_ca[PIXMAN_OP_OVER] = mmxCombineOverC;
+ imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseC;
+ imp->combine_32_ca[PIXMAN_OP_IN] = mmxCombineInC;
+ imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseC;
+ imp->combine_32_ca[PIXMAN_OP_OUT] = mmxCombineOutC;
+ imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP] = mmxCombineAtopC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseC;
+ imp->combine_32_ca[PIXMAN_OP_XOR] = mmxCombineXorC;
+ imp->combine_32_ca[PIXMAN_OP_ADD] = mmxCombineAddC;
+
+ imp->composite = mmx_composite;
return imp;
}
commit 6e13149f99d7922ae84086f7867c9a9b69a49203
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:44:45 2009 -0400
Move sse2 fast path running to the sse2 implementation
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 49b6f52..206bca1 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -428,16 +428,6 @@ general_composite (pixman_implementation_t * imp,
}
}
-#ifdef USE_SSE2
- if (_pixman_run_fast_path (sse2_fast_paths, imp,
- op, src, mask, dest,
- src_x, src_y,
- mask_x, mask_y,
- dest_x, dest_y,
- width, height))
- return;
-#endif
-
#ifdef USE_MMX
if (_pixman_run_fast_path (mmx_fast_paths, imp,
op, src, mask, dest,
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 135a5f3..0c2f80b 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4990,12 +4990,47 @@ static const FastPathInfo sse2_fast_path_array[] =
const FastPathInfo *const sse2_fast_paths = sse2_fast_path_array;
+static void
+sse2_composite (pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
+ if (_pixman_run_fast_path (sse2_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ {
+ return;
+ }
+
+ _pixman_implementation_composite (imp->delegate, op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height);
+}
+
pixman_implementation_t *
_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
{
pixman_implementation_t *mmx = _pixman_implementation_create_mmx (NULL);
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, mmx);
+ imp->composite = sse2_composite;
+
return imp;
}
commit cb8608bba4f212aceef0cf579c650ee4988f56bd
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:42:42 2009 -0400
Change pixman_lookup_fast_path() to actually run the fast path
Then just return in the general implementation if we ran a fast path.
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index b3b4fd4..49b6f52 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -392,7 +392,6 @@ general_composite (pixman_implementation_t * imp,
pixman_bool_t maskRepeat = FALSE;
pixman_bool_t srcTransform = src->common.transform != NULL;
pixman_bool_t maskTransform = FALSE;
- pixman_composite_func_t func = NULL;
#ifdef USE_MMX
fbComposeSetupMMX();
@@ -430,61 +429,86 @@ general_composite (pixman_implementation_t * imp,
}
#ifdef USE_SSE2
- if (!func)
- func = _pixman_lookup_fast_path (sse2_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
+ if (_pixman_run_fast_path (sse2_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
#endif
#ifdef USE_MMX
- if (!func)
- func = _pixman_lookup_fast_path (mmx_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
+ if (_pixman_run_fast_path (mmx_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
#endif
#ifdef USE_VMX
- if (!func)
- func = _pixman_lookup_fast_path (vmx_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
+ if (_pixman_run_fast_path (vmx_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
#endif
#ifdef USE_ARM_NEON
- if (!func && pixman_have_arm_neon())
- func = _pixman_lookup_fast_path (arm_neon_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
+ if (pixman_have_arm_neon() && _pixman_run_fast_path (arm_neon_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
#endif
#ifdef USE_ARM_SIMD
- if (!func && pixman_have_arm_simd())
- func = _pixman_lookup_fast_path (arm_neon_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
+ if (pixman_have_arm_simd() && _pixman_run_fast_path (arm_simd_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
#endif
- if (!func)
- func = _pixman_lookup_fast_path (c_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
-
- if (!func)
+ if (pixman_have_arm_simd() && _pixman_run_fast_path (c_fast_paths, imp,
+ op, src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height))
+ return;
+
+ /* CompositeGeneral optimizes 1x1 repeating images itself */
+ if (src->type == BITS &&
+ src->bits.width == 1 && src->bits.height == 1)
{
- func = pixman_image_composite_rect;
-
- /* CompositeGeneral optimizes 1x1 repeating images itself */
- if (src->type == BITS &&
- src->bits.width == 1 && src->bits.height == 1)
- {
- srcRepeat = FALSE;
- }
-
- if (mask && mask->type == BITS &&
- mask->bits.width == 1 && mask->bits.height == 1)
- {
- maskRepeat = FALSE;
- }
-
- /* if we are transforming, repeats are handled in fbFetchTransformed */
- if (srcTransform)
- srcRepeat = FALSE;
-
- if (maskTransform)
- maskRepeat = FALSE;
+ srcRepeat = FALSE;
}
+
+ if (mask && mask->type == BITS &&
+ mask->bits.width == 1 && mask->bits.height == 1)
+ {
+ maskRepeat = FALSE;
+ }
+
+ /* if we are transforming, repeats are handled in fbFetchTransformed */
+ if (srcTransform)
+ srcRepeat = FALSE;
+
+ if (maskTransform)
+ maskRepeat = FALSE;
_pixman_walk_composite_region (imp, op, src, mask, dest, src_x, src_y,
- mask_x, mask_y, dest_x, dest_y, width, height,
- srcRepeat, maskRepeat, func);
+ mask_x, mask_y, dest_x, dest_y, width, height,
+ srcRepeat, maskRepeat, pixman_image_composite_rect);
}
pixman_implementation_t *
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 8694501..0e46704 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -1010,16 +1010,21 @@ pixman_implementation_t *
_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel);
#endif
-pixman_composite_func_t
-_pixman_lookup_fast_path (const FastPathInfo *paths,
- pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int32_t src_x,
- int32_t src_y,
- int32_t mask_x,
- int32_t mask_y);
+pixman_bool_t
+_pixman_run_fast_path (const FastPathInfo *paths,
+ pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height);
pixman_implementation_t *
_pixman_choose_implementation (void);
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index afb0c2a..9e9ba7b 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -765,16 +765,21 @@ get_fast_path (const FastPathInfo *fast_paths,
return NULL;
}
-pixman_composite_func_t
-_pixman_lookup_fast_path (const FastPathInfo *paths,
- pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int32_t src_x,
- int32_t src_y,
- int32_t mask_x,
- int32_t mask_y)
+pixman_bool_t
+_pixman_run_fast_path (const FastPathInfo *paths,
+ pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
{
pixman_composite_func_t func = NULL;
pixman_bool_t src_repeat = src->common.repeat == PIXMAN_REPEAT_NORMAL;
@@ -840,5 +845,17 @@ _pixman_lookup_fast_path (const FastPathInfo *paths,
}
}
- return func;
+ if (func)
+ {
+ _pixman_walk_composite_region (imp, op,
+ src, mask, dest,
+ src_x, src_y, mask_x, mask_y,
+ dest_x, dest_y,
+ width, height,
+ src_repeat, mask_repeat,
+ func);
+ return TRUE;
+ }
+
+ return FALSE;
}
commit bee5549f6b469989a45cb3bcd4a916a6799c182d
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:26:42 2009 -0400
Add _pixman_choose_implementation
diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c
index dc68b31..96c62a6 100644
--- a/pixman/pixman-cpu.c
+++ b/pixman/pixman-cpu.c
@@ -496,3 +496,19 @@ pixman_have_sse2 (void)
#endif /* __amd64__ */
#endif
+
+pixman_implementation_t *
+_pixman_choose_implementation (void)
+{
+#ifdef USE_SSE2
+ if (pixman_have_sse2 ())
+ return _pixman_implementation_create_sse2 (NULL);
+#endif
+#ifdef USE_MMX
+ if (pixman_have_mmx())
+ return _pixman_implementation_create_mmx (NULL);
+#endif
+ return _pixman_implementation_create_fast_path (NULL);
+}
+
+
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 18ec4f8..2c738f3 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -127,7 +127,7 @@ pixman_image_composite (pixman_op_t op,
return;
if (!imp)
- imp = _pixman_implementation_create_fast_path (NULL);
+ imp = _pixman_choose_implementation();
_pixman_implementation_composite (imp, op,
src, mask, dest,
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index c5e9288..8694501 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -1021,4 +1021,7 @@ _pixman_lookup_fast_path (const FastPathInfo *paths,
int32_t mask_x,
int32_t mask_y);
+pixman_implementation_t *
+_pixman_choose_implementation (void);
+
#endif /* PIXMAN_PRIVATE_H */
commit 713fb295761f13989bc0da31c26b3a1535ab449e
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:21:37 2009 -0400
Remove fast path lookup code from pixman-general
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index f507aad..b3b4fd4 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -353,83 +353,6 @@ pixman_image_composite_rect (pixman_implementation_t *imp,
general_composite_rect (&compose_data);
}
-static pixman_bool_t
-mask_is_solid (pixman_image_t *mask)
-{
- if (mask->type == SOLID)
- return TRUE;
-
- if (mask->type == BITS &&
- mask->common.repeat == PIXMAN_REPEAT_NORMAL &&
- mask->bits.width == 1 &&
- mask->bits.height == 1)
- {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static const FastPathInfo *
-get_fast_path (const FastPathInfo *fast_paths,
- pixman_op_t op,
- pixman_image_t *pSrc,
- pixman_image_t *pMask,
- pixman_image_t *pDst,
- pixman_bool_t is_pixbuf)
-{
- const FastPathInfo *info;
-
- for (info = fast_paths; info->op != PIXMAN_OP_NONE; info++)
- {
- pixman_bool_t valid_src = FALSE;
- pixman_bool_t valid_mask = FALSE;
-
- if (info->op != op)
- continue;
-
- if ((info->src_format == PIXMAN_solid && pixman_image_can_get_solid (pSrc)) ||
- (pSrc->type == BITS && info->src_format == pSrc->bits.format))
- {
- valid_src = TRUE;
- }
-
- if (!valid_src)
- continue;
-
- if ((info->mask_format == PIXMAN_null && !pMask) ||
- (pMask && pMask->type == BITS && info->mask_format == pMask->bits.format))
- {
- valid_mask = TRUE;
-
- if (info->flags & NEED_SOLID_MASK)
- {
- if (!pMask || !mask_is_solid (pMask))
- valid_mask = FALSE;
- }
-
- if (info->flags & NEED_COMPONENT_ALPHA)
- {
- if (!pMask || !pMask->common.component_alpha)
- valid_mask = FALSE;
- }
- }
-
- if (!valid_mask)
- continue;
-
- if (info->dest_format != pDst->bits.format)
- continue;
-
- if ((info->flags & NEED_PIXBUF) && !is_pixbuf)
- continue;
-
- return info;
- }
-
- return NULL;
-}
-
#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
/*
@@ -469,9 +392,6 @@ general_composite (pixman_implementation_t * imp,
pixman_bool_t maskRepeat = FALSE;
pixman_bool_t srcTransform = src->common.transform != NULL;
pixman_bool_t maskTransform = FALSE;
- pixman_bool_t srcAlphaMap = src->common.alpha_map != NULL;
- pixman_bool_t maskAlphaMap = FALSE;
- pixman_bool_t dstAlphaMap = dest->common.alpha_map != NULL;
pixman_composite_func_t func = NULL;
#ifdef USE_MMX
@@ -501,8 +421,6 @@ general_composite (pixman_implementation_t * imp,
if (mask->common.filter == PIXMAN_FILTER_CONVOLUTION)
maskTransform = TRUE;
- maskAlphaMap = mask->common.alpha_map != 0;
-
if (maskRepeat && maskTransform &&
mask->bits.width == 1 &&
mask->bits.height == 1)
@@ -510,93 +428,34 @@ general_composite (pixman_implementation_t * imp,
maskTransform = FALSE;
}
}
-
- if ((src->type == BITS || pixman_image_can_get_solid (src)) && (!mask || mask->type == BITS)
- && !srcTransform && !maskTransform
- && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
- && (src->common.filter != PIXMAN_FILTER_CONVOLUTION)
- && (src->common.repeat != PIXMAN_REPEAT_PAD)
- && (src->common.repeat != PIXMAN_REPEAT_REFLECT)
- && (!mask || (mask->common.filter != PIXMAN_FILTER_CONVOLUTION &&
- mask->common.repeat != PIXMAN_REPEAT_PAD && mask->common.repeat != PIXMAN_REPEAT_REFLECT))
- && !src->common.read_func && !src->common.write_func
- && !(mask && mask->common.read_func) && !(mask && mask->common.write_func)
- && !dest->common.read_func && !dest->common.write_func)
- {
- const FastPathInfo *info;
- pixman_bool_t pixbuf;
-
- pixbuf =
- src && src->type == BITS &&
- mask && mask->type == BITS &&
- src->bits.bits == mask->bits.bits &&
- src_x == mask_x &&
- src_y == mask_y &&
- !mask->common.component_alpha &&
- !maskRepeat;
- info = NULL;
-
+
#ifdef USE_SSE2
- if (pixman_have_sse2 ())
- info = get_fast_path (sse2_fast_paths, op, src, mask, dest, pixbuf);
+ if (!func)
+ func = _pixman_lookup_fast_path (sse2_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
#endif
#ifdef USE_MMX
- if (!info && pixman_have_mmx())
- info = get_fast_path (mmx_fast_paths, op, src, mask, dest, pixbuf);
+ if (!func)
+ func = _pixman_lookup_fast_path (mmx_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
#endif
#ifdef USE_VMX
-
- if (!info && pixman_have_vmx())
- info = get_fast_path (vmx_fast_paths, op, src, mask, dest, pixbuf);
+ if (!func)
+ func = _pixman_lookup_fast_path (vmx_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
#endif
#ifdef USE_ARM_NEON
- if (!info && pixman_have_arm_neon())
- info = get_fast_path (arm_neon_fast_paths, op, src, mask, dest, pixbuf);
+ if (!func && pixman_have_arm_neon())
+ func = _pixman_lookup_fast_path (arm_neon_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
#endif
#ifdef USE_ARM_SIMD
- if (!info && pixman_have_arm_simd())
- info = get_fast_path (arm_simd_fast_paths, op, src, mask, dest, pixbuf);
+ if (!func && pixman_have_arm_simd())
+ func = _pixman_lookup_fast_path (arm_neon_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
#endif
- if (!info)
- info = get_fast_path (c_fast_paths, op, src, mask, dest, pixbuf);
-
- if (info)
- {
- func = info->func;
-
- if (info->src_format == PIXMAN_solid)
- srcRepeat = FALSE;
-
- if (info->mask_format == PIXMAN_solid ||
- info->flags & NEED_SOLID_MASK)
- {
- maskRepeat = FALSE;
- }
- }
- }
-
- if ((srcRepeat &&
- src->bits.width == 1 &&
- src->bits.height == 1) ||
- (maskRepeat &&
- mask->bits.width == 1 &&
- mask->bits.height == 1))
- {
- /* If src or mask are repeating 1x1 images and srcRepeat or
- * maskRepeat are still TRUE, it means the fast path we
- * selected does not actually handle repeating images.
- *
- * So rather than call the "fast path" with a zillion
- * 1x1 requests, we just use the general code (which does
- * do something sensible with 1x1 repeating images).
- */
- func = NULL;
- }
+ if (!func)
+ func = _pixman_lookup_fast_path (c_fast_paths, op, src, mask, dest, src_x, src_y, mask_x, mask_y);
if (!func)
{
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index b7b7c5d..c5e9288 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -1009,5 +1009,16 @@ _pixman_implementation_create_mmx (pixman_implementation_t *toplevel);
pixman_implementation_t *
_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel);
#endif
+
+pixman_composite_func_t
+_pixman_lookup_fast_path (const FastPathInfo *paths,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y);
#endif /* PIXMAN_PRIVATE_H */
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index b7c692b..afb0c2a 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -766,24 +766,24 @@ get_fast_path (const FastPathInfo *fast_paths,
}
pixman_composite_func_t
-_pixman_look_up_fast_path (const FastPathInfo *paths,
- pixman_op_t op,
- pixman_image_t *src,
- pixman_image_t *mask,
- pixman_image_t *dest,
- int32_t src_x,
- int32_t src_y,
- int32_t mask_x,
- int32_t mask_y)
+_pixman_lookup_fast_path (const FastPathInfo *paths,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y)
{
pixman_composite_func_t func = NULL;
pixman_bool_t src_repeat = src->common.repeat == PIXMAN_REPEAT_NORMAL;
- pixman_bool_t mask_repeat = mask->common.repeat == PIXMAN_REPEAT_NORMAL;
+ pixman_bool_t mask_repeat = mask && mask->common.repeat == PIXMAN_REPEAT_NORMAL;
if ((src->type == BITS || pixman_image_can_get_solid (src)) &&
(!mask || mask->type == BITS)
- && !src->common.transform && !mask->common.transform
- && !mask->common.alpha_map && !src->common.alpha_map && !dest->common.alpha_map
+ && !src->common.transform && !(mask && mask->common.transform)
+ && !(mask && mask->common.alpha_map) && !src->common.alpha_map && !dest->common.alpha_map
&& (src->common.filter != PIXMAN_FILTER_CONVOLUTION)
&& (src->common.repeat != PIXMAN_REPEAT_PAD)
&& (src->common.repeat != PIXMAN_REPEAT_REFLECT)
commit f5837da6e24cb1adf116f42724b83948c70476f0
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:12:04 2009 -0400
Beginning of sse2 implementation
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index a8c6ce4..b7b7c5d 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -1005,5 +1005,9 @@ _pixman_implementation_create_fast_path (pixman_implementation_t *toplevel);
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel);
#endif
-
+#ifdef USE_SSE2
+pixman_implementation_t *
+_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel);
+#endif
+
#endif /* PIXMAN_PRIVATE_H */
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index d3524f4..135a5f3 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4990,4 +4990,13 @@ static const FastPathInfo sse2_fast_path_array[] =
const FastPathInfo *const sse2_fast_paths = sse2_fast_path_array;
+pixman_implementation_t *
+_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
+{
+ pixman_implementation_t *mmx = _pixman_implementation_create_mmx (NULL);
+ pixman_implementation_t *imp = _pixman_implementation_create (toplevel, mmx);
+
+ return imp;
+}
+
#endif /* USE_SSE2 */
commit 9a25f0fb672c2b6aee488958cf7f7c6e9ea3a33b
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 09:06:19 2009 -0400
Copy fast path lookup code into pixman-utils.c
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index e445c3c..b7c692b 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -688,3 +688,157 @@ _pixman_walk_composite_region (pixman_implementation_t *imp,
pixman_region32_fini (®);
}
+static pixman_bool_t
+mask_is_solid (pixman_image_t *mask)
+{
+ if (mask->type == SOLID)
+ return TRUE;
+
+ if (mask->type == BITS &&
+ mask->common.repeat == PIXMAN_REPEAT_NORMAL &&
+ mask->bits.width == 1 &&
+ mask->bits.height == 1)
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static const FastPathInfo *
+get_fast_path (const FastPathInfo *fast_paths,
+ pixman_op_t op,
+ pixman_image_t *pSrc,
+ pixman_image_t *pMask,
+ pixman_image_t *pDst,
+ pixman_bool_t is_pixbuf)
+{
+ const FastPathInfo *info;
+
+ for (info = fast_paths; info->op != PIXMAN_OP_NONE; info++)
+ {
+ pixman_bool_t valid_src = FALSE;
+ pixman_bool_t valid_mask = FALSE;
+
+ if (info->op != op)
+ continue;
+
+ if ((info->src_format == PIXMAN_solid && pixman_image_can_get_solid (pSrc)) ||
+ (pSrc->type == BITS && info->src_format == pSrc->bits.format))
+ {
+ valid_src = TRUE;
+ }
+
+ if (!valid_src)
+ continue;
+
+ if ((info->mask_format == PIXMAN_null && !pMask) ||
+ (pMask && pMask->type == BITS && info->mask_format == pMask->bits.format))
+ {
+ valid_mask = TRUE;
+
+ if (info->flags & NEED_SOLID_MASK)
+ {
+ if (!pMask || !mask_is_solid (pMask))
+ valid_mask = FALSE;
+ }
+
+ if (info->flags & NEED_COMPONENT_ALPHA)
+ {
+ if (!pMask || !pMask->common.component_alpha)
+ valid_mask = FALSE;
+ }
+ }
+
+ if (!valid_mask)
+ continue;
+
+ if (info->dest_format != pDst->bits.format)
+ continue;
+
+ if ((info->flags & NEED_PIXBUF) && !is_pixbuf)
+ continue;
+
+ return info;
+ }
+
+ return NULL;
+}
+
+pixman_composite_func_t
+_pixman_look_up_fast_path (const FastPathInfo *paths,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y)
+{
+ pixman_composite_func_t func = NULL;
+ pixman_bool_t src_repeat = src->common.repeat == PIXMAN_REPEAT_NORMAL;
+ pixman_bool_t mask_repeat = mask->common.repeat == PIXMAN_REPEAT_NORMAL;
+
+ if ((src->type == BITS || pixman_image_can_get_solid (src)) &&
+ (!mask || mask->type == BITS)
+ && !src->common.transform && !mask->common.transform
+ && !mask->common.alpha_map && !src->common.alpha_map && !dest->common.alpha_map
+ && (src->common.filter != PIXMAN_FILTER_CONVOLUTION)
+ && (src->common.repeat != PIXMAN_REPEAT_PAD)
+ && (src->common.repeat != PIXMAN_REPEAT_REFLECT)
+ && (!mask || (mask->common.filter != PIXMAN_FILTER_CONVOLUTION &&
+ mask->common.repeat != PIXMAN_REPEAT_PAD &&
+ mask->common.repeat != PIXMAN_REPEAT_REFLECT))
+ && !src->common.read_func && !src->common.write_func
+ && !(mask && mask->common.read_func)
+ && !(mask && mask->common.write_func)
+ && !dest->common.read_func
+ && !dest->common.write_func)
+ {
+ const FastPathInfo *info;
+ pixman_bool_t pixbuf;
+
+ pixbuf =
+ src && src->type == BITS &&
+ mask && mask->type == BITS &&
+ src->bits.bits == mask->bits.bits &&
+ src_x == mask_x &&
+ src_y == mask_y &&
+ !mask->common.component_alpha &&
+ !mask_repeat;
+
+ info = get_fast_path (paths, op, src, mask, dest, pixbuf);
+
+ if (info)
+ {
+ func = info->func;
+
+ if (info->src_format == PIXMAN_solid)
+ src_repeat = FALSE;
+
+ if (info->mask_format == PIXMAN_solid || info->flags & NEED_SOLID_MASK)
+ mask_repeat = FALSE;
+
+ if ((src_repeat &&
+ src->bits.width == 1 &&
+ src->bits.height == 1) ||
+ (mask_repeat &&
+ mask->bits.width == 1 &&
+ mask->bits.height == 1))
+ {
+ /* If src or mask are repeating 1x1 images and src_repeat or
+ * mask_repeat are still TRUE, it means the fast path we
+ * selected does not actually handle repeating images.
+ *
+ * So rather than call the "fast path" with a zillion
+ * 1x1 requests, we just fall back to the general code (which
+ * does do something sensible with 1x1 repeating images).
+ */
+ func = NULL;
+ }
+ }
+ }
+
+ return func;
+}
commit 248ef3ec24bfcb4759f12e1839456c0c422b994c
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 08:51:09 2009 -0400
Initial fast path implementation
Move fbSrcScaleNearest() here, and move
_pixman_walk_composite_region() to pixman-utils.c
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 62a39d1..8025233 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1071,3 +1071,165 @@ static const FastPathInfo c_fast_path_array[] =
};
const FastPathInfo *const c_fast_paths = c_fast_path_array;
+
+static void
+fbCompositeSrcScaleNearest (pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *pSrc,
+ pixman_image_t *pMask,
+ pixman_image_t *pDst,
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
+{
+ uint32_t *dst;
+ uint32_t *src;
+ int dstStride, srcStride;
+ int i, j;
+ pixman_vector_t v;
+
+ fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dst, 1);
+ /* pass in 0 instead of xSrc and ySrc because xSrc and ySrc need to be
+ * transformed from destination space to source space */
+ fbComposeGetStart (pSrc, 0, 0, uint32_t, srcStride, src, 1);
+
+ /* reference point is the center of the pixel */
+ v.vector[0] = pixman_int_to_fixed(xSrc) + pixman_fixed_1 / 2;
+ v.vector[1] = pixman_int_to_fixed(ySrc) + pixman_fixed_1 / 2;
+ v.vector[2] = pixman_fixed_1;
+
+ if (!pixman_transform_point_3d (pSrc->common.transform, &v))
+ return;
+
+ /* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */
+ v.vector[0] -= pixman_fixed_e;
+ v.vector[1] -= pixman_fixed_e;
+
+ for (j = 0; j < height; j++) {
+ pixman_fixed_t vx = v.vector[0];
+ pixman_fixed_t vy = v.vector[1];
+ for (i = 0; i < width; ++i) {
+ pixman_bool_t inside_bounds;
+ uint32_t result;
+ int x, y;
+ x = vx >> 16;
+ y = vy >> 16;
+
+ /* apply the repeat function */
+ switch (pSrc->common.repeat) {
+ case PIXMAN_REPEAT_NORMAL:
+ x = MOD (x, pSrc->bits.width);
+ y = MOD (y, pSrc->bits.height);
+ inside_bounds = TRUE;
+ break;
+
+ case PIXMAN_REPEAT_PAD:
+ x = CLIP (x, 0, pSrc->bits.width-1);
+ y = CLIP (y, 0, pSrc->bits.height-1);
+ inside_bounds = TRUE;
+ break;
+
+ case PIXMAN_REPEAT_REFLECT:
+ x = MOD (x, pSrc->bits.width * 2);
+ if (x >= pSrc->bits.width)
+ x = pSrc->bits.width * 2 - x - 1;
+ y = MOD (y, pSrc->bits.height * 2);
+ if (y >= pSrc->bits.height)
+ y = pSrc->bits.height * 2 - y - 1;
+ inside_bounds = TRUE;
+ break;
+
+ case PIXMAN_REPEAT_NONE:
+ default:
+ inside_bounds = (x >= 0 && x < pSrc->bits.width && y >= 0 && y < pSrc->bits.height);
+ break;
+ }
+
+ if (inside_bounds) {
+ //XXX: we should move this multiplication out of the loop
+ result = READ(pSrc, src + y * srcStride + x);
+ } else {
+ result = 0;
+ }
+ WRITE(pDst, dst + i, result);
+
+ /* adjust the x location by a unit vector in the x direction:
+ * this is equivalent to transforming x+1 of the destination point to source space */
+ vx += pSrc->common.transform->matrix[0][0];
+ }
+ /* adjust the y location by a unit vector in the y direction
+ * this is equivalent to transforming y+1 of the destination point to source space */
+ v.vector[1] += pSrc->common.transform->matrix[1][1];
+ dst += dstStride;
+ }
+}
+
+static void
+fast_path_composite (pixman_implementation_t *imp,
+ pixman_op_t op,
+ pixman_image_t *src,
+ pixman_image_t *mask,
+ pixman_image_t *dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
+ if (src->type == BITS
+ && src->common.transform
+ && !mask
+ && op == PIXMAN_OP_SRC
+ && !src->common.alpha_map && !dest->common.alpha_map
+ && (src->common.filter == PIXMAN_FILTER_NEAREST)
+ && PIXMAN_FORMAT_BPP(dest->bits.format) == 32
+ && src->bits.format == dest->bits.format
+ && src->common.src_clip == &(src->common.full_region)
+ && !src->common.read_func && !src->common.write_func
+ && !dest->common.read_func && !dest->common.write_func)
+ {
+ /* ensure that the transform matrix only has a scale */
+ if (src->common.transform->matrix[0][1] == 0 &&
+ src->common.transform->matrix[1][0] == 0 &&
+ src->common.transform->matrix[2][0] == 0 &&
+ src->common.transform->matrix[2][1] == 0 &&
+ src->common.transform->matrix[2][2] == pixman_fixed_1)
+ {
+ _pixman_walk_composite_region (imp, op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height,
+ FALSE, FALSE,
+ fbCompositeSrcScaleNearest);
+ return;
+ }
+ }
+
+ _pixman_implementation_composite (imp->delegate, op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height);
+}
+
+pixman_implementation_t *
+_pixman_implementation_create_fast_path (pixman_implementation_t *toplevel)
+{
+ pixman_implementation_t *general = _pixman_implementation_create_general (NULL);
+ pixman_implementation_t *imp = _pixman_implementation_create (toplevel, general);
+
+ imp->composite = fast_path_composite;
+
+ return imp;
+}
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 734dfce..f507aad 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -318,197 +318,6 @@ general_composite_rect (const FbComposeData *data)
#include "pixman-combine32.h"
static void
-fbCompositeSrcScaleNearest (pixman_implementation_t *imp,
- pixman_op_t op,
- pixman_image_t *pSrc,
- pixman_image_t *pMask,
- pixman_image_t *pDst,
- int32_t xSrc,
- int32_t ySrc,
- int32_t xMask,
- int32_t yMask,
- int32_t xDst,
- int32_t yDst,
- int32_t width,
- int32_t height)
-{
- uint32_t *dst;
- uint32_t *src;
- int dstStride, srcStride;
- int i, j;
- pixman_vector_t v;
-
- fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dst, 1);
- /* pass in 0 instead of xSrc and ySrc because xSrc and ySrc need to be
- * transformed from destination space to source space */
- fbComposeGetStart (pSrc, 0, 0, uint32_t, srcStride, src, 1);
-
- /* reference point is the center of the pixel */
- v.vector[0] = pixman_int_to_fixed(xSrc) + pixman_fixed_1 / 2;
- v.vector[1] = pixman_int_to_fixed(ySrc) + pixman_fixed_1 / 2;
- v.vector[2] = pixman_fixed_1;
-
- if (!pixman_transform_point_3d (pSrc->common.transform, &v))
- return;
-
- /* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */
- v.vector[0] -= pixman_fixed_e;
- v.vector[1] -= pixman_fixed_e;
-
- for (j = 0; j < height; j++) {
- pixman_fixed_t vx = v.vector[0];
- pixman_fixed_t vy = v.vector[1];
- for (i = 0; i < width; ++i) {
- pixman_bool_t inside_bounds;
- uint32_t result;
- int x, y;
- x = vx >> 16;
- y = vy >> 16;
-
- /* apply the repeat function */
- switch (pSrc->common.repeat) {
- case PIXMAN_REPEAT_NORMAL:
- x = MOD (x, pSrc->bits.width);
- y = MOD (y, pSrc->bits.height);
- inside_bounds = TRUE;
- break;
-
- case PIXMAN_REPEAT_PAD:
- x = CLIP (x, 0, pSrc->bits.width-1);
- y = CLIP (y, 0, pSrc->bits.height-1);
- inside_bounds = TRUE;
- break;
-
- case PIXMAN_REPEAT_REFLECT:
- x = MOD (x, pSrc->bits.width * 2);
- if (x >= pSrc->bits.width)
- x = pSrc->bits.width * 2 - x - 1;
- y = MOD (y, pSrc->bits.height * 2);
- if (y >= pSrc->bits.height)
- y = pSrc->bits.height * 2 - y - 1;
- inside_bounds = TRUE;
- break;
-
- case PIXMAN_REPEAT_NONE:
- default:
- inside_bounds = (x >= 0 && x < pSrc->bits.width && y >= 0 && y < pSrc->bits.height);
- break;
- }
-
- if (inside_bounds) {
- //XXX: we should move this multiplication out of the loop
- result = READ(pSrc, src + y * srcStride + x);
- } else {
- result = 0;
- }
- WRITE(pDst, dst + i, result);
-
- /* adjust the x location by a unit vector in the x direction:
- * this is equivalent to transforming x+1 of the destination point to source space */
- vx += pSrc->common.transform->matrix[0][0];
- }
- /* adjust the y location by a unit vector in the y direction
- * this is equivalent to transforming y+1 of the destination point to source space */
- v.vector[1] += pSrc->common.transform->matrix[1][1];
- dst += dstStride;
- }
-}
-
-static void
-pixman_walk_composite_region (pixman_implementation_t *imp,
- 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,
- pixman_bool_t srcRepeat,
- pixman_bool_t maskRepeat,
- pixman_composite_func_t compositeRect)
-{
- int n;
- const pixman_box32_t *pbox;
- int w, h, w_this, h_this;
- int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
- pixman_region32_t reg;
- pixman_region32_t *region;
-
- pixman_region32_init (®);
- if (!pixman_compute_composite_region32 (®, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))
- {
- return;
- }
-
- region = ®
-
- pbox = pixman_region32_rectangles (region, &n);
- while (n--)
- {
- h = pbox->y2 - pbox->y1;
- y_src = pbox->y1 - yDst + ySrc;
- y_msk = pbox->y1 - yDst + yMask;
- y_dst = pbox->y1;
- while (h)
- {
- h_this = h;
- w = pbox->x2 - pbox->x1;
- x_src = pbox->x1 - xDst + xSrc;
- x_msk = pbox->x1 - xDst + xMask;
- x_dst = pbox->x1;
- if (maskRepeat)
- {
- y_msk = MOD (y_msk, pMask->bits.height);
- if (h_this > pMask->bits.height - y_msk)
- h_this = pMask->bits.height - y_msk;
- }
- if (srcRepeat)
- {
- y_src = MOD (y_src, pSrc->bits.height);
- if (h_this > pSrc->bits.height - y_src)
- h_this = pSrc->bits.height - y_src;
- }
- while (w)
- {
- w_this = w;
- if (maskRepeat)
- {
- x_msk = MOD (x_msk, pMask->bits.width);
- if (w_this > pMask->bits.width - x_msk)
- w_this = pMask->bits.width - x_msk;
- }
- if (srcRepeat)
- {
- x_src = MOD (x_src, pSrc->bits.width);
- if (w_this > pSrc->bits.width - x_src)
- w_this = pSrc->bits.width - x_src;
- }
- (*compositeRect) (imp,
- op, pSrc, pMask, pDst,
- x_src, y_src, x_msk, y_msk, x_dst, y_dst,
- w_this, h_this);
- w -= w_this;
- x_src += w_this;
- x_msk += w_this;
- x_dst += w_this;
- }
- h -= h_this;
- y_src += h_this;
- y_msk += h_this;
- y_dst += h_this;
- }
- pbox++;
- }
- pixman_region32_fini (®);
-}
-
-static void
pixman_image_composite_rect (pixman_implementation_t *imp,
pixman_op_t op,
pixman_image_t *src,
@@ -702,29 +511,7 @@ general_composite (pixman_implementation_t * imp,
}
}
- if (src->type == BITS
- && srcTransform
- && !mask
- && op == PIXMAN_OP_SRC
- && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
- && (src->common.filter == PIXMAN_FILTER_NEAREST)
- && PIXMAN_FORMAT_BPP(dest->bits.format) == 32
- && src->bits.format == dest->bits.format
- && src->common.src_clip == &(src->common.full_region)
- && !src->common.read_func && !src->common.write_func
- && !dest->common.read_func && !dest->common.write_func)
- {
- /* ensure that the transform matrix only has a scale */
- if (src->common.transform->matrix[0][1] == 0 &&
- src->common.transform->matrix[1][0] == 0 &&
- src->common.transform->matrix[2][0] == 0 &&
- src->common.transform->matrix[2][1] == 0 &&
- src->common.transform->matrix[2][2] == pixman_fixed_1) {
- func = fbCompositeSrcScaleNearest;
- /* Like the general path, fbCompositeSrcScaleNearest handles all the repeat types itself */
- srcRepeat = FALSE;
- }
- } else if ((src->type == BITS || pixman_image_can_get_solid (src)) && (!mask || mask->type == BITS)
+ if ((src->type == BITS || pixman_image_can_get_solid (src)) && (!mask || mask->type == BITS)
&& !srcTransform && !maskTransform
&& !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
&& (src->common.filter != PIXMAN_FILTER_CONVOLUTION)
@@ -836,7 +623,7 @@ general_composite (pixman_implementation_t * imp,
maskRepeat = FALSE;
}
- pixman_walk_composite_region (imp, op, src, mask, dest, src_x, src_y,
+ _pixman_walk_composite_region (imp, op, src, mask, dest, src_x, src_y,
mask_x, mask_y, dest_x, dest_y, width, height,
srcRepeat, maskRepeat, func);
}
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 05b0a9c..8f18b06 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3143,7 +3143,7 @@ const FastPathInfo *const mmx_fast_paths = mmx_fast_path_array;
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
{
- pixman_implementation_t *general = _pixman_implementation_create_general (NULL);
+ pixman_implementation_t *general = _pixman_implementation_create_fast_path (NULL);
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, general);
/* check if we have MMX support and initialize accordingly */
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index a76ce21..18ec4f8 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -127,7 +127,7 @@ pixman_image_composite (pixman_op_t op,
return;
if (!imp)
- imp = _pixman_implementation_create_general (NULL);
+ imp = _pixman_implementation_create_fast_path (NULL);
_pixman_implementation_composite (imp, op,
src, mask, dest,
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index e660be6..a8c6ce4 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -896,6 +896,24 @@ typedef void (* pixman_composite_func_t) (pixman_implementation_t * imp,
int32_t width,
int32_t height);
+void
+_pixman_walk_composite_region (pixman_implementation_t *imp,
+ 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,
+ pixman_bool_t srcRepeat,
+ pixman_bool_t maskRepeat,
+ pixman_composite_func_t compositeRect);
+
/* These "formats" both have depth 0, so they
* will never clash with any real ones
*/
@@ -981,6 +999,8 @@ _pixman_implementation_composite (pixman_implementation_t * imp,
/* Specific implementations */
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel);
+pixman_implementation_t *
+_pixman_implementation_create_fast_path (pixman_implementation_t *toplevel);
#ifdef USE_MMX
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel);
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index cdf0220..e445c3c 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -593,3 +593,98 @@ pixman_format_supported_source (pixman_format_code_t format)
return FALSE;
}
}
+
+void
+_pixman_walk_composite_region (pixman_implementation_t *imp,
+ 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,
+ pixman_bool_t srcRepeat,
+ pixman_bool_t maskRepeat,
+ pixman_composite_func_t compositeRect)
+{
+ int n;
+ const pixman_box32_t *pbox;
+ int w, h, w_this, h_this;
+ int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
+ pixman_region32_t reg;
+ pixman_region32_t *region;
+
+ pixman_region32_init (®);
+ if (!pixman_compute_composite_region32 (®, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))
+ {
+ return;
+ }
+
+ region = ®
+
+ pbox = pixman_region32_rectangles (region, &n);
+ while (n--)
+ {
+ h = pbox->y2 - pbox->y1;
+ y_src = pbox->y1 - yDst + ySrc;
+ y_msk = pbox->y1 - yDst + yMask;
+ y_dst = pbox->y1;
+ while (h)
+ {
+ h_this = h;
+ w = pbox->x2 - pbox->x1;
+ x_src = pbox->x1 - xDst + xSrc;
+ x_msk = pbox->x1 - xDst + xMask;
+ x_dst = pbox->x1;
+ if (maskRepeat)
+ {
+ y_msk = MOD (y_msk, pMask->bits.height);
+ if (h_this > pMask->bits.height - y_msk)
+ h_this = pMask->bits.height - y_msk;
+ }
+ if (srcRepeat)
+ {
+ y_src = MOD (y_src, pSrc->bits.height);
+ if (h_this > pSrc->bits.height - y_src)
+ h_this = pSrc->bits.height - y_src;
+ }
+ while (w)
+ {
+ w_this = w;
+ if (maskRepeat)
+ {
+ x_msk = MOD (x_msk, pMask->bits.width);
+ if (w_this > pMask->bits.width - x_msk)
+ w_this = pMask->bits.width - x_msk;
+ }
+ if (srcRepeat)
+ {
+ x_src = MOD (x_src, pSrc->bits.width);
+ if (w_this > pSrc->bits.width - x_src)
+ w_this = pSrc->bits.width - x_src;
+ }
+ (*compositeRect) (imp,
+ op, pSrc, pMask, pDst,
+ x_src, y_src, x_msk, y_msk, x_dst, y_dst,
+ w_this, h_this);
+ w -= w_this;
+ x_src += w_this;
+ x_msk += w_this;
+ x_dst += w_this;
+ }
+ h -= h_this;
+ y_src += h_this;
+ y_msk += h_this;
+ y_dst += h_this;
+ }
+ pbox++;
+ }
+ pixman_region32_fini (®);
+}
+
commit 2c64b2a6487114263be8f26fc9328ddc36c61b9a
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 08:14:01 2009 -0400
Change prototypes for compositing functions to use 32 bit integers
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index f7f6f19..62a39d1 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -78,18 +78,19 @@ fbIn (uint32_t x, uint8_t y)
*/
static void
-fbCompositeOver_x888x8x8888 (pixman_op_t op,
+fbCompositeOver_x888x8x8888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *src, *srcLine;
uint32_t *dst, *dstLine;
@@ -135,18 +136,19 @@ fbCompositeOver_x888x8x8888 (pixman_op_t op,
}
static void
-fbCompositeSolidMaskIn_nx8x8 (pixman_op_t op,
+fbCompositeSolidMaskIn_nx8x8 (pixman_implementation_t *imp,
+ pixman_op_t op,
pixman_image_t *iSrc,
pixman_image_t *iMask,
pixman_image_t *iDst,
- int16_t xSrc,
- int16_t ySrc,
- int16_t xMask,
- int16_t yMask,
- int16_t xDst,
- int16_t yDst,
- uint16_t width,
- uint16_t height)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint8_t *dstLine, *dst, dstMask;
@@ -217,18 +219,19 @@ fbCompositeSolidMaskIn_nx8x8 (pixman_op_t op,
static void
-fbCompositeSrcIn_8x8 (pixman_op_t op,
+fbCompositeSrcIn_8x8 (pixman_implementation_t *imp,
+ pixman_op_t op,
pixman_image_t *iSrc,
pixman_image_t *iMask,
pixman_image_t *iDst,
- int16_t xSrc,
- int16_t ySrc,
- int16_t xMask,
- int16_t yMask,
- int16_t xDst,
- int16_t yDst,
- uint16_t width,
- uint16_t height)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *srcLine, *src;
@@ -265,18 +268,19 @@ fbCompositeSrcIn_8x8 (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8x8888 (pixman_op_t op,
+fbCompositeSolidMask_nx8x8888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, *dst, d, dstMask;
@@ -323,18 +327,19 @@ fbCompositeSolidMask_nx8x8888 (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8888x8888C (pixman_op_t op,
+fbCompositeSolidMask_nx8888x8888C (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, *dst, d, dstMask;
@@ -396,18 +401,19 @@ fbCompositeSolidMask_nx8888x8888C (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8x0888 (pixman_op_t op,
+fbCompositeSolidMask_nx8x0888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint8_t *dstLine, *dst;
@@ -458,18 +464,19 @@ fbCompositeSolidMask_nx8x0888 (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8x0565 (pixman_op_t op,
+fbCompositeSolidMask_nx8x0565 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint16_t *dstLine, *dst;
@@ -521,18 +528,19 @@ fbCompositeSolidMask_nx8x0565 (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8888x0565C (pixman_op_t op,
+fbCompositeSolidMask_nx8888x0565C (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint16_t src16;
@@ -594,18 +602,19 @@ fbCompositeSolidMask_nx8888x0565C (pixman_op_t op,
}
static void
-fbCompositeSrc_8888x8888 (pixman_op_t op,
+fbCompositeSrc_8888x8888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst, dstMask;
uint32_t *srcLine, *src, s;
@@ -640,18 +649,19 @@ fbCompositeSrc_8888x8888 (pixman_op_t op,
}
static void
-fbCompositeSrc_8888x0888 (pixman_op_t op,
+fbCompositeSrc_8888x0888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint32_t d;
@@ -689,18 +699,19 @@ fbCompositeSrc_8888x0888 (pixman_op_t op,
}
static void
-fbCompositeSrc_8888x0565 (pixman_op_t op,
+fbCompositeSrc_8888x0565 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint16_t *dstLine, *dst;
uint32_t d;
@@ -741,18 +752,19 @@ fbCompositeSrc_8888x0565 (pixman_op_t op,
}
static void
-fbCompositeSrc_x888x0565 (pixman_op_t op,
+fbCompositeSrc_x888x0565 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint16_t *dstLine, *dst;
uint32_t *srcLine, *src, s;
@@ -780,18 +792,19 @@ fbCompositeSrc_x888x0565 (pixman_op_t op,
}
static void
-fbCompositeSrcAdd_8000x8000 (pixman_op_t op,
+fbCompositeSrcAdd_8000x8000 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *srcLine, *src;
@@ -830,18 +843,19 @@ fbCompositeSrcAdd_8000x8000 (pixman_op_t op,
}
static void
-fbCompositeSrcAdd_8888x8888 (pixman_op_t op,
+fbCompositeSrcAdd_8888x8888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -887,18 +901,19 @@ fbCompositeSrcAdd_8888x8888 (pixman_op_t op,
}
static void
-fbCompositeSrcAdd_8888x8x8 (pixman_op_t op,
+fbCompositeSrcAdd_8888x8x8 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *maskLine, *mask;
@@ -943,18 +958,19 @@ fbCompositeSrcAdd_8888x8x8 (pixman_op_t op,
*/
static void
-fbCompositeSolidFill (pixman_op_t op,
+fbCompositeSolidFill (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src;
@@ -974,18 +990,19 @@ fbCompositeSolidFill (pixman_op_t op,
}
static void
-fbCompositeSrc_8888xx888 (pixman_op_t op,
+fbCompositeSrc_8888xx888 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dst;
uint32_t *src;
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 5b50984..734dfce 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -318,18 +318,19 @@ general_composite_rect (const FbComposeData *data)
#include "pixman-combine32.h"
static void
-fbCompositeSrcScaleNearest (pixman_op_t op,
+fbCompositeSrcScaleNearest (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dst;
uint32_t *src;
@@ -414,7 +415,8 @@ fbCompositeSrcScaleNearest (pixman_op_t op,
}
static void
-pixman_walk_composite_region (pixman_op_t op,
+pixman_walk_composite_region (pixman_implementation_t *imp,
+ pixman_op_t op,
pixman_image_t * pSrc,
pixman_image_t * pMask,
pixman_image_t * pDst,
@@ -428,7 +430,7 @@ pixman_walk_composite_region (pixman_op_t op,
uint16_t height,
pixman_bool_t srcRepeat,
pixman_bool_t maskRepeat,
- CompositeFunc compositeRect)
+ pixman_composite_func_t compositeRect)
{
int n;
const pixman_box32_t *pbox;
@@ -487,7 +489,8 @@ pixman_walk_composite_region (pixman_op_t op,
if (w_this > pSrc->bits.width - x_src)
w_this = pSrc->bits.width - x_src;
}
- (*compositeRect) (op, pSrc, pMask, pDst,
+ (*compositeRect) (imp,
+ op, pSrc, pMask, pDst,
x_src, y_src, x_msk, y_msk, x_dst, y_dst,
w_this, h_this);
w -= w_this;
@@ -506,18 +509,19 @@ pixman_walk_composite_region (pixman_op_t op,
}
static void
-pixman_image_composite_rect (pixman_op_t op,
+pixman_image_composite_rect (pixman_implementation_t *imp,
+ 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)
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
{
FbComposeData compose_data;
@@ -659,7 +663,7 @@ general_composite (pixman_implementation_t * imp,
pixman_bool_t srcAlphaMap = src->common.alpha_map != NULL;
pixman_bool_t maskAlphaMap = FALSE;
pixman_bool_t dstAlphaMap = dest->common.alpha_map != NULL;
- CompositeFunc func = NULL;
+ pixman_composite_func_t func = NULL;
#ifdef USE_MMX
fbComposeSetupMMX();
@@ -832,7 +836,7 @@ general_composite (pixman_implementation_t * imp,
maskRepeat = FALSE;
}
- pixman_walk_composite_region (op, src, mask, dest, src_x, src_y,
+ pixman_walk_composite_region (imp, op, src, mask, dest, src_x, src_y,
mask_x, mask_y, dest_x, dest_y, width, height,
srcRepeat, maskRepeat, func);
}
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index b26625b..05b0a9c 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -962,18 +962,19 @@ fbComposeSetupMMX(void)
/* ------------------ MMX code paths called from fbpict.c ----------------------- */
static void
-fbCompositeSolid_nx8888mmx (pixman_op_t op,
+fbCompositeSolid_nx8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src;
uint32_t *dstLine, *dst;
@@ -1040,18 +1041,19 @@ fbCompositeSolid_nx8888mmx (pixman_op_t op,
}
static void
-fbCompositeSolid_nx0565mmx (pixman_op_t op,
+fbCompositeSolid_nx0565mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src;
uint16_t *dstLine, *dst;
@@ -1125,18 +1127,19 @@ fbCompositeSolid_nx0565mmx (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op,
+fbCompositeSolidMask_nx8888x8888Cmmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine;
@@ -1228,18 +1231,19 @@ fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op,
}
static void
-fbCompositeSrc_8888x8x8888mmx (pixman_op_t op,
+fbCompositeSrc_8888x8x8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -1312,18 +1316,19 @@ fbCompositeSrc_8888x8x8888mmx (pixman_op_t op,
}
static void
-fbCompositeSrc_x888xnx8888mmx (pixman_op_t op,
+fbCompositeSrc_x888xnx8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -1446,18 +1451,19 @@ fbCompositeSrc_x888xnx8888mmx (pixman_op_t op,
}
static void
-fbCompositeSrc_8888x8888mmx (pixman_op_t op,
+fbCompositeSrc_8888x8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -1498,18 +1504,19 @@ fbCompositeSrc_8888x8888mmx (pixman_op_t op,
}
static void
-fbCompositeSrc_8888x0565mmx (pixman_op_t op,
+fbCompositeSrc_8888x0565mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint16_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -1599,18 +1606,19 @@ fbCompositeSrc_8888x0565mmx (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8x8888mmx (pixman_op_t op,
+fbCompositeSolidMask_nx8x8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, *dst;
@@ -1870,18 +1878,19 @@ pixman_fill_mmx (uint32_t *bits,
}
static void
-fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op,
+fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, *dst;
@@ -2001,18 +2010,19 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op,
+fbCompositeSolidMask_nx8x0565mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint16_t *dstLine, *dst;
@@ -2133,18 +2143,19 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op,
}
static void
-fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op,
+fbCompositeSrc_8888RevNPx0565mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint16_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -2254,18 +2265,19 @@ fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op,
/* "8888RevNP" is GdkPixbuf's format: ABGR, non premultiplied */
static void
-fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op,
+fbCompositeSrc_8888RevNPx8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -2353,18 +2365,19 @@ fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op,
}
static void
-fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t op,
+fbCompositeSolidMask_nx8888x0565Cmmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint16_t *dstLine;
@@ -2460,18 +2473,19 @@ fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t op,
}
static void
-fbCompositeIn_nx8x8mmx (pixman_op_t op,
+fbCompositeIn_nx8x8mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *maskLine, *mask;
@@ -2544,18 +2558,19 @@ fbCompositeIn_nx8x8mmx (pixman_op_t op,
}
static void
-fbCompositeIn_8x8mmx (pixman_op_t op,
+fbCompositeIn_8x8mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *srcLine, *src;
@@ -2608,18 +2623,19 @@ fbCompositeIn_8x8mmx (pixman_op_t op,
}
static void
-fbCompositeSrcAdd_8888x8x8mmx (pixman_op_t op,
+fbCompositeSrcAdd_8888x8x8mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *maskLine, *mask;
@@ -2686,18 +2702,19 @@ fbCompositeSrcAdd_8888x8x8mmx (pixman_op_t op,
}
static void
-fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op,
+fbCompositeSrcAdd_8000x8000mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *srcLine, *src;
@@ -2758,18 +2775,19 @@ fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op,
}
static void
-fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op,
+fbCompositeSrcAdd_8888x8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
__m64 dst64;
uint32_t *dstLine, *dst;
@@ -2956,18 +2974,19 @@ pixman_blt_mmx (uint32_t *src_bits,
}
void
-fbCompositeCopyAreammx (pixman_op_t op,
+fbCompositeCopyAreammx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
pixman_blt_mmx (pSrc->bits.bits,
pDst->bits.bits,
@@ -2979,18 +2998,19 @@ fbCompositeCopyAreammx (pixman_op_t op,
}
static void
-fbCompositeOver_x888x8x8888mmx (pixman_op_t op,
+fbCompositeOver_x888x8x8888mmx (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *src, *srcLine;
uint32_t *dst, *dstLine;
diff --git a/pixman/pixman-mmx.h b/pixman/pixman-mmx.h
index f17816f..f30ff76 100644
--- a/pixman/pixman-mmx.h
+++ b/pixman/pixman-mmx.h
@@ -72,18 +72,19 @@ pixman_fill_mmx (uint32_t *bits,
uint32_t xor);
void fbComposeSetupMMX(void);
-void fbCompositeCopyAreammx (pixman_op_t op,
+void fbCompositeCopyAreammx (pixman_implementation_t *imp,
+ 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);
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height);
#endif /* USE_MMX */
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index c79d890..e660be6 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -149,34 +149,6 @@ typedef struct bits_image bits_image_t;
typedef struct circle circle_t;
typedef struct point point_t;
-typedef void (* CompositeFunc) (pixman_op_t,
- pixman_image_t *, pixman_image_t *, pixman_image_t *,
- int16_t, int16_t, int16_t, int16_t, int16_t, int16_t,
- uint16_t, uint16_t);
-
-
-/* These "formats" both have depth 0, so they
- * will never clash with any real ones
- */
-#define PIXMAN_null PIXMAN_FORMAT(0,0,0,0,0,0)
-#define PIXMAN_solid PIXMAN_FORMAT(0,1,0,0,0,0)
-
-#define NEED_COMPONENT_ALPHA (1 << 0)
-#define NEED_PIXBUF (1 << 1)
-#define NEED_SOLID_MASK (1 << 2)
-
-typedef struct
-{
- pixman_op_t op;
- pixman_format_code_t src_format;
- pixman_format_code_t mask_format;
- pixman_format_code_t dest_format;
- CompositeFunc func;
- uint32_t flags;
-} FastPathInfo;
-
-extern const FastPathInfo *const c_fast_paths;
-
/* FIXME - the types and structures below should be give proper names
*/
@@ -924,6 +896,28 @@ typedef void (* pixman_composite_func_t) (pixman_implementation_t * imp,
int32_t width,
int32_t height);
+/* These "formats" both have depth 0, so they
+ * will never clash with any real ones
+ */
+#define PIXMAN_null PIXMAN_FORMAT(0,0,0,0,0,0)
+#define PIXMAN_solid PIXMAN_FORMAT(0,1,0,0,0,0)
+
+#define NEED_COMPONENT_ALPHA (1 << 0)
+#define NEED_PIXBUF (1 << 1)
+#define NEED_SOLID_MASK (1 << 2)
+
+typedef struct
+{
+ pixman_op_t op;
+ pixman_format_code_t src_format;
+ pixman_format_code_t mask_format;
+ pixman_format_code_t dest_format;
+ pixman_composite_func_t func;
+ uint32_t flags;
+} FastPathInfo;
+
+extern const FastPathInfo *const c_fast_paths;
+
struct pixman_implementation_t
{
pixman_implementation_t * toplevel;
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index af458dc..d3524f4 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -2538,18 +2538,19 @@ fbComposeSetupSSE2(void)
*/
static void
-fbCompositeSolid_nx8888sse2 (pixman_op_t op,
+fbCompositeSolid_nx8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src;
uint32_t *dstLine, *dst, d;
@@ -2624,18 +2625,19 @@ fbCompositeSolid_nx8888sse2 (pixman_op_t op,
* fbCompositeSolid_nx0565
*/
static void
-fbCompositeSolid_nx0565sse2 (pixman_op_t op,
+fbCompositeSolid_nx0565sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src;
uint16_t *dstLine, *dst, d;
@@ -2713,18 +2715,19 @@ fbCompositeSolid_nx0565sse2 (pixman_op_t op,
*/
static void
-fbCompositeSolidMask_nx8888x8888Csse2 (pixman_op_t op,
+fbCompositeSolidMask_nx8888x8888Csse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, d;
@@ -2847,18 +2850,19 @@ fbCompositeSolidMask_nx8888x8888Csse2 (pixman_op_t op,
*/
static void
-fbCompositeSrc_8888x8x8888sse2 (pixman_op_t op,
+fbCompositeSrc_8888x8x8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -2959,18 +2963,19 @@ fbCompositeSrc_8888x8x8888sse2 (pixman_op_t op,
* fbCompositeSrc_x888xnx8888
*/
static void
-fbCompositeSrc_x888xnx8888sse2 (pixman_op_t op,
+fbCompositeSrc_x888xnx8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -3071,18 +3076,19 @@ fbCompositeSrc_x888xnx8888sse2 (pixman_op_t op,
* fbCompositeSrc_8888x8888
*/
static void
-fbCompositeSrc_8888x8888sse2 (pixman_op_t op,
+fbCompositeSrc_8888x8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
int dstStride, srcStride;
uint32_t *dstLine, *dst;
@@ -3119,18 +3125,19 @@ fbCompositeSrc_8888x0565pixel (uint32_t src, uint16_t dst)
}
static void
-fbCompositeSrc_8888x0565sse2 (pixman_op_t op,
+fbCompositeSrc_8888x0565sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint16_t *dstLine, *dst, d;
uint32_t *srcLine, *src, s;
@@ -3232,18 +3239,19 @@ fbCompositeSrc_8888x0565sse2 (pixman_op_t op,
*/
static void
-fbCompositeSolidMask_nx8x8888sse2 (pixman_op_t op,
+fbCompositeSolidMask_nx8x8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, *dst;
@@ -3509,18 +3517,19 @@ pixmanFillsse2 (uint32_t *bits,
}
static void
-fbCompositeSolidMaskSrc_nx8x8888sse2 (pixman_op_t op,
+fbCompositeSolidMaskSrc_nx8x8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint32_t *dstLine, *dst;
@@ -3644,18 +3653,19 @@ fbCompositeSolidMaskSrc_nx8x8888sse2 (pixman_op_t op,
*/
static void
-fbCompositeSolidMask_nx8x0565sse2 (pixman_op_t op,
+fbCompositeSolidMask_nx8x0565sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint16_t *dstLine, *dst, d;
@@ -3793,18 +3803,19 @@ fbCompositeSolidMask_nx8x0565sse2 (pixman_op_t op,
*/
static void
-fbCompositeSrc_8888RevNPx0565sse2 (pixman_op_t op,
+fbCompositeSrc_8888RevNPx0565sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint16_t *dstLine, *dst, d;
uint32_t *srcLine, *src, s;
@@ -3926,18 +3937,19 @@ fbCompositeSrc_8888RevNPx0565sse2 (pixman_op_t op,
*/
static void
-fbCompositeSrc_8888RevNPx8888sse2 (pixman_op_t op,
+fbCompositeSrc_8888RevNPx8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst, d;
uint32_t *srcLine, *src, s;
@@ -4039,18 +4051,19 @@ fbCompositeSrc_8888RevNPx8888sse2 (pixman_op_t op,
*/
static void
-fbCompositeSolidMask_nx8888x0565Csse2 (pixman_op_t op,
+fbCompositeSolidMask_nx8888x0565Csse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t src, srca;
uint16_t *dstLine, *dst, d;
@@ -4187,18 +4200,19 @@ fbCompositeSolidMask_nx8888x0565Csse2 (pixman_op_t op,
*/
static void
-fbCompositeIn_nx8x8sse2 (pixman_op_t op,
+fbCompositeIn_nx8x8sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *maskLine, *mask;
@@ -4289,18 +4303,19 @@ fbCompositeIn_nx8x8sse2 (pixman_op_t op,
*/
static void
-fbCompositeIn_8x8sse2 (pixman_op_t op,
+fbCompositeIn_8x8sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *srcLine, *src;
@@ -4378,18 +4393,19 @@ fbCompositeIn_8x8sse2 (pixman_op_t op,
*/
static void
-fbCompositeSrcAdd_8888x8x8sse2 (pixman_op_t op,
+fbCompositeSrcAdd_8888x8x8sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *maskLine, *mask;
@@ -4483,18 +4499,19 @@ fbCompositeSrcAdd_8888x8x8sse2 (pixman_op_t op,
*/
static void
-fbCompositeSrcAdd_8000x8000sse2 (pixman_op_t op,
+fbCompositeSrcAdd_8000x8000sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint8_t *dstLine, *dst;
uint8_t *srcLine, *src;
@@ -4549,18 +4566,19 @@ fbCompositeSrcAdd_8000x8000sse2 (pixman_op_t op,
* fbCompositeSrcAdd_8888x8888
*/
static void
-fbCompositeSrcAdd_8888x8888sse2 (pixman_op_t op,
+fbCompositeSrcAdd_8888x8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *dstLine, *dst;
uint32_t *srcLine, *src;
@@ -4726,18 +4744,19 @@ pixmanBltsse2 (uint32_t *src_bits,
}
static void
-fbCompositeCopyAreasse2 (pixman_op_t op,
+fbCompositeCopyAreasse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
pixmanBltsse2 (pSrc->bits.bits,
pDst->bits.bits,
@@ -4751,18 +4770,19 @@ fbCompositeCopyAreasse2 (pixman_op_t op,
#if 0
/* This code are buggy in MMX version, now the bug was translated to SSE2 version */
void
-fbCompositeOver_x888x8x8888sse2 (pixman_op_t op,
+fbCompositeOver_x888x8x8888sse2 (pixman_implementation_t *imp,
+ 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)
+ int32_t xSrc,
+ int32_t ySrc,
+ int32_t xMask,
+ int32_t yMask,
+ int32_t xDst,
+ int32_t yDst,
+ int32_t width,
+ int32_t height)
{
uint32_t *src, *srcLine, s;
uint32_t *dst, *dstLine, d;
commit d6345a69fb7179ce6dc71117423e83baef427071
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 05:12:52 2009 -0400
Add component alpha combiners in pixman-implementation.c
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index c8c09ad..4c98fec 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -73,6 +73,30 @@ delegate_combine_64 (pixman_implementation_t * imp,
op, dest, src, mask, width);
}
+static void
+delegate_combine_32_ca (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width)
+{
+ _pixman_implementation_combine_32_ca (imp->delegate,
+ op, dest, src, mask, width);
+}
+
+static void
+delegate_combine_64_ca (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width)
+{
+ _pixman_implementation_combine_64_ca (imp->delegate,
+ op, dest, src, mask, width);
+}
+
pixman_implementation_t *
_pixman_implementation_create (pixman_implementation_t *toplevel,
pixman_implementation_t *delegate)
@@ -92,7 +116,7 @@ _pixman_implementation_create (pixman_implementation_t *toplevel,
delegate->toplevel = imp->toplevel;
imp->delegate = delegate;
-
+
/* Fill out function pointers with ones that just delegate
*/
imp->composite = delegate_composite;
@@ -101,6 +125,8 @@ _pixman_implementation_create (pixman_implementation_t *toplevel,
{
imp->combine_32[i] = delegate_combine_32;
imp->combine_64[i] = delegate_combine_64;
+ imp->combine_32_ca[i] = delegate_combine_32_ca;
+ imp->combine_64_ca[i] = delegate_combine_64_ca;
}
return imp;
@@ -114,7 +140,7 @@ _pixman_implementation_combine_32 (pixman_implementation_t * imp,
const uint32_t * mask,
int width)
{
- (* imp->delegate->combine_32[op]) (imp, op, dest, src, mask, width);
+ (* imp->combine_32[op]) (imp, op, dest, src, mask, width);
}
void
@@ -125,7 +151,29 @@ _pixman_implementation_combine_64 (pixman_implementation_t * imp,
const uint64_t * mask,
int width)
{
- (* imp->delegate->combine_64[op]) (imp, op, dest, src, mask, width);
+ (* imp->combine_64[op]) (imp, op, dest, src, mask, width);
+}
+
+void
+_pixman_implementation_combine_32_ca (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width)
+{
+ (* imp->combine_32[op]) (imp, op, dest, src, mask, width);
+}
+
+void
+_pixman_implementation_combine_64_ca (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width)
+{
+ (* imp->combine_64[op]) (imp, op, dest, src, mask, width);
}
void
@@ -143,8 +191,8 @@ _pixman_implementation_composite (pixman_implementation_t * imp,
int32_t width,
int32_t height)
{
- (* imp->delegate->composite) (imp, op,
- src, mask, dest,
- src_x, src_y, mask_x, mask_y, dest_x, dest_y,
- width, height);
+ (* imp->composite) (imp, op,
+ src, mask, dest,
+ src_x, src_y, mask_x, mask_y, dest_x, dest_y,
+ width, height);
}
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 9290824..a76ce21 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -129,10 +129,10 @@ pixman_image_composite (pixman_op_t op,
if (!imp)
imp = _pixman_implementation_create_general (NULL);
- imp->composite (imp, op,
- src, mask, dest,
- src_x, src_y,
- mask_x, mask_y,
- dest_x, dest_y,
- width, height);
+ _pixman_implementation_composite (imp, op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height);
}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 16c856b..c79d890 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -956,6 +956,20 @@ _pixman_implementation_combine_64 (pixman_implementation_t * imp,
const uint64_t * mask,
int width);
void
+_pixman_implementation_combine_32_ca (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width);
+void
+_pixman_implementation_combine_64_ca (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width);
+void
_pixman_implementation_composite (pixman_implementation_t * imp,
pixman_op_t op,
pixman_image_t * src,
commit 918f763a9111f643d5b8a1460258089e79f68fb0
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 04:52:28 2009 -0400
Beginning of MMX implementation
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index f8577db..b26625b 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -36,6 +36,7 @@
#ifdef USE_MMX
#include <mmintrin.h>
+#include "pixman-private.h"
#include "pixman-mmx.h"
@@ -437,7 +438,8 @@ combine (const uint32_t *src, const uint32_t *mask)
}
static FASTCALL void
-mmxCombineOverU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOverU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -461,7 +463,8 @@ mmxCombineOverU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int
}
static FASTCALL void
-mmxCombineOverReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -480,7 +483,8 @@ mmxCombineOverReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mas
}
static FASTCALL void
-mmxCombineInU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineInU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -500,7 +504,8 @@ mmxCombineInU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int wi
}
static FASTCALL void
-mmxCombineInReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -520,7 +525,8 @@ mmxCombineInReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mask,
}
static FASTCALL void
-mmxCombineOutU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOutU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -541,7 +547,8 @@ mmxCombineOutU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int w
}
static FASTCALL void
-mmxCombineOutReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -562,7 +569,8 @@ mmxCombineOutReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mask
}
static FASTCALL void
-mmxCombineAtopU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -584,7 +592,8 @@ mmxCombineAtopU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int
}
static FASTCALL void
-mmxCombineAtopReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end;
@@ -608,7 +617,8 @@ mmxCombineAtopReverseU (uint32_t *dest, const uint32_t *src, const uint32_t *mas
}
static FASTCALL void
-mmxCombineXorU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineXorU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
@@ -631,7 +641,8 @@ mmxCombineXorU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int w
}
static FASTCALL void
-mmxCombineAddU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineAddU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
while (dest < end) {
@@ -649,7 +660,8 @@ mmxCombineAddU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int w
}
static FASTCALL void
-mmxCombineSaturateU (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = dest + width;
while (dest < end) {
@@ -677,7 +689,8 @@ mmxCombineSaturateU (uint32_t *dest, const uint32_t *src, const uint32_t *mask,
static FASTCALL void
-mmxCombineSrcC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -693,7 +706,8 @@ mmxCombineSrcC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int w
}
static FASTCALL void
-mmxCombineOverC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOverC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -712,7 +726,8 @@ mmxCombineOverC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int
}
static FASTCALL void
-mmxCombineOverReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -732,7 +747,8 @@ mmxCombineOverReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mas
static FASTCALL void
-mmxCombineInC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineInC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -751,7 +767,8 @@ mmxCombineInC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int wi
}
static FASTCALL void
-mmxCombineInReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -770,7 +787,8 @@ mmxCombineInReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask,
}
static FASTCALL void
-mmxCombineOutC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOutC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -790,7 +808,8 @@ mmxCombineOutC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int w
}
static FASTCALL void
-mmxCombineOutReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -810,7 +829,8 @@ mmxCombineOutReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask
}
static FASTCALL void
-mmxCombineAtopC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -832,7 +852,8 @@ mmxCombineAtopC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int
}
static FASTCALL void
-mmxCombineAtopReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -854,7 +875,8 @@ mmxCombineAtopReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mas
}
static FASTCALL void
-mmxCombineXorC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineXorC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -877,7 +899,8 @@ mmxCombineXorC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int w
}
static FASTCALL void
-mmxCombineAddC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+mmxCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
const uint32_t *end = src + width;
while (src < end) {
@@ -905,6 +928,7 @@ fbComposeSetupMMX(void)
/* check if we have MMX support and initialize accordingly */
if (pixman_have_mmx())
{
+#if 0
pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = mmxCombineOverU;
pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU;
pixman_composeFunctions.combineU[PIXMAN_OP_IN] = mmxCombineInU;
@@ -928,6 +952,7 @@ fbComposeSetupMMX(void)
pixman_composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseC;
pixman_composeFunctions.combineC[PIXMAN_OP_XOR] = mmxCombineXorC;
pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = mmxCombineAddC;
+#endif
}
initialized = TRUE;
@@ -3095,4 +3120,41 @@ static const FastPathInfo mmx_fast_path_array[] =
};
const FastPathInfo *const mmx_fast_paths = mmx_fast_path_array;
+pixman_implementation_t *
+_pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
+{
+ pixman_implementation_t *general = _pixman_implementation_create_general (NULL);
+ pixman_implementation_t *imp = _pixman_implementation_create (toplevel, general);
+
+ /* check if we have MMX support and initialize accordingly */
+ if (pixman_have_mmx())
+ {
+ imp->combine_32[PIXMAN_OP_OVER] = mmxCombineOverU;
+ imp->combine_32[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU;
+ imp->combine_32[PIXMAN_OP_IN] = mmxCombineInU;
+ imp->combine_32[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseU;
+ imp->combine_32[PIXMAN_OP_OUT] = mmxCombineOutU;
+ imp->combine_32[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseU;
+ imp->combine_32[PIXMAN_OP_ATOP] = mmxCombineAtopU;
+ imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseU;
+ imp->combine_32[PIXMAN_OP_XOR] = mmxCombineXorU;
+ imp->combine_32[PIXMAN_OP_ADD] = mmxCombineAddU;
+ imp->combine_32[PIXMAN_OP_SATURATE] = mmxCombineSaturateU;
+
+ imp->combine_32_ca[PIXMAN_OP_SRC] = mmxCombineSrcC;
+ imp->combine_32_ca[PIXMAN_OP_OVER] = mmxCombineOverC;
+ imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseC;
+ imp->combine_32_ca[PIXMAN_OP_IN] = mmxCombineInC;
+ imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseC;
+ imp->combine_32_ca[PIXMAN_OP_OUT] = mmxCombineOutC;
+ imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP] = mmxCombineAtopC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseC;
+ imp->combine_32_ca[PIXMAN_OP_XOR] = mmxCombineXorC;
+ imp->combine_32_ca[PIXMAN_OP_ADD] = mmxCombineAddC;
+ }
+
+ return imp;
+}
+
#endif /* USE_MMX */
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index fda2531..16c856b 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -973,6 +973,9 @@ _pixman_implementation_composite (pixman_implementation_t * imp,
/* Specific implementations */
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel);
-
+#ifdef USE_MMX
+pixman_implementation_t *
+_pixman_implementation_create_mmx (pixman_implementation_t *toplevel);
+#endif
#endif /* PIXMAN_PRIVATE_H */
commit 4b8f440d494f675c2ae5b9d41d950a6c79d14548
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 04:32:32 2009 -0400
Move entire C implementation into pixman-general.c
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index c1faac3..84106c3 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -17,7 +17,6 @@ libpixman_1_la_SOURCES = \
pixman-combine32.h \
pixman-combine64.c \
pixman-combine64.h \
- pixman-compose.c \
pixman-general.c \
pixman-pict.c \
pixman-fast-path.c \
diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c
deleted file mode 100644
index c588138..0000000
--- a/pixman/pixman-compose.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- * 2005 Lars Knoll & Zack Rusin, Trolltech
- * 2008 Aaron Plattner, NVIDIA Corporation
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
- * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-#include <limits.h>
-
-#include "pixman-private.h"
-
-static void
-pixman_composite_rect_general_internal (const FbComposeData *data,
- void *src_buffer, void *mask_buffer,
- void *dest_buffer, const int wide)
-{
- int i;
- scanStoreProc store;
- scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL;
- uint32_t *bits;
- int32_t stride;
- source_pict_class_t srcClass, maskClass;
- pixman_bool_t component_alpha;
-
- srcClass = _pixman_image_classify (data->src,
- data->xSrc, data->ySrc,
- data->width, data->height);
-
- maskClass = SOURCE_IMAGE_CLASS_UNKNOWN;
- if (data->mask)
- {
- maskClass = _pixman_image_classify (data->mask,
- data->xSrc, data->ySrc,
- data->width, data->height);
- }
-
- if (data->op == PIXMAN_OP_CLEAR)
- fetchSrc = NULL;
- else if (wide)
- fetchSrc = _pixman_image_get_scanline_64;
- else
- fetchSrc = _pixman_image_get_scanline_32;
-
- if (!data->mask || data->op == PIXMAN_OP_CLEAR)
- fetchMask = NULL;
- else if (wide)
- fetchMask = _pixman_image_get_scanline_64;
- else
- fetchMask = _pixman_image_get_scanline_32;
-
- if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC)
- fetchDest = NULL;
- else if (wide)
- fetchDest = _pixman_image_get_scanline_64;
- else
- fetchDest = _pixman_image_get_scanline_32;
-
- if (wide)
- store = _pixman_image_store_scanline_64;
- else
- store = _pixman_image_store_scanline_32;
-
- // Skip the store step and composite directly into the
- // destination if the output format of the compose func matches
- // the destination format.
- if (!wide &&
- !data->dest->common.alpha_map &&
- !data->dest->common.write_func &&
- (data->op == PIXMAN_OP_ADD || data->op == PIXMAN_OP_OVER) &&
- (data->dest->bits.format == PIXMAN_a8r8g8b8 ||
- data->dest->bits.format == PIXMAN_x8r8g8b8))
- {
- store = NULL;
- }
-
- if (!store)
- {
- bits = data->dest->bits.bits;
- stride = data->dest->bits.rowstride;
- }
- else
- {
- bits = NULL;
- stride = 0;
- }
-
- component_alpha =
- fetchSrc &&
- fetchMask &&
- data->mask &&
- data->mask->common.type == BITS &&
- data->mask->common.component_alpha &&
- PIXMAN_FORMAT_RGB (data->mask->bits.format);
-
- {
- CombineFunc32 compose;
-
- if (wide)
- {
- if (component_alpha)
- compose = (CombineFunc32)pixman_composeFunctions64.combineC[data->op];
- else
- compose = (CombineFunc32)pixman_composeFunctions64.combineU[data->op];
- }
- else
- {
- if (component_alpha)
- compose = pixman_composeFunctions.combineC[data->op];
- else
- compose = pixman_composeFunctions.combineU[data->op];
- }
-
- if (!compose)
- return;
-
- if (!fetchMask)
- mask_buffer = NULL;
-
- for (i = 0; i < data->height; ++i)
- {
- /* fill first half of scanline with source */
- if (fetchSrc)
- {
- if (fetchMask)
- {
- /* fetch mask before source so that fetching of
- source can be optimized */
- fetchMask (data->mask, data->xMask, data->yMask + i,
- data->width, mask_buffer, 0, 0);
-
- if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
- fetchMask = NULL;
- }
-
- if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
- {
- fetchSrc (data->src, data->xSrc, data->ySrc + i,
- data->width, src_buffer, 0, 0);
- fetchSrc = NULL;
- }
- else
- {
- fetchSrc (data->src, data->xSrc, data->ySrc + i,
- data->width, src_buffer, mask_buffer,
- 0xffffffff);
- }
- }
- else if (fetchMask)
- {
- fetchMask (data->mask, data->xMask, data->yMask + i,
- data->width, mask_buffer, 0, 0);
- }
-
- if (store)
- {
- /* fill dest into second half of scanline */
- if (fetchDest)
- fetchDest (data->dest, data->xDest, data->yDest + i,
- data->width, dest_buffer, 0, 0);
-
- /* blend */
- compose (dest_buffer, src_buffer, mask_buffer, data->width);
-
- /* write back */
- store (&(data->dest->bits), data->xDest, data->yDest + i, data->width,
- dest_buffer);
- }
- else
- {
- /* blend */
- compose (bits + (data->yDest + i) * stride +
- data->xDest,
- src_buffer, mask_buffer, data->width);
- }
- }
- }
-}
-
-#define SCANLINE_BUFFER_LENGTH 8192
-
-void
-pixman_composite_rect_general (const FbComposeData *data)
-{
- uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
- const pixman_format_code_t srcFormat = data->src->type == BITS ? data->src->bits.format : 0;
- const pixman_format_code_t maskFormat = data->mask && data->mask->type == BITS ? data->mask->bits.format : 0;
- const pixman_format_code_t destFormat = data->dest->type == BITS ? data->dest->bits.format : 0;
- const int srcWide = PIXMAN_FORMAT_16BPC(srcFormat);
- const int maskWide = data->mask && PIXMAN_FORMAT_16BPC(maskFormat);
- const int destWide = PIXMAN_FORMAT_16BPC(destFormat);
- const int wide = srcWide || maskWide || destWide;
- const int Bpp = wide ? 8 : 4;
- uint8_t *scanline_buffer = stack_scanline_buffer;
- uint8_t *src_buffer, *mask_buffer, *dest_buffer;
-
- if (data->width * Bpp > SCANLINE_BUFFER_LENGTH)
- {
- scanline_buffer = pixman_malloc_abc (data->width, 3, Bpp);
-
- if (!scanline_buffer)
- return;
- }
-
- src_buffer = scanline_buffer;
- mask_buffer = src_buffer + data->width * Bpp;
- dest_buffer = mask_buffer + data->width * Bpp;
-
- pixman_composite_rect_general_internal (data, src_buffer,
- mask_buffer, dest_buffer,
- wide);
-
- if (scanline_buffer != stack_scanline_buffer)
- free (scanline_buffer);
-}
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index cc95eab..5b50984 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -1,5 +1,7 @@
/*
* Copyright © 2009 Red Hat, Inc.
+ * Copyright © 2000 SuSE, Inc.
+ * Copyright © 2007 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -21,12 +23,18 @@
* SOFTWARE.
*/
#include <config.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <assert.h>
+#include <limits.h>
#include "pixman-private.h"
+
static void
-combine_32 (pixman_implementation_t *imp, pixman_op_t op,
- uint32_t *dest, const uint32_t *src, const uint32_t *mask,
- int width)
+general_combine_32 (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+ int width)
{
CombineFunc32 f = pixman_composeFunctions.combineU[op];
@@ -34,47 +42,815 @@ combine_32 (pixman_implementation_t *imp, pixman_op_t op,
}
static void
-combine_64 (pixman_implementation_t *imp, pixman_op_t op,
- uint64_t *dest, const uint64_t *src, const uint64_t *mask,
- int width)
+general_combine_32_ca (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+ int width)
{
- CombineFunc64 f = pixman_composeFunctions64.combineU[op];
+ CombineFunc32 f = pixman_composeFunctions.combineC[op];
f (dest, src, mask, width);
}
static void
-combine_32_ca (pixman_implementation_t *imp, pixman_op_t op,
- uint32_t *dest, const uint32_t *src, const uint32_t *mask,
- int width)
+general_combine_64 (pixman_implementation_t *imp, pixman_op_t op,
+ uint64_t *dest, const uint64_t *src, const uint64_t *mask,
+ int width)
{
- CombineFunc32 f = pixman_composeFunctions.combineC[op];
+ CombineFunc64 f = pixman_composeFunctions64.combineU[op];
f (dest, src, mask, width);
}
static void
-combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
- uint64_t *dest, const uint64_t *src, const uint64_t *mask,
- int width)
+general_combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
+ uint64_t *dest, const uint64_t *src, const uint64_t *mask,
+ int width)
{
CombineFunc64 f = pixman_composeFunctions64.combineC[op];
f (dest, src, mask, width);
}
+/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ * 2005 Lars Knoll & Zack Rusin, Trolltech
+ * 2008 Aaron Plattner, NVIDIA Corporation
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+static void
+pixman_composite_rect_general_internal (const FbComposeData *data,
+ void *src_buffer, void *mask_buffer,
+ void *dest_buffer, const int wide)
+{
+ int i;
+ scanStoreProc store;
+ scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL;
+ uint32_t *bits;
+ int32_t stride;
+ source_pict_class_t srcClass, maskClass;
+ pixman_bool_t component_alpha;
+
+ srcClass = _pixman_image_classify (data->src,
+ data->xSrc, data->ySrc,
+ data->width, data->height);
+
+ maskClass = SOURCE_IMAGE_CLASS_UNKNOWN;
+ if (data->mask)
+ {
+ maskClass = _pixman_image_classify (data->mask,
+ data->xSrc, data->ySrc,
+ data->width, data->height);
+ }
+
+ if (data->op == PIXMAN_OP_CLEAR)
+ fetchSrc = NULL;
+ else if (wide)
+ fetchSrc = _pixman_image_get_scanline_64;
+ else
+ fetchSrc = _pixman_image_get_scanline_32;
+
+ if (!data->mask || data->op == PIXMAN_OP_CLEAR)
+ fetchMask = NULL;
+ else if (wide)
+ fetchMask = _pixman_image_get_scanline_64;
+ else
+ fetchMask = _pixman_image_get_scanline_32;
+
+ if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC)
+ fetchDest = NULL;
+ else if (wide)
+ fetchDest = _pixman_image_get_scanline_64;
+ else
+ fetchDest = _pixman_image_get_scanline_32;
+
+ if (wide)
+ store = _pixman_image_store_scanline_64;
+ else
+ store = _pixman_image_store_scanline_32;
+
+ // Skip the store step and composite directly into the
+ // destination if the output format of the compose func matches
+ // the destination format.
+ if (!wide &&
+ !data->dest->common.alpha_map &&
+ !data->dest->common.write_func &&
+ (data->op == PIXMAN_OP_ADD || data->op == PIXMAN_OP_OVER) &&
+ (data->dest->bits.format == PIXMAN_a8r8g8b8 ||
+ data->dest->bits.format == PIXMAN_x8r8g8b8))
+ {
+ store = NULL;
+ }
+
+ if (!store)
+ {
+ bits = data->dest->bits.bits;
+ stride = data->dest->bits.rowstride;
+ }
+ else
+ {
+ bits = NULL;
+ stride = 0;
+ }
+
+ component_alpha =
+ fetchSrc &&
+ fetchMask &&
+ data->mask &&
+ data->mask->common.type == BITS &&
+ data->mask->common.component_alpha &&
+ PIXMAN_FORMAT_RGB (data->mask->bits.format);
+
+ {
+ CombineFunc32 compose;
+
+ if (wide)
+ {
+ if (component_alpha)
+ compose = (CombineFunc32)pixman_composeFunctions64.combineC[data->op];
+ else
+ compose = (CombineFunc32)pixman_composeFunctions64.combineU[data->op];
+ }
+ else
+ {
+ if (component_alpha)
+ compose = pixman_composeFunctions.combineC[data->op];
+ else
+ compose = pixman_composeFunctions.combineU[data->op];
+ }
+
+ if (!compose)
+ return;
+
+ if (!fetchMask)
+ mask_buffer = NULL;
+
+ for (i = 0; i < data->height; ++i)
+ {
+ /* fill first half of scanline with source */
+ if (fetchSrc)
+ {
+ if (fetchMask)
+ {
+ /* fetch mask before source so that fetching of
+ source can be optimized */
+ fetchMask (data->mask, data->xMask, data->yMask + i,
+ data->width, mask_buffer, 0, 0);
+
+ if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
+ fetchMask = NULL;
+ }
+
+ if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
+ {
+ fetchSrc (data->src, data->xSrc, data->ySrc + i,
+ data->width, src_buffer, 0, 0);
+ fetchSrc = NULL;
+ }
+ else
+ {
+ fetchSrc (data->src, data->xSrc, data->ySrc + i,
+ data->width, src_buffer, mask_buffer,
+ 0xffffffff);
+ }
+ }
+ else if (fetchMask)
+ {
+ fetchMask (data->mask, data->xMask, data->yMask + i,
+ data->width, mask_buffer, 0, 0);
+ }
+
+ if (store)
+ {
+ /* fill dest into second half of scanline */
+ if (fetchDest)
+ fetchDest (data->dest, data->xDest, data->yDest + i,
+ data->width, dest_buffer, 0, 0);
+
+ /* blend */
+ compose (dest_buffer, src_buffer, mask_buffer, data->width);
+
+ /* write back */
+ store (&(data->dest->bits), data->xDest, data->yDest + i, data->width,
+ dest_buffer);
+ }
+ else
+ {
+ /* blend */
+ compose (bits + (data->yDest + i) * stride +
+ data->xDest,
+ src_buffer, mask_buffer, data->width);
+ }
+ }
+ }
+}
+
+#define SCANLINE_BUFFER_LENGTH 8192
+
+static void
+general_composite_rect (const FbComposeData *data)
+{
+ uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
+ const pixman_format_code_t srcFormat =
+ data->src->type == BITS ? data->src->bits.format : 0;
+ const pixman_format_code_t maskFormat =
+ data->mask && data->mask->type == BITS ? data->mask->bits.format : 0;
+ const pixman_format_code_t destFormat = data->dest->type == BITS ? data->dest->bits.format : 0;
+ const int srcWide = PIXMAN_FORMAT_16BPC(srcFormat);
+ const int maskWide = data->mask && PIXMAN_FORMAT_16BPC(maskFormat);
+ const int destWide = PIXMAN_FORMAT_16BPC(destFormat);
+ const int wide = srcWide || maskWide || destWide;
+ const int Bpp = wide ? 8 : 4;
+ uint8_t *scanline_buffer = stack_scanline_buffer;
+ uint8_t *src_buffer, *mask_buffer, *dest_buffer;
+
+ if (data->width * Bpp > SCANLINE_BUFFER_LENGTH)
+ {
+ scanline_buffer = pixman_malloc_abc (data->width, 3, Bpp);
+
+ if (!scanline_buffer)
+ return;
+ }
+
+ src_buffer = scanline_buffer;
+ mask_buffer = src_buffer + data->width * Bpp;
+ dest_buffer = mask_buffer + data->width * Bpp;
+
+ pixman_composite_rect_general_internal (data, src_buffer,
+ mask_buffer, dest_buffer,
+ wide);
+
+ if (scanline_buffer != stack_scanline_buffer)
+ free (scanline_buffer);
+}
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "pixman-private.h"
+#include "pixman-mmx.h"
+#include "pixman-vmx.h"
+#include "pixman-sse2.h"
+#include "pixman-arm-simd.h"
+#include "pixman-combine32.h"
+
+static void
+fbCompositeSrcScaleNearest (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 *dst;
+ uint32_t *src;
+ int dstStride, srcStride;
+ int i, j;
+ pixman_vector_t v;
+
+ fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dst, 1);
+ /* pass in 0 instead of xSrc and ySrc because xSrc and ySrc need to be
+ * transformed from destination space to source space */
+ fbComposeGetStart (pSrc, 0, 0, uint32_t, srcStride, src, 1);
+
+ /* reference point is the center of the pixel */
+ v.vector[0] = pixman_int_to_fixed(xSrc) + pixman_fixed_1 / 2;
+ v.vector[1] = pixman_int_to_fixed(ySrc) + pixman_fixed_1 / 2;
+ v.vector[2] = pixman_fixed_1;
+
+ if (!pixman_transform_point_3d (pSrc->common.transform, &v))
+ return;
+
+ /* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */
+ v.vector[0] -= pixman_fixed_e;
+ v.vector[1] -= pixman_fixed_e;
+
+ for (j = 0; j < height; j++) {
+ pixman_fixed_t vx = v.vector[0];
+ pixman_fixed_t vy = v.vector[1];
+ for (i = 0; i < width; ++i) {
+ pixman_bool_t inside_bounds;
+ uint32_t result;
+ int x, y;
+ x = vx >> 16;
+ y = vy >> 16;
+
+ /* apply the repeat function */
+ switch (pSrc->common.repeat) {
+ case PIXMAN_REPEAT_NORMAL:
+ x = MOD (x, pSrc->bits.width);
+ y = MOD (y, pSrc->bits.height);
+ inside_bounds = TRUE;
+ break;
+
+ case PIXMAN_REPEAT_PAD:
+ x = CLIP (x, 0, pSrc->bits.width-1);
+ y = CLIP (y, 0, pSrc->bits.height-1);
+ inside_bounds = TRUE;
+ break;
+
+ case PIXMAN_REPEAT_REFLECT:
+ x = MOD (x, pSrc->bits.width * 2);
+ if (x >= pSrc->bits.width)
+ x = pSrc->bits.width * 2 - x - 1;
+ y = MOD (y, pSrc->bits.height * 2);
+ if (y >= pSrc->bits.height)
+ y = pSrc->bits.height * 2 - y - 1;
+ inside_bounds = TRUE;
+ break;
+
+ case PIXMAN_REPEAT_NONE:
+ default:
+ inside_bounds = (x >= 0 && x < pSrc->bits.width && y >= 0 && y < pSrc->bits.height);
+ break;
+ }
+
+ if (inside_bounds) {
+ //XXX: we should move this multiplication out of the loop
+ result = READ(pSrc, src + y * srcStride + x);
+ } else {
+ result = 0;
+ }
+ WRITE(pDst, dst + i, result);
+
+ /* adjust the x location by a unit vector in the x direction:
+ * this is equivalent to transforming x+1 of the destination point to source space */
+ vx += pSrc->common.transform->matrix[0][0];
+ }
+ /* adjust the y location by a unit vector in the y direction
+ * this is equivalent to transforming y+1 of the destination point to source space */
+ v.vector[1] += pSrc->common.transform->matrix[1][1];
+ dst += dstStride;
+ }
+}
+
+static void
+pixman_walk_composite_region (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,
+ pixman_bool_t srcRepeat,
+ pixman_bool_t maskRepeat,
+ CompositeFunc compositeRect)
+{
+ int n;
+ const pixman_box32_t *pbox;
+ int w, h, w_this, h_this;
+ int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
+ pixman_region32_t reg;
+ pixman_region32_t *region;
+
+ pixman_region32_init (®);
+ if (!pixman_compute_composite_region32 (®, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))
+ {
+ return;
+ }
+
+ region = ®
+
+ pbox = pixman_region32_rectangles (region, &n);
+ while (n--)
+ {
+ h = pbox->y2 - pbox->y1;
+ y_src = pbox->y1 - yDst + ySrc;
+ y_msk = pbox->y1 - yDst + yMask;
+ y_dst = pbox->y1;
+ while (h)
+ {
+ h_this = h;
+ w = pbox->x2 - pbox->x1;
+ x_src = pbox->x1 - xDst + xSrc;
+ x_msk = pbox->x1 - xDst + xMask;
+ x_dst = pbox->x1;
+ if (maskRepeat)
+ {
+ y_msk = MOD (y_msk, pMask->bits.height);
+ if (h_this > pMask->bits.height - y_msk)
+ h_this = pMask->bits.height - y_msk;
+ }
+ if (srcRepeat)
+ {
+ y_src = MOD (y_src, pSrc->bits.height);
+ if (h_this > pSrc->bits.height - y_src)
+ h_this = pSrc->bits.height - y_src;
+ }
+ while (w)
+ {
+ w_this = w;
+ if (maskRepeat)
+ {
+ x_msk = MOD (x_msk, pMask->bits.width);
+ if (w_this > pMask->bits.width - x_msk)
+ w_this = pMask->bits.width - x_msk;
+ }
+ if (srcRepeat)
+ {
+ x_src = MOD (x_src, pSrc->bits.width);
+ if (w_this > pSrc->bits.width - x_src)
+ w_this = pSrc->bits.width - x_src;
+ }
+ (*compositeRect) (op, pSrc, pMask, pDst,
+ x_src, y_src, x_msk, y_msk, x_dst, y_dst,
+ w_this, h_this);
+ w -= w_this;
+ x_src += w_this;
+ x_msk += w_this;
+ x_dst += w_this;
+ }
+ h -= h_this;
+ y_src += h_this;
+ y_msk += h_this;
+ y_dst += h_this;
+ }
+ pbox++;
+ }
+ pixman_region32_fini (®);
+}
+
+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)
+{
+ FbComposeData compose_data;
+
+ return_if_fail (src != NULL);
+ return_if_fail (dest != NULL);
+
+ compose_data.op = op;
+ compose_data.src = src;
+ compose_data.mask = mask;
+ compose_data.dest = dest;
+ compose_data.xSrc = src_x;
+ compose_data.ySrc = src_y;
+ compose_data.xMask = mask_x;
+ compose_data.yMask = mask_y;
+ compose_data.xDest = dest_x;
+ compose_data.yDest = dest_y;
+ compose_data.width = width;
+ compose_data.height = height;
+
+ general_composite_rect (&compose_data);
+}
+
+static pixman_bool_t
+mask_is_solid (pixman_image_t *mask)
+{
+ if (mask->type == SOLID)
+ return TRUE;
+
+ if (mask->type == BITS &&
+ mask->common.repeat == PIXMAN_REPEAT_NORMAL &&
+ mask->bits.width == 1 &&
+ mask->bits.height == 1)
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static const FastPathInfo *
+get_fast_path (const FastPathInfo *fast_paths,
+ pixman_op_t op,
+ pixman_image_t *pSrc,
+ pixman_image_t *pMask,
+ pixman_image_t *pDst,
+ pixman_bool_t is_pixbuf)
+{
+ const FastPathInfo *info;
+
+ for (info = fast_paths; info->op != PIXMAN_OP_NONE; info++)
+ {
+ pixman_bool_t valid_src = FALSE;
+ pixman_bool_t valid_mask = FALSE;
+
+ if (info->op != op)
+ continue;
+
+ if ((info->src_format == PIXMAN_solid && pixman_image_can_get_solid (pSrc)) ||
+ (pSrc->type == BITS && info->src_format == pSrc->bits.format))
+ {
+ valid_src = TRUE;
+ }
+
+ if (!valid_src)
+ continue;
+
+ if ((info->mask_format == PIXMAN_null && !pMask) ||
+ (pMask && pMask->type == BITS && info->mask_format == pMask->bits.format))
+ {
+ valid_mask = TRUE;
+
+ if (info->flags & NEED_SOLID_MASK)
+ {
+ if (!pMask || !mask_is_solid (pMask))
+ valid_mask = FALSE;
+ }
+
+ if (info->flags & NEED_COMPONENT_ALPHA)
+ {
+ if (!pMask || !pMask->common.component_alpha)
+ valid_mask = FALSE;
+ }
+ }
+
+ if (!valid_mask)
+ continue;
+
+ if (info->dest_format != pDst->bits.format)
+ continue;
+
+ if ((info->flags & NEED_PIXBUF) && !is_pixbuf)
+ continue;
+
+ return info;
+ }
+
+ return NULL;
+}
+
+#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
+
+/*
+ * Work around GCC bug causing crashes in Mozilla with SSE2
+ *
+ * When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
+ * aligned. Unfortunately some code, such as Mozilla and Mono contain
+ * code that aligns the stack to 4 bytes.
+ *
+ * The __force_align_arg_pointer__ makes gcc generate a prologue that
+ * realigns the stack pointer to 16 bytes.
+ *
+ * On x86-64 this is not necessary because the standard ABI already
+ * calls for a 16 byte aligned stack.
+ *
+ * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
+ */
+
+__attribute__((__force_align_arg_pointer__))
+#endif
+static void
+general_composite (pixman_implementation_t * imp,
+ pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * mask,
+ pixman_image_t * dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
+ pixman_bool_t srcRepeat = src->type == BITS && src->common.repeat == PIXMAN_REPEAT_NORMAL;
+ pixman_bool_t maskRepeat = FALSE;
+ pixman_bool_t srcTransform = src->common.transform != NULL;
+ pixman_bool_t maskTransform = FALSE;
+ pixman_bool_t srcAlphaMap = src->common.alpha_map != NULL;
+ pixman_bool_t maskAlphaMap = FALSE;
+ pixman_bool_t dstAlphaMap = dest->common.alpha_map != NULL;
+ CompositeFunc func = NULL;
+
+#ifdef USE_MMX
+ fbComposeSetupMMX();
+#endif
+
+#ifdef USE_VMX
+ fbComposeSetupVMX();
+#endif
+
+#ifdef USE_SSE2
+ fbComposeSetupSSE2();
+#endif
+
+ if (srcRepeat && srcTransform &&
+ src->bits.width == 1 &&
+ src->bits.height == 1)
+ {
+ srcTransform = FALSE;
+ }
+
+ if (mask && mask->type == BITS)
+ {
+ maskRepeat = mask->common.repeat == PIXMAN_REPEAT_NORMAL;
+
+ maskTransform = mask->common.transform != 0;
+ if (mask->common.filter == PIXMAN_FILTER_CONVOLUTION)
+ maskTransform = TRUE;
+
+ maskAlphaMap = mask->common.alpha_map != 0;
+
+ if (maskRepeat && maskTransform &&
+ mask->bits.width == 1 &&
+ mask->bits.height == 1)
+ {
+ maskTransform = FALSE;
+ }
+ }
+
+ if (src->type == BITS
+ && srcTransform
+ && !mask
+ && op == PIXMAN_OP_SRC
+ && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
+ && (src->common.filter == PIXMAN_FILTER_NEAREST)
+ && PIXMAN_FORMAT_BPP(dest->bits.format) == 32
+ && src->bits.format == dest->bits.format
+ && src->common.src_clip == &(src->common.full_region)
+ && !src->common.read_func && !src->common.write_func
+ && !dest->common.read_func && !dest->common.write_func)
+ {
+ /* ensure that the transform matrix only has a scale */
+ if (src->common.transform->matrix[0][1] == 0 &&
+ src->common.transform->matrix[1][0] == 0 &&
+ src->common.transform->matrix[2][0] == 0 &&
+ src->common.transform->matrix[2][1] == 0 &&
+ src->common.transform->matrix[2][2] == pixman_fixed_1) {
+ func = fbCompositeSrcScaleNearest;
+ /* Like the general path, fbCompositeSrcScaleNearest handles all the repeat types itself */
+ srcRepeat = FALSE;
+ }
+ } else if ((src->type == BITS || pixman_image_can_get_solid (src)) && (!mask || mask->type == BITS)
+ && !srcTransform && !maskTransform
+ && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
+ && (src->common.filter != PIXMAN_FILTER_CONVOLUTION)
+ && (src->common.repeat != PIXMAN_REPEAT_PAD)
+ && (src->common.repeat != PIXMAN_REPEAT_REFLECT)
+ && (!mask || (mask->common.filter != PIXMAN_FILTER_CONVOLUTION &&
+ mask->common.repeat != PIXMAN_REPEAT_PAD && mask->common.repeat != PIXMAN_REPEAT_REFLECT))
+ && !src->common.read_func && !src->common.write_func
+ && !(mask && mask->common.read_func) && !(mask && mask->common.write_func)
+ && !dest->common.read_func && !dest->common.write_func)
+ {
+ const FastPathInfo *info;
+ pixman_bool_t pixbuf;
+
+ pixbuf =
+ src && src->type == BITS &&
+ mask && mask->type == BITS &&
+ src->bits.bits == mask->bits.bits &&
+ src_x == mask_x &&
+ src_y == mask_y &&
+ !mask->common.component_alpha &&
+ !maskRepeat;
+ info = NULL;
+
+#ifdef USE_SSE2
+ if (pixman_have_sse2 ())
+ info = get_fast_path (sse2_fast_paths, op, src, mask, dest, pixbuf);
+#endif
+
+#ifdef USE_MMX
+ if (!info && pixman_have_mmx())
+ info = get_fast_path (mmx_fast_paths, op, src, mask, dest, pixbuf);
+#endif
+
+#ifdef USE_VMX
+
+ if (!info && pixman_have_vmx())
+ info = get_fast_path (vmx_fast_paths, op, src, mask, dest, pixbuf);
+#endif
+
+#ifdef USE_ARM_NEON
+ if (!info && pixman_have_arm_neon())
+ info = get_fast_path (arm_neon_fast_paths, op, src, mask, dest, pixbuf);
+#endif
+
+#ifdef USE_ARM_SIMD
+ if (!info && pixman_have_arm_simd())
+ info = get_fast_path (arm_simd_fast_paths, op, src, mask, dest, pixbuf);
+#endif
+
+ if (!info)
+ info = get_fast_path (c_fast_paths, op, src, mask, dest, pixbuf);
+
+ if (info)
+ {
+ func = info->func;
+
+ if (info->src_format == PIXMAN_solid)
+ srcRepeat = FALSE;
+
+ if (info->mask_format == PIXMAN_solid ||
+ info->flags & NEED_SOLID_MASK)
+ {
+ maskRepeat = FALSE;
+ }
+ }
+ }
+
+ if ((srcRepeat &&
+ src->bits.width == 1 &&
+ src->bits.height == 1) ||
+ (maskRepeat &&
+ mask->bits.width == 1 &&
+ mask->bits.height == 1))
+ {
+ /* If src or mask are repeating 1x1 images and srcRepeat or
+ * maskRepeat are still TRUE, it means the fast path we
+ * selected does not actually handle repeating images.
+ *
+ * So rather than call the "fast path" with a zillion
+ * 1x1 requests, we just use the general code (which does
+ * do something sensible with 1x1 repeating images).
+ */
+ func = NULL;
+ }
+
+ if (!func)
+ {
+ func = pixman_image_composite_rect;
+
+ /* CompositeGeneral optimizes 1x1 repeating images itself */
+ if (src->type == BITS &&
+ src->bits.width == 1 && src->bits.height == 1)
+ {
+ srcRepeat = FALSE;
+ }
+
+ if (mask && mask->type == BITS &&
+ mask->bits.width == 1 && mask->bits.height == 1)
+ {
+ maskRepeat = FALSE;
+ }
+
+ /* if we are transforming, repeats are handled in fbFetchTransformed */
+ if (srcTransform)
+ srcRepeat = FALSE;
+
+ if (maskTransform)
+ maskRepeat = FALSE;
+ }
+
+ pixman_walk_composite_region (op, src, mask, dest, src_x, src_y,
+ mask_x, mask_y, dest_x, dest_y, width, height,
+ srcRepeat, maskRepeat, func);
+}
+
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel)
{
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL);
int i;
+ imp->composite = general_composite;
+
for (i = 0; i < PIXMAN_OP_LAST; ++i)
{
- imp->combine_32[i] = combine_32;
- imp->combine_64[i] = combine_64;
- imp->combine_32_ca[i] = combine_32_ca;
- imp->combine_64_ca[i] = combine_64_ca;
+ imp->combine_32[i] = general_combine_32;
+ imp->combine_32_ca[i] = general_combine_32_ca;
+ imp->combine_64[i] = general_combine_64;
+ imp->combine_64_ca[i] = general_combine_64_ca;
}
return imp;
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index b22785b..9290824 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -26,317 +26,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include "pixman-private.h"
-#include "pixman-mmx.h"
-#include "pixman-vmx.h"
-#include "pixman-sse2.h"
-#include "pixman-arm-simd.h"
-#include "pixman-arm-neon.h"
-#include "pixman-combine32.h"
-
-static void
-fbCompositeSrcScaleNearest (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 *dst;
- uint32_t *src;
- int dstStride, srcStride;
- int i, j;
- pixman_vector_t v;
-
- fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dst, 1);
- /* pass in 0 instead of xSrc and ySrc because xSrc and ySrc need to be
- * transformed from destination space to source space */
- fbComposeGetStart (pSrc, 0, 0, uint32_t, srcStride, src, 1);
-
- /* reference point is the center of the pixel */
- v.vector[0] = pixman_int_to_fixed(xSrc) + pixman_fixed_1 / 2;
- v.vector[1] = pixman_int_to_fixed(ySrc) + pixman_fixed_1 / 2;
- v.vector[2] = pixman_fixed_1;
-
- if (!pixman_transform_point_3d (pSrc->common.transform, &v))
- return;
-
- /* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */
- v.vector[0] -= pixman_fixed_e;
- v.vector[1] -= pixman_fixed_e;
-
- for (j = 0; j < height; j++) {
- pixman_fixed_t vx = v.vector[0];
- pixman_fixed_t vy = v.vector[1];
- for (i = 0; i < width; ++i) {
- pixman_bool_t inside_bounds;
- uint32_t result;
- int x, y;
- x = vx >> 16;
- y = vy >> 16;
-
- /* apply the repeat function */
- switch (pSrc->common.repeat) {
- case PIXMAN_REPEAT_NORMAL:
- x = MOD (x, pSrc->bits.width);
- y = MOD (y, pSrc->bits.height);
- inside_bounds = TRUE;
- break;
-
- case PIXMAN_REPEAT_PAD:
- x = CLIP (x, 0, pSrc->bits.width-1);
- y = CLIP (y, 0, pSrc->bits.height-1);
- inside_bounds = TRUE;
- break;
-
- case PIXMAN_REPEAT_REFLECT:
- x = MOD (x, pSrc->bits.width * 2);
- if (x >= pSrc->bits.width)
- x = pSrc->bits.width * 2 - x - 1;
- y = MOD (y, pSrc->bits.height * 2);
- if (y >= pSrc->bits.height)
- y = pSrc->bits.height * 2 - y - 1;
- inside_bounds = TRUE;
- break;
-
- case PIXMAN_REPEAT_NONE:
- default:
- inside_bounds = (x >= 0 && x < pSrc->bits.width && y >= 0 && y < pSrc->bits.height);
- break;
- }
-
- if (inside_bounds) {
- //XXX: we should move this multiplication out of the loop
- result = READ(pSrc, src + y * srcStride + x);
- } else {
- result = 0;
- }
- WRITE(pDst, dst + i, result);
-
- /* adjust the x location by a unit vector in the x direction:
- * this is equivalent to transforming x+1 of the destination point to source space */
- vx += pSrc->common.transform->matrix[0][0];
- }
- /* adjust the y location by a unit vector in the y direction
- * this is equivalent to transforming y+1 of the destination point to source space */
- v.vector[1] += pSrc->common.transform->matrix[1][1];
- dst += dstStride;
- }
-}
-
-static void
-pixman_walk_composite_region (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,
- pixman_bool_t srcRepeat,
- pixman_bool_t maskRepeat,
- CompositeFunc compositeRect)
-{
- int n;
- const pixman_box32_t *pbox;
- int w, h, w_this, h_this;
- int x_msk, y_msk, x_src, y_src, x_dst, y_dst;
- pixman_region32_t reg;
- pixman_region32_t *region;
-
- pixman_region32_init (®);
- if (!pixman_compute_composite_region32 (®, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))
- {
- return;
- }
-
- region = ®
-
- pbox = pixman_region32_rectangles (region, &n);
- while (n--)
- {
- h = pbox->y2 - pbox->y1;
- y_src = pbox->y1 - yDst + ySrc;
- y_msk = pbox->y1 - yDst + yMask;
- y_dst = pbox->y1;
- while (h)
- {
- h_this = h;
- w = pbox->x2 - pbox->x1;
- x_src = pbox->x1 - xDst + xSrc;
- x_msk = pbox->x1 - xDst + xMask;
- x_dst = pbox->x1;
- if (maskRepeat)
- {
- y_msk = MOD (y_msk, pMask->bits.height);
- if (h_this > pMask->bits.height - y_msk)
- h_this = pMask->bits.height - y_msk;
- }
- if (srcRepeat)
- {
- y_src = MOD (y_src, pSrc->bits.height);
- if (h_this > pSrc->bits.height - y_src)
- h_this = pSrc->bits.height - y_src;
- }
- while (w)
- {
- w_this = w;
- if (maskRepeat)
- {
- x_msk = MOD (x_msk, pMask->bits.width);
- if (w_this > pMask->bits.width - x_msk)
- w_this = pMask->bits.width - x_msk;
- }
- if (srcRepeat)
- {
- x_src = MOD (x_src, pSrc->bits.width);
- if (w_this > pSrc->bits.width - x_src)
- w_this = pSrc->bits.width - x_src;
- }
- (*compositeRect) (op, pSrc, pMask, pDst,
- x_src, y_src, x_msk, y_msk, x_dst, y_dst,
- w_this, h_this);
- w -= w_this;
- x_src += w_this;
- x_msk += w_this;
- x_dst += w_this;
- }
- h -= h_this;
- y_src += h_this;
- y_msk += h_this;
- y_dst += h_this;
- }
- pbox++;
- }
- pixman_region32_fini (®);
-}
-
-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)
-{
- FbComposeData compose_data;
-
- return_if_fail (src != NULL);
- return_if_fail (dest != NULL);
-
- compose_data.op = op;
- compose_data.src = src;
- compose_data.mask = mask;
- compose_data.dest = dest;
- compose_data.xSrc = src_x;
- compose_data.ySrc = src_y;
- compose_data.xMask = mask_x;
- compose_data.yMask = mask_y;
- compose_data.xDest = dest_x;
- compose_data.yDest = dest_y;
- compose_data.width = width;
- compose_data.height = height;
-
- pixman_composite_rect_general (&compose_data);
-}
-
-static pixman_bool_t
-mask_is_solid (pixman_image_t *mask)
-{
- if (mask->type == SOLID)
- return TRUE;
-
- if (mask->type == BITS &&
- mask->common.repeat == PIXMAN_REPEAT_NORMAL &&
- mask->bits.width == 1 &&
- mask->bits.height == 1)
- {
- return TRUE;
- }
-
- return FALSE;
-}
-
-static const FastPathInfo *
-get_fast_path (const FastPathInfo *fast_paths,
- pixman_op_t op,
- pixman_image_t *pSrc,
- pixman_image_t *pMask,
- pixman_image_t *pDst,
- pixman_bool_t is_pixbuf)
-{
- const FastPathInfo *info;
-
- for (info = fast_paths; info->op != PIXMAN_OP_NONE; info++)
- {
- pixman_bool_t valid_src = FALSE;
- pixman_bool_t valid_mask = FALSE;
-
- if (info->op != op)
- continue;
-
- if ((info->src_format == PIXMAN_solid && pixman_image_can_get_solid (pSrc)) ||
- (pSrc->type == BITS && info->src_format == pSrc->bits.format))
- {
- valid_src = TRUE;
- }
-
- if (!valid_src)
- continue;
-
- if ((info->mask_format == PIXMAN_null && !pMask) ||
- (pMask && pMask->type == BITS && info->mask_format == pMask->bits.format))
- {
- valid_mask = TRUE;
-
- if (info->flags & NEED_SOLID_MASK)
- {
- if (!pMask || !mask_is_solid (pMask))
- valid_mask = FALSE;
- }
-
- if (info->flags & NEED_COMPONENT_ALPHA)
- {
- if (!pMask || !pMask->common.component_alpha)
- valid_mask = FALSE;
- }
- }
-
- if (!valid_mask)
- continue;
-
- if (info->dest_format != pDst->bits.format)
- continue;
-
- if ((info->flags & NEED_PIXBUF) && !is_pixbuf)
- continue;
-
- return info;
- }
-
- return NULL;
-}
/*
* Operator optimizations based on source or destination opacity
@@ -412,231 +102,37 @@ pixman_optimize_operator(pixman_op_t op, pixman_image_t *pSrc, pixman_image_t *p
}
-#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
-
-/*
- * Work around GCC bug causing crashes in Mozilla with SSE2
- *
- * When using SSE2 intrinsics, gcc assumes that the stack is 16 byte
- * aligned. Unfortunately some code, such as Mozilla and Mono contain
- * code that aligns the stack to 4 bytes.
- *
- * The __force_align_arg_pointer__ makes gcc generate a prologue that
- * realigns the stack pointer to 16 bytes.
- *
- * On x86-64 this is not necessary because the standard ABI already
- * calls for a 16 byte aligned stack.
- *
- * See https://bugs.freedesktop.org/show_bug.cgi?id=15693
- */
-
-__attribute__((__force_align_arg_pointer__))
-#endif
PIXMAN_EXPORT void
pixman_image_composite (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,
+ 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)
{
- pixman_bool_t srcRepeat = pSrc->type == BITS && pSrc->common.repeat == PIXMAN_REPEAT_NORMAL;
- pixman_bool_t maskRepeat = FALSE;
- pixman_bool_t srcTransform = pSrc->common.transform != NULL;
- pixman_bool_t maskTransform = FALSE;
- pixman_bool_t srcAlphaMap = pSrc->common.alpha_map != NULL;
- pixman_bool_t maskAlphaMap = FALSE;
- pixman_bool_t dstAlphaMap = pDst->common.alpha_map != NULL;
- CompositeFunc func = NULL;
-
-#ifdef USE_MMX
- fbComposeSetupMMX();
-#endif
-
-#ifdef USE_VMX
- fbComposeSetupVMX();
-#endif
-
-#ifdef USE_SSE2
- fbComposeSetupSSE2();
-#endif
-
- if (srcRepeat && srcTransform &&
- pSrc->bits.width == 1 &&
- pSrc->bits.height == 1)
- {
- srcTransform = FALSE;
- }
-
- if (pMask && pMask->type == BITS)
- {
- maskRepeat = pMask->common.repeat == PIXMAN_REPEAT_NORMAL;
-
- maskTransform = pMask->common.transform != 0;
- if (pMask->common.filter == PIXMAN_FILTER_CONVOLUTION)
- maskTransform = TRUE;
-
- maskAlphaMap = pMask->common.alpha_map != 0;
-
- if (maskRepeat && maskTransform &&
- pMask->bits.width == 1 &&
- pMask->bits.height == 1)
- {
- maskTransform = FALSE;
- }
- }
+ static pixman_implementation_t *imp;
/*
- * Check if we can replace our operator by a simpler one if the src or dest are opaque
- * The output operator should be mathematically equivalent to the source.
- */
- op = pixman_optimize_operator(op, pSrc, pMask, pDst);
+ * Check if we can replace our operator by a simpler one if the src or dest are opaque
+ * The output operator should be mathematically equivalent to the source.
+ */
+ op = pixman_optimize_operator(op, src, mask, dest);
if(op == PIXMAN_OP_DST)
return;
- if (pSrc->type == BITS
- && srcTransform
- && !pMask
- && op == PIXMAN_OP_SRC
- && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
- && (pSrc->common.filter == PIXMAN_FILTER_NEAREST)
- && PIXMAN_FORMAT_BPP(pDst->bits.format) == 32
- && pSrc->bits.format == pDst->bits.format
- && pSrc->common.src_clip == &(pSrc->common.full_region)
- && !pSrc->common.read_func && !pSrc->common.write_func
- && !pDst->common.read_func && !pDst->common.write_func)
- {
- /* ensure that the transform matrix only has a scale */
- if (pSrc->common.transform->matrix[0][1] == 0 &&
- pSrc->common.transform->matrix[1][0] == 0 &&
- pSrc->common.transform->matrix[2][0] == 0 &&
- pSrc->common.transform->matrix[2][1] == 0 &&
- pSrc->common.transform->matrix[2][2] == pixman_fixed_1) {
- func = fbCompositeSrcScaleNearest;
- /* Like the general path, fbCompositeSrcScaleNearest handles all the repeat types itself */
- srcRepeat = FALSE;
- }
- } else if ((pSrc->type == BITS || pixman_image_can_get_solid (pSrc)) && (!pMask || pMask->type == BITS)
- && !srcTransform && !maskTransform
- && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
- && (pSrc->common.filter != PIXMAN_FILTER_CONVOLUTION)
- && (pSrc->common.repeat != PIXMAN_REPEAT_PAD)
- && (pSrc->common.repeat != PIXMAN_REPEAT_REFLECT)
- && (!pMask || (pMask->common.filter != PIXMAN_FILTER_CONVOLUTION &&
- pMask->common.repeat != PIXMAN_REPEAT_PAD && pMask->common.repeat != PIXMAN_REPEAT_REFLECT))
- && !pSrc->common.read_func && !pSrc->common.write_func
- && !(pMask && pMask->common.read_func) && !(pMask && pMask->common.write_func)
- && !pDst->common.read_func && !pDst->common.write_func)
- {
- const FastPathInfo *info;
- pixman_bool_t pixbuf;
-
- pixbuf =
- pSrc && pSrc->type == BITS &&
- pMask && pMask->type == BITS &&
- pSrc->bits.bits == pMask->bits.bits &&
- xSrc == xMask &&
- ySrc == yMask &&
- !pMask->common.component_alpha &&
- !maskRepeat;
- info = NULL;
-
-#ifdef USE_SSE2
- if (pixman_have_sse2 ())
- info = get_fast_path (sse2_fast_paths, op, pSrc, pMask, pDst, pixbuf);
-#endif
-
-#ifdef USE_MMX
- if (!info && pixman_have_mmx())
- info = get_fast_path (mmx_fast_paths, op, pSrc, pMask, pDst, pixbuf);
-#endif
-
-#ifdef USE_VMX
-
- if (!info && pixman_have_vmx())
- info = get_fast_path (vmx_fast_paths, op, pSrc, pMask, pDst, pixbuf);
-#endif
-
-#ifdef USE_ARM_NEON
- if (!info && pixman_have_arm_neon())
- info = get_fast_path (arm_neon_fast_paths, op, pSrc, pMask, pDst, pixbuf);
-#endif
-
-#ifdef USE_ARM_SIMD
- if (!info && pixman_have_arm_simd())
- info = get_fast_path (arm_simd_fast_paths, op, pSrc, pMask, pDst, pixbuf);
-#endif
-
- if (!info)
- info = get_fast_path (c_fast_paths, op, pSrc, pMask, pDst, pixbuf);
-
- if (info)
- {
- func = info->func;
-
- if (info->src_format == PIXMAN_solid)
- srcRepeat = FALSE;
+ if (!imp)
+ imp = _pixman_implementation_create_general (NULL);
- if (info->mask_format == PIXMAN_solid ||
- info->flags & NEED_SOLID_MASK)
- {
- maskRepeat = FALSE;
- }
- }
- }
-
- if ((srcRepeat &&
- pSrc->bits.width == 1 &&
- pSrc->bits.height == 1) ||
- (maskRepeat &&
- pMask->bits.width == 1 &&
- pMask->bits.height == 1))
- {
- /* If src or mask are repeating 1x1 images and srcRepeat or
- * maskRepeat are still TRUE, it means the fast path we
- * selected does not actually handle repeating images.
- *
- * So rather than call the "fast path" with a zillion
- * 1x1 requests, we just use the general code (which does
- * do something sensible with 1x1 repeating images).
- */
- func = NULL;
- }
-
- if (!func)
- {
- func = pixman_image_composite_rect;
-
- /* CompositeGeneral optimizes 1x1 repeating images itself */
- if (pSrc->type == BITS &&
- pSrc->bits.width == 1 && pSrc->bits.height == 1)
- {
- srcRepeat = FALSE;
- }
-
- if (pMask && pMask->type == BITS &&
- pMask->bits.width == 1 && pMask->bits.height == 1)
- {
- maskRepeat = FALSE;
- }
-
- /* if we are transforming, repeats are handled in fbFetchTransformed */
- if (srcTransform)
- srcRepeat = FALSE;
-
- if (maskTransform)
- maskRepeat = FALSE;
- }
-
- pixman_walk_composite_region (op, pSrc, pMask, pDst, xSrc, ySrc,
- xMask, yMask, xDst, yDst, width, height,
- srcRepeat, maskRepeat, func);
+ imp->composite (imp, op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height);
}
-
-
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index eae9027..fda2531 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -970,4 +970,9 @@ _pixman_implementation_composite (pixman_implementation_t * imp,
int32_t width,
int32_t height);
+/* Specific implementations */
+pixman_implementation_t *
+_pixman_implementation_create_general (pixman_implementation_t *toplevel);
+
+
#endif /* PIXMAN_PRIVATE_H */
commit 12726de921a621b8147d12d7e0788076bc4cc80d
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 04:04:36 2009 -0400
Add beginning of general implementation
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 21503b6..c1faac3 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -18,6 +18,7 @@ libpixman_1_la_SOURCES = \
pixman-combine64.c \
pixman-combine64.h \
pixman-compose.c \
+ pixman-general.c \
pixman-pict.c \
pixman-fast-path.c \
pixman-solid-fill.c \
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
new file mode 100644
index 0000000..cc95eab
--- /dev/null
+++ b/pixman/pixman-general.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Red Hat not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Red Hat makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+#include <config.h>
+#include "pixman-private.h"
+
+static void
+combine_32 (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+ int width)
+{
+ CombineFunc32 f = pixman_composeFunctions.combineU[op];
+
+ f (dest, src, mask, width);
+}
+
+static void
+combine_64 (pixman_implementation_t *imp, pixman_op_t op,
+ uint64_t *dest, const uint64_t *src, const uint64_t *mask,
+ int width)
+{
+ CombineFunc64 f = pixman_composeFunctions64.combineU[op];
+
+ f (dest, src, mask, width);
+}
+
+static void
+combine_32_ca (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+ int width)
+{
+ CombineFunc32 f = pixman_composeFunctions.combineC[op];
+
+ f (dest, src, mask, width);
+}
+
+static void
+combine_64_ca (pixman_implementation_t *imp, pixman_op_t op,
+ uint64_t *dest, const uint64_t *src, const uint64_t *mask,
+ int width)
+{
+ CombineFunc64 f = pixman_composeFunctions64.combineC[op];
+
+ f (dest, src, mask, width);
+}
+
+pixman_implementation_t *
+_pixman_implementation_create_general (pixman_implementation_t *toplevel)
+{
+ pixman_implementation_t *imp = _pixman_implementation_create (toplevel, NULL);
+ int i;
+
+ for (i = 0; i < PIXMAN_OP_LAST; ++i)
+ {
+ imp->combine_32[i] = combine_32;
+ imp->combine_64[i] = combine_64;
+ imp->combine_32_ca[i] = combine_32_ca;
+ imp->combine_64_ca[i] = combine_64_ca;
+ }
+
+ return imp;
+}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 7cf8e12..eae9027 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -932,9 +932,15 @@ struct pixman_implementation_t
pixman_composite_func_t composite;
pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
+ pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST];
pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST];
+ pixman_combine_64_func_t combine_64_ca[PIXMAN_OP_LAST];
};
+pixman_implementation_t *
+_pixman_implementation_create (pixman_implementation_t *toplevel,
+ pixman_implementation_t *delegate);
+
void
_pixman_implementation_combine_32 (pixman_implementation_t * imp,
pixman_op_t op,
commit d2faa63aee2179188dba712835c40068729565ff
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 03:40:05 2009 -0400
Formatting
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index e4e77f7..7cf8e12 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -675,9 +675,9 @@ _pixman_gradient_walker_pixel (GradientWalker *walker,
#define READ(img, ptr) (*(ptr))
#define WRITE(img, ptr, val) (*(ptr) = (val))
-#define MEMCPY_WRAPPED(img, dst, src, size) \
+#define MEMCPY_WRAPPED(img, dst, src, size) \
memcpy(dst, src, size)
-#define MEMSET_WRAPPED(img, dst, val, size) \
+#define MEMSET_WRAPPED(img, dst, val, size) \
memset(dst, val, size)
#endif
@@ -702,7 +702,7 @@ _pixman_gradient_walker_pixel (GradientWalker *walker,
(res) = READ(img, (uint32_t *)bits__); \
break; \
case 24: \
- (res) = Fetch24(img, (uint8_t *) bits__); \
+ (res) = Fetch24(img, (uint8_t *) bits__); \
break; \
case 16: \
(res) = READ(img, (uint16_t *) bits__); \
commit a17e27c2b4afc6118e5aeae380eb96d98f982033
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed May 13 03:31:11 2009 -0400
Beginning of pluggable implementations
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index b55daa0..21503b6 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -12,6 +12,7 @@ libpixman_1_la_SOURCES = \
pixman-region32.c \
pixman-private.h \
pixman-image.c \
+ pixman-implementation.c \
pixman-combine32.c \
pixman-combine32.h \
pixman-combine64.c \
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
new file mode 100644
index 0000000..c8c09ad
--- /dev/null
+++ b/pixman/pixman-implementation.c
@@ -0,0 +1,150 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Red Hat not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Red Hat makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+#include "pixman-private.h"
+
+static void
+delegate_composite (pixman_implementation_t * imp,
+ pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * mask,
+ pixman_image_t * dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
+ _pixman_implementation_composite (imp->delegate,
+ op,
+ src, mask, dest,
+ src_x, src_y,
+ mask_x, mask_y,
+ dest_x, dest_y,
+ width, height);
+}
+
+static void
+delegate_combine_32 (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width)
+{
+ _pixman_implementation_combine_32 (imp->delegate,
+ op, dest, src, mask, width);
+}
+
+static void
+delegate_combine_64 (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width)
+{
+ _pixman_implementation_combine_64 (imp->delegate,
+ op, dest, src, mask, width);
+}
+
+pixman_implementation_t *
+_pixman_implementation_create (pixman_implementation_t *toplevel,
+ pixman_implementation_t *delegate)
+{
+ pixman_implementation_t *imp = malloc (sizeof (pixman_implementation_t));
+ int i;
+
+ if (!imp)
+ return NULL;
+
+ if (toplevel)
+ imp->toplevel = toplevel;
+ else
+ imp->toplevel = imp;
+
+ if (delegate)
+ delegate->toplevel = imp->toplevel;
+
+ imp->delegate = delegate;
+
+ /* Fill out function pointers with ones that just delegate
+ */
+ imp->composite = delegate_composite;
+
+ for (i = 0; i < PIXMAN_OP_LAST; ++i)
+ {
+ imp->combine_32[i] = delegate_combine_32;
+ imp->combine_64[i] = delegate_combine_64;
+ }
+
+ return imp;
+}
+
+void
+_pixman_implementation_combine_32 (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width)
+{
+ (* imp->delegate->combine_32[op]) (imp, op, dest, src, mask, width);
+}
+
+void
+_pixman_implementation_combine_64 (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width)
+{
+ (* imp->delegate->combine_64[op]) (imp, op, dest, src, mask, width);
+}
+
+void
+_pixman_implementation_composite (pixman_implementation_t * imp,
+ pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * mask,
+ pixman_image_t * dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height)
+{
+ (* imp->delegate->composite) (imp, op,
+ src, mask, dest,
+ src_x, src_y, mask_x, mask_y, dest_x, dest_y,
+ width, height);
+}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 7432e97..e4e77f7 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -894,4 +894,74 @@ void pixman_timer_register (PixmanTimer *timer);
#endif /* PIXMAN_TIMING */
+typedef struct pixman_implementation_t pixman_implementation_t;
+
+typedef void (* pixman_combine_32_func_t) (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width);
+
+typedef void (* pixman_combine_64_func_t) (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width);
+
+typedef void (* pixman_composite_func_t) (pixman_implementation_t * imp,
+ pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * mask,
+ pixman_image_t * dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height);
+
+struct pixman_implementation_t
+{
+ pixman_implementation_t * toplevel;
+ pixman_implementation_t * delegate;
+
+ pixman_composite_func_t composite;
+
+ pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
+ pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST];
+};
+
+void
+_pixman_implementation_combine_32 (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint32_t * dest,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width);
+void
+_pixman_implementation_combine_64 (pixman_implementation_t * imp,
+ pixman_op_t op,
+ uint64_t * dest,
+ const uint64_t * src,
+ const uint64_t * mask,
+ int width);
+void
+_pixman_implementation_composite (pixman_implementation_t * imp,
+ pixman_op_t op,
+ pixman_image_t * src,
+ pixman_image_t * mask,
+ pixman_image_t * dest,
+ int32_t src_x,
+ int32_t src_y,
+ int32_t mask_x,
+ int32_t mask_y,
+ int32_t dest_x,
+ int32_t dest_y,
+ int32_t width,
+ int32_t height);
+
#endif /* PIXMAN_PRIVATE_H */
diff --git a/pixman/pixman.h b/pixman/pixman.h
index 7ae425c..29c054a 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -368,7 +368,8 @@ typedef enum
PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a,
PIXMAN_OP_CONJOINT_XOR = 0x2b,
- PIXMAN_OP_NONE
+ PIXMAN_OP_NONE,
+ PIXMAN_OP_LAST = PIXMAN_OP_NONE
} pixman_op_t;
/*
More information about the xorg-commit
mailing list