[Pixman] [PATCH 2/7] Move blt delegation into pixman-implementation.c
Søren Sandmann
sandmann at cs.au.dk
Sat Sep 15 16:54:29 PDT 2012
From: Søren Sandmann Pedersen <ssp at redhat.com>
Rather than require each individual implementation to do the
delegation for blt, just do it in pixman-implementation.c whenever the
implementation blt returns FALSE.
With this change, there is no longer any reason for the
implementations to have one blt function that delegates and one that
actually blits, so consolidate those in the NEON, DSPr2, SSE2, and MMX
implementations.
---
pixman/pixman-arm-neon.c | 54 +++++++-----------------------
pixman/pixman-general.c | 21 ------------
pixman/pixman-implementation.c | 40 +++++++++--------------
pixman/pixman-mips-dspr2.c | 54 +++++++-----------------------
pixman/pixman-mmx.c | 68 +++++++++++---------------------------
pixman/pixman-sse2.c | 69 +++++++++++----------------------------
6 files changed, 81 insertions(+), 225 deletions(-)
diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c
index ca139de..f4cc0ba 100644
--- a/pixman/pixman-arm-neon.c
+++ b/pixman/pixman-arm-neon.c
@@ -227,18 +227,19 @@ pixman_fill_neon (uint32_t *bits,
}
static pixman_bool_t
-pixman_blt_neon (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 dest_x,
- int dest_y,
- int width,
- int height)
+arm_neon_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 dest_x,
+ int dest_y,
+ int width,
+ int height)
{
if (src_bpp != dst_bpp)
return FALSE;
@@ -423,35 +424,6 @@ static const pixman_fast_path_t arm_neon_fast_paths[] =
};
static pixman_bool_t
-arm_neon_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 dest_x,
- int dest_y,
- int width,
- int height)
-{
- if (!pixman_blt_neon (
- src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
- src_x, src_y, dest_x, dest_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, dest_x, dest_y, width, height);
- }
-
- return TRUE;
-}
-
-static pixman_bool_t
arm_neon_fill (pixman_implementation_t *imp,
uint32_t * bits,
int stride,
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index d4b2daa..dcf9bfc 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -201,26 +201,6 @@ static const pixman_fast_path_t general_fast_path[] =
};
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 dest_x,
- int dest_y,
- int width,
- int height)
-{
- /* We can't blit unless we have sse2 or mmx */
-
- return FALSE;
-}
-
-static pixman_bool_t
general_fill (pixman_implementation_t *imp,
uint32_t * bits,
int stride,
@@ -242,7 +222,6 @@ _pixman_implementation_create_general (void)
_pixman_setup_combiner_functions_32 (imp);
_pixman_setup_combiner_functions_64 (imp);
- imp->blt = general_blt;
imp->fill = general_fill;
imp->src_iter_init = general_src_iter_init;
imp->dest_iter_init = general_dest_iter_init;
diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c
index d2573ab..8b07848 100644
--- a/pixman/pixman-implementation.c
+++ b/pixman/pixman-implementation.c
@@ -28,27 +28,6 @@
#include "pixman-private.h"
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 dest_x,
- int dest_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, dest_x, dest_y,
- width, height);
-}
-
-static pixman_bool_t
delegate_fill (pixman_implementation_t *imp,
uint32_t * bits,
int stride,
@@ -97,7 +76,7 @@ _pixman_implementation_create (pixman_implementation_t *delegate,
/* Fill out function pointers with ones that just delegate
*/
- imp->blt = delegate_blt;
+ imp->blt = NULL;
imp->fill = delegate_fill;
imp->src_iter_init = delegate_src_iter_init;
imp->dest_iter_init = delegate_dest_iter_init;
@@ -168,9 +147,20 @@ _pixman_implementation_blt (pixman_implementation_t * imp,
int width,
int height)
{
- return (*imp->blt) (imp, src_bits, dst_bits, src_stride, dst_stride,
- src_bpp, dst_bpp, src_x, src_y, dest_x, dest_y,
- width, height);
+ while (imp)
+ {
+ if (imp->blt &&
+ (*imp->blt) (imp, src_bits, dst_bits, src_stride, dst_stride,
+ src_bpp, dst_bpp, src_x, src_y, dest_x, dest_y,
+ width, height))
+ {
+ return TRUE;
+ }
+
+ imp = imp->delegate;
+ }
+
+ return FALSE;
}
pixman_bool_t
diff --git a/pixman/pixman-mips-dspr2.c b/pixman/pixman-mips-dspr2.c
index 63a0225..7c4ac60 100644
--- a/pixman/pixman-mips-dspr2.c
+++ b/pixman/pixman-mips-dspr2.c
@@ -130,18 +130,19 @@ pixman_fill_mips (uint32_t *bits,
}
static pixman_bool_t
-pixman_blt_mips (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 dest_x,
- int dest_y,
- int width,
- int height)
+mips_dspr2_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 dest_x,
+ int dest_y,
+ int width,
+ int height)
{
if (src_bpp != dst_bpp)
return FALSE;
@@ -267,35 +268,6 @@ static const pixman_fast_path_t mips_dspr2_fast_paths[] =
};
static pixman_bool_t
-mips_dspr2_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 dest_x,
- int dest_y,
- int width,
- int height)
-{
- if (!pixman_blt_mips (
- src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
- src_x, src_y, dest_x, dest_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, dest_x, dest_y, width, height);
- }
-
- return TRUE;
-}
-
-static pixman_bool_t
mips_dspr2_fill (pixman_implementation_t *imp,
uint32_t * bits,
int stride,
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 74a5e87..0379462 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -3238,18 +3238,19 @@ mmx_composite_add_8888_8888 (pixman_implementation_t *imp,
}
static 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 dest_x,
- int dest_y,
- int width,
- int height)
+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 dest_x,
+ int dest_y,
+ int width,
+ int height)
{
uint8_t * src_bytes;
uint8_t * dst_bytes;
@@ -3394,13 +3395,13 @@ mmx_composite_copy_area (pixman_implementation_t *imp,
{
PIXMAN_COMPOSITE_ARGS (info);
- pixman_blt_mmx (src_image->bits.bits,
- dest_image->bits.bits,
- src_image->bits.rowstride,
- dest_image->bits.rowstride,
- PIXMAN_FORMAT_BPP (src_image->bits.format),
- PIXMAN_FORMAT_BPP (dest_image->bits.format),
- src_x, src_y, dest_x, dest_y, width, height);
+ mmx_blt (imp, src_image->bits.bits,
+ dest_image->bits.bits,
+ src_image->bits.rowstride,
+ dest_image->bits.rowstride,
+ PIXMAN_FORMAT_BPP (src_image->bits.format),
+ PIXMAN_FORMAT_BPP (dest_image->bits.format),
+ src_x, src_y, dest_x, dest_y, width, height);
}
static void
@@ -4042,35 +4043,6 @@ static const pixman_fast_path_t mmx_fast_paths[] =
};
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 dest_x,
- int dest_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, dest_x, dest_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, dest_x, dest_y, width, height);
- }
-
- return TRUE;
-}
-
-static pixman_bool_t
mmx_fill (pixman_implementation_t *imp,
uint32_t * bits,
int stride,
diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c
index 665eead..42c0e99 100644
--- a/pixman/pixman-sse2.c
+++ b/pixman/pixman-sse2.c
@@ -4523,18 +4523,19 @@ sse2_composite_add_8888_8888 (pixman_implementation_t *imp,
}
static pixman_bool_t
-pixman_blt_sse2 (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 dest_x,
- int dest_y,
- int width,
- int height)
+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 dest_x,
+ int dest_y,
+ int width,
+ int height)
{
uint8_t * src_bytes;
uint8_t * dst_bytes;
@@ -4640,7 +4641,6 @@ pixman_blt_sse2 (uint32_t *src_bits,
}
}
-
return TRUE;
}
@@ -4649,13 +4649,13 @@ sse2_composite_copy_area (pixman_implementation_t *imp,
pixman_composite_info_t *info)
{
PIXMAN_COMPOSITE_ARGS (info);
- pixman_blt_sse2 (src_image->bits.bits,
- dest_image->bits.bits,
- src_image->bits.rowstride,
- dest_image->bits.rowstride,
- PIXMAN_FORMAT_BPP (src_image->bits.format),
- PIXMAN_FORMAT_BPP (dest_image->bits.format),
- src_x, src_y, dest_x, dest_y, width, height);
+ sse2_blt (imp, src_image->bits.bits,
+ dest_image->bits.bits,
+ src_image->bits.rowstride,
+ dest_image->bits.rowstride,
+ PIXMAN_FORMAT_BPP (src_image->bits.format),
+ PIXMAN_FORMAT_BPP (dest_image->bits.format),
+ src_x, src_y, dest_x, dest_y, width, height);
}
static void
@@ -5878,35 +5878,6 @@ static const pixman_fast_path_t sse2_fast_paths[] =
{ PIXMAN_OP_NONE },
};
-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 dest_x,
- int dest_y,
- int width,
- int height)
-{
- if (!pixman_blt_sse2 (
- src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
- src_x, src_y, dest_x, dest_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, dest_x, dest_y, width, height);
- }
-
- return TRUE;
-}
-
#if defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
__attribute__((__force_align_arg_pointer__))
#endif
--
1.7.4
More information about the Pixman
mailing list