From 03fa1bcb9af2cf48148b03c9a02cf5b4a7340356 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Wed, 13 May 2009 09:50:55 -0400 Subject: [PATCH] Move mmx fast path code to pixman-mmx.c --- pixman/pixman-general.c | 18 ----------- pixman/pixman-mmx.c | 81 ++++++++++++++++++++++++++++++++----------------- 2 files changed, 54 insertions(+), 45 deletions(-) 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; } -- 2.7.4