From 9955b1516902d7671d41777bf1989f23cb0a87ed Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 13 May 2009 10:56:15 -0400 Subject: [PATCH] Move sse2 and mmx blt implementations to their respective files --- pixman/pixman-implementation.c | 41 +++++++++++++++++++++++++++++++++++++++++ pixman/pixman-mmx.c | 36 +++++++++++++++++++++++++++++++----- pixman/pixman-mmx.h | 27 --------------------------- pixman/pixman-pict.c | 4 ++-- pixman/pixman-private.h | 29 +++++++++++++++++++++++++++++ pixman/pixman-sse2.c | 29 ++++++++++++++++++++++++++++- pixman/pixman-sse2.h | 11 ----------- pixman/pixman-utils.c | 33 --------------------------------- 8 files changed, 131 insertions(+), 79 deletions(-) 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, -- 2.7.4