mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-27 05:50:10 +01:00
Port MMX code from xserver to pixman.
Add an fbpict.c ported from the latest in xserver/fb, including hooks to the MMX code where appropriate. This replaces the old ic.c file. Replaced by fbpict.c. Move some X server macros from fbpict.c up into icint.h to keep the diff small. Add fbmmx and fbpict.c, remove ic.c. Add a check for the MMX intrinsics. gcc >= 3.4 is required.
This commit is contained in:
parent
a2a89e858a
commit
9ae7d8a13b
7 changed files with 3290 additions and 221 deletions
|
|
@ -1,3 +1,56 @@
|
|||
2005-08-16 Billy Biggs <vektor@dumbterm.net>
|
||||
|
||||
* src/fbmmx.c: (shift), (negate), (pix_multiply), (pix_add),
|
||||
(expand_alpha), (expand_alpha_rev), (invert_colors), (over),
|
||||
(over_rev_non_pre), (in), (in_over), (load8888), (pack8888),
|
||||
(store8888), (expand565), (expand8888), (pack565), (pix_add_mul),
|
||||
(mmxCombineMaskU), (mmxCombineOverU), (mmxCombineOverReverseU),
|
||||
(mmxCombineInU), (mmxCombineInReverseU), (mmxCombineOutU),
|
||||
(mmxCombineOutReverseU), (mmxCombineAtopU),
|
||||
(mmxCombineAtopReverseU), (mmxCombineXorU), (mmxCombineAddU),
|
||||
(mmxCombineSaturateU), (mmxCombineSrcC), (mmxCombineOverC),
|
||||
(mmxCombineOverReverseC), (mmxCombineInC), (mmxCombineInReverseC),
|
||||
(mmxCombineOutC), (mmxCombineOutReverseC), (mmxCombineAtopC),
|
||||
(mmxCombineAtopReverseC), (mmxCombineXorC), (mmxCombineAddC),
|
||||
(fbComposeSetupMMX), (fbCompositeSolid_nx8888mmx),
|
||||
(fbCompositeSolid_nx0565mmx),
|
||||
(fbCompositeSolidMask_nx8888x8888Cmmx),
|
||||
(fbCompositeSrc_8888x8x8888mmx), (fbCompositeSrc_x888x8x8888mmx),
|
||||
(fbCompositeSolidMask_nx8x8888mmx),
|
||||
(fbCompositeSolidMaskSrc_nx8x8888mmx),
|
||||
(fbCompositeSolidMask_nx8x0565mmx),
|
||||
(fbCompositeSrc_8888RevNPx0565mmx),
|
||||
(fbCompositeSrc_8888RevNPx8888mmx),
|
||||
(fbCompositeSolidMask_nx8888x0565Cmmx),
|
||||
(fbCompositeSrcAdd_8000x8000mmx), (fbCompositeSrcAdd_8888x8888mmx),
|
||||
(fbSolidFillmmx), (fbCopyAreammx), (fbCompositeCopyAreammx),
|
||||
(detectCPUFeatures), (fbHaveMMX):
|
||||
* src/fbmmx.h: Port MMX code from xserver to pixman.
|
||||
|
||||
* src/fbpict.c: (fbOver), (fbOver24), (fbIn), (fbIn24),
|
||||
(fbCompositeSolidMask_nx8x8888),
|
||||
(fbCompositeSolidMask_nx8888x8888C),
|
||||
(fbCompositeSolidMask_nx8x0888), (fbCompositeSolidMask_nx8x0565),
|
||||
(fbCompositeSolidMask_nx8888x0565),
|
||||
(fbCompositeSolidMask_nx8888x0565C), (fbCompositeSrc_8888x8888),
|
||||
(fbCompositeSrc_8888x0888), (fbCompositeSrc_8888x0565),
|
||||
(fbCompositeSrcAdd_8000x8000), (fbCompositeSrcAdd_8888x8888),
|
||||
(fbCompositeSrcAdd_1000x1000), (fbCompositeSolidMask_nx1xn),
|
||||
(fbCompositeTrans_0565xnx0565), (fbCompositeTrans_0888xnx0888),
|
||||
(fbCompositeSrcSrc_nxn), (pixman_composite): Add an fbpict.c ported
|
||||
from the latest in xserver/fb, including hooks to the MMX code
|
||||
where appropriate. This replaces the old ic.c file.
|
||||
|
||||
* src/ic.c: Replaced by fbpict.c.
|
||||
|
||||
* src/icint.h: Move some X server macros from fbpict.c up into
|
||||
icint.h to keep the diff small.
|
||||
|
||||
* src/Makefile.am: Add fbmmx and fbpict.c, remove ic.c.
|
||||
|
||||
* configure.in: Add a check for the MMX intrinsics. gcc >= 3.4
|
||||
is required.
|
||||
|
||||
2005-08-12 Billy Biggs <vektor@dumbterm.net>
|
||||
|
||||
* src/icrect.c: (pixman_fill_rect_1bpp): Fix to be correct for
|
||||
|
|
|
|||
|
|
@ -50,6 +50,38 @@ fi
|
|||
|
||||
AC_SUBST(WARN_CFLAGS)
|
||||
|
||||
dnl ===========================================================================
|
||||
dnl Check for MMX
|
||||
|
||||
MMX_CFLAGS="-mmmx -msse -Winline --param inline-unit-growth=10000 --param large-function-growth=10000"
|
||||
|
||||
have_mmx_intrinsics=no
|
||||
AC_MSG_CHECKING(For MMX/SSE intrinsics in the compiler)
|
||||
xserver_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS $MMX_CFLAGS"
|
||||
AC_COMPILE_IFELSE([
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4))
|
||||
#error "Need GCC >= 3.4 for MMX intrinsics"
|
||||
#endif
|
||||
#include <mmintrin.h>
|
||||
#include <xmmintrin.h>
|
||||
int main () {
|
||||
__m64 v = _mm_cvtsi32_si64 (1);
|
||||
v = _mm_shuffle_pi16 (v, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
return _mm_cvtsi64_si32 (v);
|
||||
}], have_mmx_intrinsics=yes)
|
||||
CFLAGS=$xserver_save_CFLAGS
|
||||
AC_MSG_RESULT($have_mmx_intrinsics)
|
||||
|
||||
if test $have_mmx_intrinsics = yes ; then
|
||||
AC_DEFINE(USE_MMX, 1, [use MMX compiler intrinsics])
|
||||
else
|
||||
MMX_CFLAGS=
|
||||
fi
|
||||
AC_SUBST(MMX_CFLAGS)
|
||||
|
||||
AM_CONDITIONAL(USE_MMX, test $have_mmx_intrinsics = yes)
|
||||
|
||||
dnl ===========================================================================
|
||||
|
||||
AC_OUTPUT([
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ libpixman_la_SOURCES = \
|
|||
pixregion.c \
|
||||
pixregionint.h \
|
||||
fbpict.h \
|
||||
ic.c \
|
||||
fbpict.c \
|
||||
icblt.c \
|
||||
icbltone.c \
|
||||
iccolor.c \
|
||||
|
|
@ -31,4 +31,10 @@ libpixman_la_SOURCES = \
|
|||
renderedge.h \
|
||||
slim_internal.h
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(srcdir) $(WARN_CFLAGS)
|
||||
if USE_MMX
|
||||
libpixman_la_SOURCES += \
|
||||
fbmmx.c \
|
||||
fbmmx.h
|
||||
endif
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(srcdir) $(WARN_CFLAGS) @MMX_CFLAGS@
|
||||
|
|
|
|||
2503
pixman/src/fbmmx.c
Normal file
2503
pixman/src/fbmmx.c
Normal file
File diff suppressed because it is too large
Load diff
228
pixman/src/fbmmx.h
Normal file
228
pixman/src/fbmmx.h
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* 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@redhat.com)
|
||||
* Lars Knoll (lars@trolltech.com)
|
||||
*
|
||||
* Based on work by Owen Taylor
|
||||
*/
|
||||
#ifdef USE_MMX
|
||||
|
||||
#if !defined(__amd64__) && !defined(__x86_64__)
|
||||
Bool fbHaveMMX(void);
|
||||
#else
|
||||
#define fbHaveMMX() TRUE
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define fbHaveMMX() FALSE
|
||||
#endif
|
||||
|
||||
#ifdef USE_MMX
|
||||
|
||||
void fbComposeSetupMMX(void);
|
||||
|
||||
void fbCompositeSolidMask_nx8888x0565Cmmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrcAdd_8888x8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMask_nx8888x8888Cmmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMask_nx8x8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrcAdd_8000x8000mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888RevNPx8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888RevNPx0565mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolid_nx8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolid_nx0565mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMask_nx8x0565mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_x888x8x8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888x8x8888mmx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
Bool fbCopyAreammx (FbPixels *pSrc,
|
||||
FbPixels *pDst,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
void fbCompositeCopyAreammx (pixman_operator_t op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
Bool fbSolidFillmmx (FbPixels *pDraw,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
FbBits xor);
|
||||
|
||||
#endif /* USE_MMX */
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1071,4 +1071,34 @@ typedef xFixed_16_16 xFixed;
|
|||
|
||||
#endif /* _PICTURE_H_ */
|
||||
|
||||
|
||||
/* Macros needed by fbpict.c */
|
||||
|
||||
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
|
||||
(((s) >> 5) & 0x07e0) | \
|
||||
(((s) >> 8) & 0xf800))
|
||||
#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
|
||||
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
|
||||
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define Fetch24(a) ((unsigned long) (a) & 1 ? \
|
||||
((*(a) << 16) | *((CARD16 *) ((a)+1))) : \
|
||||
((*((CARD16 *) (a)) << 8) | *((a)+2)))
|
||||
#define Store24(a,v) ((unsigned long) (a) & 1 ? \
|
||||
((*(a) = (CARD8) ((v) >> 16)), \
|
||||
(*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \
|
||||
((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \
|
||||
(*((a)+2) = (CARD8) (v))))
|
||||
#else
|
||||
#define Fetch24(a) ((unsigned long) (a) & 1 ? \
|
||||
((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \
|
||||
((*((CARD16 *) (a))) | (*((a)+2) << 16)))
|
||||
#define Store24(a,v) ((unsigned long) (a) & 1 ? \
|
||||
((*(a) = (CARD8) (v)), \
|
||||
(*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \
|
||||
((*((CARD16 *) (a)) = (CARD16) (v)),\
|
||||
(*((a)+2) = (CARD8) ((v) >> 16))))
|
||||
#endif
|
||||
|
||||
#endif /* _ICINT_H_ */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue