*/
#include <config.h>
-#include "pixman-vmx.h"
+#include "pixman-private.h"
#include "pixman-combine32.h"
#include <altivec.h>
-typedef struct _FbComposeFunctions32 {
- CombineFunc32 combineU[PIXMAN_OP_LAST];
- CombineFunc32 combineC[PIXMAN_OP_LAST];
-} FbComposeFunctions32;
-
-static FbComposeFunctions32 pixman_composeFunctions;
+#define AVV(x...) {x}
static force_inline vector unsigned int
splat_alpha (vector unsigned int pix) {
}
static FASTCALL void
-vmxCombineOverU(uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+vmxCombineOverU(pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
int width)
{
if (mask)
}
static FASTCALL void
-vmxCombineOverReverseU (uint32_t *dest, const uint32_t *src,
+vmxCombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src,
const uint32_t *mask, int width)
{
if (mask)
}
static FASTCALL void
-vmxCombineInU (uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+vmxCombineInU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
int width)
{
if (mask)
}
static FASTCALL void
-vmxCombineInReverseU (uint32_t *dest, const uint32_t *src,
+vmxCombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src,
const uint32_t *mask, int width)
{
if (mask)
}
static FASTCALL void
-vmxCombineOutU (uint32_t *dest, const uint32_t *src, const uint32_t *mask,
+vmxCombineOutU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask,
int width)
{
if (mask)
}
static FASTCALL void
-vmxCombineOutReverseU (uint32_t *dest,
+vmxCombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest,
const uint32_t *src,
const uint32_t *mask,
int width)
}
static FASTCALL void
-vmxCombineAtopU (uint32_t *dest,
+vmxCombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest,
const uint32_t *src,
const uint32_t *mask,
int width)
}
static FASTCALL void
-vmxCombineAtopReverseU (uint32_t *dest,
+vmxCombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest,
const uint32_t *src,
const uint32_t *mask,
int width)
}
static FASTCALL void
-vmxCombineXorU (uint32_t *dest,
+vmxCombineXorU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest,
const uint32_t *src,
const uint32_t *mask,
int width)
}
static FASTCALL void
-vmxCombineAddU (uint32_t *dest,
+vmxCombineAddU (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest,
const uint32_t *src,
const uint32_t *mask,
int width)
}
static FASTCALL void
-vmxCombineSrcC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineOverC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineOverC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineOverReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineInC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineInC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineInReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineOutC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineOutC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineOutReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineAtopC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineAtopReverseC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineXorC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineXorC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
static FASTCALL void
-vmxCombineAddC (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
+vmxCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
+ uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width)
{
int i;
vector unsigned int vdest, vsrc, vmask;
}
}
-#endif
-
-void fbComposeSetupVMX (void)
-{
- /* check if we have VMX support and initialize accordingly */
- if (pixman_have_vmx ()) {
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = vmxCombineOverU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = vmxCombineOverReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN] = vmxCombineInU;
- pixman_composeFunctions.combineU[PIXMAN_OP_IN_REVERSE] = vmxCombineInReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT] = vmxCombineOutU;
- pixman_composeFunctions.combineU[PIXMAN_OP_OUT_REVERSE] = vmxCombineOutReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP] = vmxCombineAtopU;
- pixman_composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = vmxCombineAtopReverseU;
- pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = vmxCombineXorU;
-
- pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = vmxCombineAddU;
-
- pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = vmxCombineSrcC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = vmxCombineOverC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OVER_REVERSE] = vmxCombineOverReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN] = vmxCombineInC;
- pixman_composeFunctions.combineC[PIXMAN_OP_IN_REVERSE] = vmxCombineInReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT] = vmxCombineOutC;
- pixman_composeFunctions.combineC[PIXMAN_OP_OUT_REVERSE] = vmxCombineOutReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP] = vmxCombineAtopC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ATOP_REVERSE] = vmxCombineAtopReverseC;
- pixman_composeFunctions.combineC[PIXMAN_OP_XOR] = vmxCombineXorC;
- pixman_composeFunctions.combineC[PIXMAN_OP_ADD] = vmxCombineAddC;
- }
-}
-
static const FastPathInfo vmx_fast_path_array[] =
{
{ PIXMAN_OP_NONE },
};
const FastPathInfo *const vmx_fast_paths = vmx_fast_path_array;
+
+#endif
+
+pixman_implementation_t *
+_pixman_implementation_create_vmx (pixman_implementation_t *toplevel)
+{
+ pixman_implementation_t *fast = _pixman_implementation_create_fast_path (NULL);
+ pixman_implementation_t *imp = _pixman_implementation_create (toplevel, fast);
+
+ /* Set up function pointers */
+
+ /* SSE code patch for fbcompose.c */
+ imp->combine_32[PIXMAN_OP_OVER] = vmxCombineOverU;
+ imp->combine_32[PIXMAN_OP_OVER_REVERSE] = vmxCombineOverReverseU;
+ imp->combine_32[PIXMAN_OP_IN] = vmxCombineInU;
+ imp->combine_32[PIXMAN_OP_IN_REVERSE] = vmxCombineInReverseU;
+ imp->combine_32[PIXMAN_OP_OUT] = vmxCombineOutU;
+ imp->combine_32[PIXMAN_OP_OUT_REVERSE] = vmxCombineOutReverseU;
+ imp->combine_32[PIXMAN_OP_ATOP] = vmxCombineAtopU;
+ imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = vmxCombineAtopReverseU;
+ imp->combine_32[PIXMAN_OP_XOR] = vmxCombineXorU;
+
+ imp->combine_32[PIXMAN_OP_ADD] = vmxCombineAddU;
+
+ imp->combine_32_ca[PIXMAN_OP_SRC] = vmxCombineSrcC;
+ imp->combine_32_ca[PIXMAN_OP_OVER] = vmxCombineOverC;
+ imp->combine_32_ca[PIXMAN_OP_OVER_REVERSE] = vmxCombineOverReverseC;
+ imp->combine_32_ca[PIXMAN_OP_IN] = vmxCombineInC;
+ imp->combine_32_ca[PIXMAN_OP_IN_REVERSE] = vmxCombineInReverseC;
+ imp->combine_32_ca[PIXMAN_OP_OUT] = vmxCombineOutC;
+ imp->combine_32_ca[PIXMAN_OP_OUT_REVERSE] = vmxCombineOutReverseC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP] = vmxCombineAtopC;
+ imp->combine_32_ca[PIXMAN_OP_ATOP_REVERSE] = vmxCombineAtopReverseC;
+ imp->combine_32_ca[PIXMAN_OP_XOR] = vmxCombineXorC;
+ imp->combine_32_ca[PIXMAN_OP_ADD] = vmxCombineAddC;
+
+ return imp;
+}
+
+++ /dev/null
-/*
- * Copyright © 2007 Luca Barbato
- *
- * 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 Luca Barbato not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Luca Barbato 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: Luca Barbato (lu_zero@gentoo.org)
- *
- * Based on work by Owen Taylor, Søren Sandmann and Lars Knoll
- */
-
-#include "pixman-private.h"
-
-#ifdef USE_VMX
-
-pixman_bool_t pixman_have_vmx(void);
-
-#else
-#define pixman_have_vmx() FALSE
-#endif
-
-#ifdef USE_VMX
-
-extern const FastPathInfo *const vmx_fast_paths;
-
-#define AVV(x...) {x}
-
-void fbComposeSetupVMX (void);
-
-#if 0
-void fbCompositeIn_nx8x8vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolidMask_nx8888x0565Cvmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrcAdd_8888x8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolidMask_nx8888x8888Cvmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolidMask_nx8x8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolidMaskSrc_nx8x8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrcAdd_8888x8x8vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeIn_8x8vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrcAdd_8000x8000vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrc_8888RevNPx8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrc_8888x0565vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrc_8888RevNPx0565vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolid_nx8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolid_nx0565vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSolidMask_nx8x0565vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrc_x888x8x8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrc_8888x8x8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-void fbCompositeSrc_8888x8888vmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-pixman_bool_t fbCopyAreavmx (FbPixels *pSrc,
- FbPixels *pDst,
- int src_x,
- int src_y,
- int dst_x,
- int dst_y,
- int width,
- int height);
-
-void fbCompositeCopyAreavmx (pixman_operator_t op,
- pixman_image_t * pSrc,
- pixman_image_t * pMask,
- pixman_image_t * pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-pixman_bool_t fbSolidFillvmx (FbPixels *pDraw,
- int x,
- int y,
- int width,
- int height,
- FbBits xor);
-#endif
-#endif /* USE_VMX */