Make the mmx code compile
authorSøren Sandmann <sandmann@redhat.com>
Tue, 22 May 2007 04:03:31 +0000 (00:03 -0400)
committerSøren Sandmann <sandmann@redhat.com>
Tue, 22 May 2007 04:03:31 +0000 (00:03 -0400)
pixman/Makefile.am
pixman/pixman-mmx.c
pixman/pixman-mmx.h
pixman/pixman-pict.c
pixman/pixman-private.h

index 84bd7e1..1a336c1 100644 (file)
@@ -1,5 +1,6 @@
 lib_LTLIBRARIES = libpixman.la
 
+libpixman_la_CFLAGS = -DUSE_MMX # FIXME - detect it properly
 libpixman_la_LIBADD = @DEP_LIBS@ -lm
 
 libpixman_la_SOURCES =    \
@@ -16,7 +17,7 @@ noinst_LTLIBRARIES = libpixman-mmx.la
 libpixman_mmx_la_SOURCES = \
        pixman-mmx.c \
        pixman-mmx.h
-libpixman_mmx_la_CFLAGS = $(DEP_CFLAGS) -mmmx
+libpixman_mmx_la_CFLAGS = $(DEP_CFLAGS) -mmmx -DUSE_MMX
 libpixman_mmx_la_LIBADD = $(DEP_LIBS)
 libpixman_la_LIBADD += libpixman-mmx.la
 
index 7dc2db6..0335a09 100644 (file)
@@ -28,8 +28,6 @@
  *
  * Based on work by Owen Taylor
  */
-#define USE_MMX /* FIXME: do this in the build system */
-
 #ifdef HAVE_DIX_CONFIG_H
 #include <dix-config.h>
 #endif
@@ -877,37 +875,37 @@ mmxCombineAddC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width)
 }
 
 /* FIXME: this should be reinstated after adding fbmmx to pixman */
-extern FbComposeFunctions composeFunctions;
+extern FbComposeFunctions pixman_composeFunctions;
 
 void fbComposeSetupMMX(void)
 {
     /* check if we have MMX support and initialize accordingly */
     if (fbHaveMMX()) {
-        composeFunctions.combineU[PIXMAN_OP_OVER] = mmxCombineOverU;
-        composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU;
-        composeFunctions.combineU[PIXMAN_OP_IN] = mmxCombineInU;
-        composeFunctions.combineU[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseU;
-        composeFunctions.combineU[PIXMAN_OP_OUT] = mmxCombineOutU;
-        composeFunctions.combineU[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseU;
-        composeFunctions.combineU[PIXMAN_OP_ATOP] = mmxCombineAtopU;
-        composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseU;
-        composeFunctions.combineU[PIXMAN_OP_XOR] = mmxCombineXorU;
-        composeFunctions.combineU[PIXMAN_OP_ADD] = mmxCombineAddU;
-        composeFunctions.combineU[PIXMAN_OP_SATURATE] = mmxCombineSaturateU;
-
-        composeFunctions.combineC[PIXMAN_OP_SRC] = mmxCombineSrcC;
-        composeFunctions.combineC[PIXMAN_OP_OVER] = mmxCombineOverC;
-        composeFunctions.combineC[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseC;
-        composeFunctions.combineC[PIXMAN_OP_IN] = mmxCombineInC;
-        composeFunctions.combineC[PIXMAN_OP_IN_REVERSE] = mmxCombineInReverseC;
-        composeFunctions.combineC[PIXMAN_OP_OUT] = mmxCombineOutC;
-        composeFunctions.combineC[PIXMAN_OP_OUT_REVERSE] = mmxCombineOutReverseC;
-        composeFunctions.combineC[PIXMAN_OP_ATOP] = mmxCombineAtopC;
-        composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = mmxCombineAtopReverseC;
-        composeFunctions.combineC[PIXMAN_OP_XOR] = mmxCombineXorC;
-        composeFunctions.combineC[PIXMAN_OP_ADD] = mmxCombineAddC;
-
-        composeFunctions.combineMaskU = mmxCombineMaskU;
+        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;
+
+        pixman_composeFunctions.combineMaskU = mmxCombineMaskU;
     } 
 }
 
@@ -915,7 +913,7 @@ void fbComposeSetupMMX(void)
 /* ------------------ MMX code paths called from fbpict.c ----------------------- */
 
 void
-fbCompositeSolid_nx8888mmx (uint8_t    op,
+fbCompositeSolid_nx8888mmx (pixman_op_t op,
                            pixman_image_t * pSrc,
                            pixman_image_t * pMask,
                            pixman_image_t * pDst,
@@ -993,7 +991,7 @@ fbCompositeSolid_nx8888mmx (uint8_t op,
 }
 
 void
-fbCompositeSolid_nx0565mmx (uint8_t    op,
+fbCompositeSolid_nx0565mmx (pixman_op_t op,
                            pixman_image_t * pSrc,
                            pixman_image_t * pMask,
                            pixman_image_t * pDst,
@@ -1078,7 +1076,7 @@ fbCompositeSolid_nx0565mmx (uint8_t       op,
 }
 
 void
-fbCompositeSolidMask_nx8888x8888Cmmx (uint8_t  op,
+fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op,
                                      pixman_image_t * pSrc,
                                      pixman_image_t * pMask,
                                      pixman_image_t * pDst,
@@ -1181,7 +1179,7 @@ fbCompositeSolidMask_nx8888x8888Cmmx (uint8_t     op,
 }
 
 void
-fbCompositeSrc_8888x8x8888mmx (uint8_t op,
+fbCompositeSrc_8888x8x8888mmx (pixman_op_t op,
                               pixman_image_t * pSrc,
                               pixman_image_t * pMask,
                               pixman_image_t * pDst,
@@ -1265,7 +1263,7 @@ fbCompositeSrc_8888x8x8888mmx (uint8_t    op,
 }
 
 void
-fbCompositeSrc_x888x8x8888mmx (uint8_t op,
+fbCompositeSrc_x888x8x8888mmx (pixman_op_t op,
                               pixman_image_t * pSrc,
                               pixman_image_t * pMask,
                               pixman_image_t * pDst,
@@ -1350,7 +1348,7 @@ fbCompositeSrc_x888x8x8888mmx (uint8_t    op,
 }
 
 void
-fbCompositeSrc_8888x8888mmx (uint8_t   op,
+fbCompositeSrc_8888x8888mmx (pixman_op_t op,
                             pixman_image_t * pSrc,
                             pixman_image_t * pMask,
                             pixman_image_t * pDst,
@@ -1429,7 +1427,7 @@ fbCompositeSrc_8888x8888mmx (uint8_t      op,
 }
 
 void
-fbCompositeSrc_8888x0565mmx (uint8_t      op,
+fbCompositeSrc_8888x0565mmx (pixman_op_t op,
                             pixman_image_t * pSrc,
                             pixman_image_t * pMask,
                             pixman_image_t * pDst,
@@ -1530,7 +1528,7 @@ fbCompositeSrc_8888x0565mmx (uint8_t      op,
 }
 
 void
-fbCompositeSolidMask_nx8x8888mmx (uint8_t      op,
+fbCompositeSolidMask_nx8x8888mmx (pixman_op_t op,
                                  pixman_image_t * pSrc,
                                  pixman_image_t * pMask,
                                  pixman_image_t * pDst,
@@ -1784,7 +1782,7 @@ fbSolidFillmmx (DrawablePtr       pDraw,
 #endif
 
 void
-fbCompositeSolidMaskSrc_nx8x8888mmx (uint8_t      op,
+fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op,
                                     pixman_image_t * pSrc,
                                     pixman_image_t * pMask,
                                     pixman_image_t * pDst,
@@ -1917,7 +1915,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (uint8_t      op,
 }
 
 void
-fbCompositeSolidMask_nx8x0565mmx (uint8_t      op,
+fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op,
                                  pixman_image_t * pSrc,
                                  pixman_image_t * pMask,
                                  pixman_image_t * pDst,
@@ -2046,7 +2044,7 @@ fbCompositeSolidMask_nx8x0565mmx (uint8_t      op,
 }
 
 void
-fbCompositeSrc_8888RevNPx0565mmx (uint8_t      op,
+fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op,
                                  pixman_image_t * pSrc,
                                  pixman_image_t * pMask,
                                  pixman_image_t * pDst,
@@ -2167,7 +2165,7 @@ fbCompositeSrc_8888RevNPx0565mmx (uint8_t      op,
 /* "8888RevNP" is GdkPixbuf's format: ABGR, non premultiplied */
 
 void
-fbCompositeSrc_8888RevNPx8888mmx (uint8_t      op,
+fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op,
                                  pixman_image_t * pSrc,
                                  pixman_image_t * pMask,
                                  pixman_image_t * pDst,
@@ -2266,7 +2264,7 @@ fbCompositeSrc_8888RevNPx8888mmx (uint8_t      op,
 }
 
 void
-fbCompositeSolidMask_nx8888x0565Cmmx (uint8_t      op,
+fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t op,
                                      pixman_image_t * pSrc,
                                      pixman_image_t * pMask,
                                      pixman_image_t * pDst,
@@ -2373,7 +2371,7 @@ fbCompositeSolidMask_nx8888x0565Cmmx (uint8_t      op,
 }
 
 void
-fbCompositeIn_nx8x8mmx (uint8_t        op,
+fbCompositeIn_nx8x8mmx (pixman_op_t op,
                        pixman_image_t * pSrc,
                        pixman_image_t * pMask,
                        pixman_image_t * pDst,
@@ -2457,7 +2455,7 @@ fbCompositeIn_nx8x8mmx (uint8_t   op,
 }
 
 void
-fbCompositeIn_8x8mmx (uint8_t  op,
+fbCompositeIn_8x8mmx (pixman_op_t op,
                      pixman_image_t * pSrc,
                      pixman_image_t * pMask,
                      pixman_image_t * pDst,
@@ -2521,7 +2519,7 @@ fbCompositeIn_8x8mmx (uint8_t     op,
 }
 
 void
-fbCompositeSrcAdd_8888x8x8mmx (uint8_t   op,
+fbCompositeSrcAdd_8888x8x8mmx (pixman_op_t op,
                               pixman_image_t * pSrc,
                               pixman_image_t * pMask,
                               pixman_image_t * pDst,
@@ -2599,7 +2597,7 @@ fbCompositeSrcAdd_8888x8x8mmx (uint8_t   op,
 }
 
 void
-fbCompositeSrcAdd_8000x8000mmx (uint8_t        op,
+fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op,
                                pixman_image_t * pSrc,
                                pixman_image_t * pMask,
                                pixman_image_t * pDst,
@@ -2671,7 +2669,7 @@ fbCompositeSrcAdd_8000x8000mmx (uint8_t   op,
 }
 
 void
-fbCompositeSrcAdd_8888x8888mmx (uint8_t                op,
+fbCompositeSrcAdd_8888x8888mmx (pixman_op_t    op,
                                pixman_image_t *        pSrc,
                                pixman_image_t *        pMask,
                                pixman_image_t *         pDst,
index 766f7cd..9314329 100644 (file)
@@ -48,7 +48,7 @@ pixman_bool_t fbHaveMMX(void);
 
 void fbComposeSetupMMX(void);
 
-void fbCompositeSolidMask_nx8888x0565Cmmx (uint8_t      op,
+void fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t      op,
                                           pixman_image_t * pSrc,
                                           pixman_image_t * pMask,
                                           pixman_image_t * pDst,
@@ -60,7 +60,7 @@ void fbCompositeSolidMask_nx8888x0565Cmmx (uint8_t      op,
                                           int16_t      yDst,
                                           uint16_t     width,
                                           uint16_t     height);
-void fbCompositeSrcAdd_8888x8888mmx (uint8_t   op,
+void fbCompositeSrcAdd_8888x8888mmx (pixman_op_t       op,
                                     pixman_image_t *   pSrc,
                                     pixman_image_t *   pMask,
                                     pixman_image_t *   pDst,
@@ -72,7 +72,7 @@ void fbCompositeSrcAdd_8888x8888mmx (uint8_t  op,
                                     int16_t      yDst,
                                     uint16_t     width,
                                     uint16_t     height);
-void fbCompositeSrc_8888x8888mmx (uint8_t              op,
+void fbCompositeSrc_8888x8888mmx (pixman_op_t          op,
                                  pixman_image_t *      pSrc,
                                  pixman_image_t *      pMask,
                                  pixman_image_t *      pDst,
@@ -85,7 +85,7 @@ void fbCompositeSrc_8888x8888mmx (uint8_t             op,
                                  uint16_t      width,
                                  uint16_t      height);
 void
-fbCompositeSolidMaskSrc_nx8x8888mmx (uint8_t      op,
+fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t      op,
                                     pixman_image_t * pSrc,
                                     pixman_image_t * pMask,
                                     pixman_image_t * pDst,
@@ -98,7 +98,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (uint8_t      op,
                                     uint16_t     width,
                                     uint16_t     height);
 void
-fbCompositeSrc_x888x8x8888mmx (uint8_t op,
+fbCompositeSrc_x888x8x8888mmx (pixman_op_t     op,
                               pixman_image_t * pSrc,
                               pixman_image_t * pMask,
                               pixman_image_t * pDst,
@@ -110,7 +110,7 @@ fbCompositeSrc_x888x8x8888mmx (uint8_t      op,
                               int16_t      yDst,
                               uint16_t     width,
                               uint16_t     height);
-void fbCompositeSolidMask_nx8888x8888Cmmx (uint8_t     op,
+void fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op,
                                           pixman_image_t *     pSrc,
                                           pixman_image_t *     pMask,
                                           pixman_image_t *     pDst,
@@ -122,7 +122,7 @@ void fbCompositeSolidMask_nx8888x8888Cmmx (uint8_t  op,
                                           int16_t      yDst,
                                           uint16_t     width,
                                           uint16_t     height);
-void fbCompositeSolidMask_nx8x8888mmx (uint8_t      op,
+void fbCompositeSolidMask_nx8x8888mmx (pixman_op_t      op,
                                       pixman_image_t * pSrc,
                                       pixman_image_t * pMask,
                                       pixman_image_t * pDst,
@@ -134,7 +134,7 @@ void fbCompositeSolidMask_nx8x8888mmx (uint8_t      op,
                                       int16_t      yDst,
                                       uint16_t     width,
                                       uint16_t     height);
-void fbCompositeIn_nx8x8mmx (uint8_t   op,
+void fbCompositeIn_nx8x8mmx (pixman_op_t       op,
                        pixman_image_t * pSrc,
                        pixman_image_t * pMask,
                        pixman_image_t * pDst,
@@ -146,7 +146,7 @@ void fbCompositeIn_nx8x8mmx (uint8_t        op,
                        int16_t      yDst,
                        uint16_t     width,
                        uint16_t     height);
-void fbCompositeIn_8x8mmx (uint8_t     op,
+void fbCompositeIn_8x8mmx (pixman_op_t op,
                      pixman_image_t * pSrc,
                      pixman_image_t * pMask,
                      pixman_image_t * pDst,
@@ -158,7 +158,7 @@ void fbCompositeIn_8x8mmx (uint8_t  op,
                      int16_t      yDst,
                      uint16_t     width,
                      uint16_t     height);
-void fbCompositeSrcAdd_8888x8x8mmx (uint8_t   op,
+void fbCompositeSrcAdd_8888x8x8mmx (pixman_op_t   op,
                               pixman_image_t * pSrc,
                               pixman_image_t * pMask,
                               pixman_image_t * pDst,
@@ -170,7 +170,7 @@ void fbCompositeSrcAdd_8888x8x8mmx (uint8_t   op,
                               int16_t      yDst,
                               uint16_t     width,
                               uint16_t     height);
-void fbCompositeSrcAdd_8000x8000mmx (uint8_t   op,
+void fbCompositeSrcAdd_8000x8000mmx (pixman_op_t       op,
                                     pixman_image_t * pSrc,
                                     pixman_image_t * pMask,
                                     pixman_image_t * pDst,
@@ -182,7 +182,7 @@ void fbCompositeSrcAdd_8000x8000mmx (uint8_t        op,
                                     int16_t      yDst,
                                     uint16_t     width,
                                     uint16_t     height);
-void fbCompositeSrc_8888RevNPx8888mmx (uint8_t      op,
+void fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t      op,
                                       pixman_image_t * pSrc,
                                       pixman_image_t * pMask,
                                       pixman_image_t * pDst,
@@ -194,7 +194,7 @@ void fbCompositeSrc_8888RevNPx8888mmx (uint8_t      op,
                                       int16_t      yDst,
                                       uint16_t     width,
                                       uint16_t     height);
-void fbCompositeSrc_8888x0565mmx (uint8_t      op,
+void fbCompositeSrc_8888x0565mmx (pixman_op_t      op,
                                  pixman_image_t * pSrc,
                                  pixman_image_t * pMask,
                                  pixman_image_t * pDst,
@@ -206,7 +206,7 @@ void fbCompositeSrc_8888x0565mmx (uint8_t      op,
                                  int16_t      yDst,
                                  uint16_t     width,
                                  uint16_t     height);
-void fbCompositeSrc_8888RevNPx0565mmx (uint8_t      op,
+void fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t      op,
                                       pixman_image_t * pSrc,
                                       pixman_image_t * pMask,
                                       pixman_image_t * pDst,
@@ -218,7 +218,7 @@ void fbCompositeSrc_8888RevNPx0565mmx (uint8_t      op,
                                       int16_t      yDst,
                                       uint16_t     width,
                                       uint16_t     height);
-void fbCompositeSolid_nx8888mmx (uint8_t               op,
+void fbCompositeSolid_nx8888mmx (pixman_op_t           op,
                                 pixman_image_t *       pSrc,
                                 pixman_image_t *       pMask,
                                 pixman_image_t *       pDst,
@@ -230,7 +230,7 @@ void fbCompositeSolid_nx8888mmx (uint8_t            op,
                                 int16_t                yDst,
                                 uint16_t               width,
                                 uint16_t               height);
-void fbCompositeSolid_nx0565mmx (uint8_t               op,
+void fbCompositeSolid_nx0565mmx (pixman_op_t           op,
                                 pixman_image_t *       pSrc,
                                 pixman_image_t *       pMask,
                                 pixman_image_t *       pDst,
@@ -242,7 +242,7 @@ void fbCompositeSolid_nx0565mmx (uint8_t            op,
                                 int16_t                yDst,
                                 uint16_t               width,
                                 uint16_t               height);
-void fbCompositeSolidMask_nx8x0565mmx (uint8_t      op,
+void fbCompositeSolidMask_nx8x0565mmx (pixman_op_t      op,
                                       pixman_image_t * pSrc,
                                       pixman_image_t * pMask,
                                       pixman_image_t * pDst,
@@ -254,7 +254,7 @@ void fbCompositeSolidMask_nx8x0565mmx (uint8_t      op,
                                       int16_t      yDst,
                                       uint16_t     width,
                                       uint16_t     height);
-void fbCompositeSrc_8888x8x8888mmx (uint8_t    op,
+void fbCompositeSrc_8888x8x8888mmx (pixman_op_t        op,
                                    pixman_image_t *  pSrc,
                                    pixman_image_t *  pMask,
                                    pixman_image_t *  pDst,
@@ -277,7 +277,7 @@ pixman_bool_t fbCopyAreammx (DrawablePtr    pSrc,
                             int                width,
                             int                height);
 #endif
-void fbCompositeCopyAreammx (uint8_t   op,
+void fbCompositeCopyAreammx (pixman_op_t       op,
                             pixman_image_t *   pSrc,
                             pixman_image_t *   pMask,
                             pixman_image_t *   pDst,
index 0e24390..ec6ee53 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdlib.h>
 #include "pixman.h"
 #include "pixman-private.h"
+#include "pixman-mmx.h"
 
 #define FbFullMask(n)   ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1))
 
@@ -1540,7 +1541,12 @@ pixman_image_composite (pixman_op_t      op,
 #ifdef USE_MMX
                    if (fbHaveMMX() &&
                        (pSrc->bits.format == PIXMAN_x8r8g8b8 || pSrc->bits.format == PIXMAN_x8b8g8r8))
-                       func = fbCompositeCopyAreammx;
+#if 0
+                       /* FIXME */
+                       
+                       func = fbCompositeCopyAreammx
+#endif
+                           ;
                    else
 #endif
 #if 0
@@ -1582,7 +1588,11 @@ pixman_image_composite (pixman_op_t      op,
                    case PIXMAN_x8r8g8b8:
 #ifdef USE_MMX
                        if (fbHaveMMX())
-                           func = fbCompositeCopyAreammx;
+#if 0
+                           /* FIXME */
+                           func = fbCompositeCopyAreammx
+#endif
+                               ;
 #endif
                        break;
                    default:
@@ -1594,7 +1604,11 @@ pixman_image_composite (pixman_op_t      op,
                    case PIXMAN_x8b8g8r8:
 #ifdef USE_MMX
                        if (fbHaveMMX())
-                           func = fbCompositeCopyAreammx;
+#if 0
+                           /* FIXME */
+                           func = fbCompositeCopyAreammx
+#endif
+                               ;
 #endif
                        break;
                    default:
@@ -1745,10 +1759,14 @@ pixman_image_composite (pixman_op_t      op,
            if (pSrc->bits.format == pDst->bits.format)
            {
 #ifdef USE_MMX
-               if (pSrc->pDrawable != pDst->pDrawable && fbHaveMMX() &&
+               if (pSrc->bits.bits != pDst->bits.bits && fbHaveMMX() &&
                    (PIXMAN_FORMAT_BPP (pSrc->bits.format) == 16 ||
                     PIXMAN_FORMAT_BPP (pSrc->bits.format) == 32))
-                   func = fbCompositeCopyAreammx;
+#if 0
+                   /* FIXME */
+                   func = fbCompositeCopyAreammx
+#endif
+                       ;
                else
 #endif
                    /* FIXME */
@@ -1768,7 +1786,7 @@ pixman_image_composite (pixman_op_t      op,
            if (fbHaveMMX())
                func = fbCompositeIn_8x8mmx;
        }
-       else if (srcRepeat && pMask && !pMask->componentAlpha &&
+       else if (srcRepeat && pMask && !pMask->common.component_alpha &&
                 (pSrc->bits.format == PIXMAN_a8r8g8b8 ||
                  pSrc->bits.format == PIXMAN_a8b8g8r8)   &&
                 (pMask->bits.format == PIXMAN_a8)        &&
@@ -1802,3 +1820,204 @@ pixman_image_composite (pixman_op_t      op,
                                  xMask, yMask, xDst, yDst, width, height,
                                  srcRepeat, maskRepeat, func, region);
 }
+
+
+#ifdef USE_MMX
+/* The CPU detection code needs to be in a file not compiled with
+ * "-mmmx -msse", as gcc would generate CMOV instructions otherwise
+ * that would lead to SIGILL instructions on old CPUs that don't have
+ * it.
+ */
+#if !defined(__amd64__) && !defined(__x86_64__)
+
+#ifdef HAVE_GETISAX
+#include <sys/auxv.h>
+#endif
+
+enum CPUFeatures {
+    NoFeatures = 0,
+    MMX = 0x1,
+    MMX_Extensions = 0x2, 
+    SSE = 0x6,
+    SSE2 = 0x8,
+    CMOV = 0x10
+};
+
+static unsigned int detectCPUFeatures(void) {
+    unsigned int features = 0;
+    unsigned int result = 0;
+
+#ifdef HAVE_GETISAX
+    if (getisax(&result, 1)) {
+        if (result & AV_386_CMOV)
+            features |= CMOV;
+        if (result & AV_386_MMX)
+            features |= MMX;
+        if (result & AV_386_AMD_MMX)
+            features |= MMX_Extensions;
+        if (result & AV_386_SSE)
+            features |= SSE;
+        if (result & AV_386_SSE2)
+            features |= SSE2;
+    }
+#else
+    char vendor[13];
+#ifdef _MSC_VER
+    int vendor0 = 0, vendor1, vendor2;
+#endif
+    vendor[0] = 0;
+    vendor[12] = 0;
+
+#ifdef __GNUC__
+    /* see p. 118 of amd64 instruction set manual Vol3 */
+    /* We need to be careful about the handling of %ebx and
+     * %esp here. We can't declare either one as clobbered
+     * since they are special registers (%ebx is the "PIC
+     * register" holding an offset to global data, %esp the
+     * stack pointer), so we need to make sure they have their
+     * original values when we access the output operands.
+     */
+    __asm__ ("pushf\n"
+             "pop %%eax\n"
+             "mov %%eax, %%ecx\n"
+             "xor $0x00200000, %%eax\n"
+             "push %%eax\n"
+             "popf\n"
+             "pushf\n"
+             "pop %%eax\n"
+             "mov $0x0, %%edx\n"
+             "xor %%ecx, %%eax\n"
+             "jz 1f\n"
+
+             "mov $0x00000000, %%eax\n"
+            "push %%ebx\n"
+             "cpuid\n"
+             "mov %%ebx, %%eax\n"
+            "pop %%ebx\n"
+            "mov %%eax, %1\n"
+             "mov %%edx, %2\n"
+             "mov %%ecx, %3\n"
+             "mov $0x00000001, %%eax\n"
+            "push %%ebx\n"
+             "cpuid\n"
+            "pop %%ebx\n"
+             "1:\n"
+             "mov %%edx, %0\n"
+             : "=r" (result), 
+               "=m" (vendor[0]), 
+               "=m" (vendor[4]), 
+               "=m" (vendor[8])
+             :
+             : "%eax", "%ecx", "%edx"
+        );
+
+#elif defined (_MSC_VER)
+
+    _asm {
+      pushfd
+      pop eax
+      mov ecx, eax
+      xor eax, 00200000h
+      push eax
+      popfd
+      pushfd
+      pop eax
+      mov edx, 0
+      xor eax, ecx
+      jz nocpuid
+
+      mov eax, 0
+      push ebx
+      cpuid
+      mov eax, ebx
+      pop ebx
+      mov vendor0, eax
+      mov vendor1, edx
+      mov vendor2, ecx
+      mov eax, 1
+      push ebx
+      cpuid
+      pop ebx
+    nocpuid:
+      mov result, edx
+    }
+    memmove (vendor+0, &vendor0, 4);
+    memmove (vendor+4, &vendor1, 4);
+    memmove (vendor+8, &vendor2, 4);
+
+#else
+#   error unsupported compiler
+#endif
+    
+    features = 0;
+    if (result) {
+        /* result now contains the standard feature bits */
+        if (result & (1 << 15))
+            features |= CMOV;
+        if (result & (1 << 23))
+            features |= MMX;
+        if (result & (1 << 25))
+            features |= SSE;
+        if (result & (1 << 26))
+            features |= SSE2;
+        if ((features & MMX) && !(features & SSE) &&
+            (strcmp(vendor, "AuthenticAMD") == 0 ||
+             strcmp(vendor, "Geode by NSC") == 0)) {
+            /* check for AMD MMX extensions */
+#ifdef __GNUC__
+            __asm__("push %%ebx\n"
+                    "mov $0x80000000, %%eax\n"
+                    "cpuid\n"
+                    "xor %%edx, %%edx\n"
+                    "cmp $0x1, %%eax\n"
+                    "jge 2f\n"
+                    "mov $0x80000001, %%eax\n"
+                    "cpuid\n"
+                    "2:\n"
+                    "pop %%ebx\n"
+                    "mov %%edx, %0\n"
+                    : "=r" (result)
+                    :
+                    : "%eax", "%ecx", "%edx"
+                );
+#elif defined _MSC_VER
+            _asm {
+              push ebx
+              mov eax, 80000000h
+              cpuid
+              xor edx, edx
+              cmp eax, 1
+              jge notamd
+              mov eax, 80000001h
+              cpuid
+            notamd:
+              pop ebx
+              mov result, edx
+            }
+#endif
+            if (result & (1<<22))
+                features |= MMX_Extensions;
+        }
+    }
+#endif /* HAVE_GETISAX */
+
+    return features;
+}
+
+pixman_bool_t
+fbHaveMMX (void)
+{
+    static pixman_bool_t initialized = FALSE;
+    static pixman_bool_t mmx_present;
+
+    if (!initialized)
+    {
+        unsigned int features = detectCPUFeatures();
+       mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
+        initialized = TRUE;
+    }
+    
+    return mmx_present;
+}
+#endif /* __amd64__ */
+#endif 
index 17c9629..f34506a 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef PIXMAN_PRIVATE_H
+#define PIXMAN_PRIVATE_H
+
 #include "pixman.h"
 
 #ifndef FALSE
@@ -632,3 +635,5 @@ void pixmanCompositeRect (const FbComposeData *data,
        (line) = ((type *) __bits__) +                                  \
            (out_stride) * (y) + (mul) * (x);                           \
     } while (0)
+
+#endif /* PIXMAN_PRIVATE_H */