pixman: Branch 'master' - 3 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Fri Mar 14 16:30:15 PDT 2008
configure.ac | 29 ++++++++++++++++++++++
pixman/Makefile.am | 13 ++++++++++
pixman/pixman-mmx.c | 12 ++++++---
pixman/pixman-pict.c | 66 ++++++++++++++++++++++++++++++++++++++-------------
pixman/pixman-sse.c | 51 +++++++++++++++++++++++++++++++++++++++
pixman/pixman-sse.h | 38 +++++++++++++++++++++++++++++
6 files changed, 190 insertions(+), 19 deletions(-)
New commits:
commit 6449782f8a4bea0274a30f86d56214c2c73c0303
Author: Søren Sandmann <sandmann at redhat.com>
Date: Fri Mar 14 19:24:28 2008 -0400
Fix typo; include pixman-sse.h
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index 614725a..9b1c2b4 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -951,7 +951,7 @@ fbComposeSetupMMX(void)
pixman_composeFunctions.combineMaskU = mmxCombineMaskU;
}
- iniitialized = TRUE;
+ initialized = TRUE;
}
@@ -2964,8 +2964,6 @@ fbCompositeOver_x888x8x8888mmx (pixman_op_t op,
uint32_t *dst, *dstLine;
uint8_t *mask, *maskLine;
int srcStride, maskStride, dstStride;
- __m64 m;
- uint32_t s, d;
uint16_t w;
fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
diff --git a/pixman/pixman-sse.c b/pixman/pixman-sse.c
index cd7532d..eb1d3d5 100644
--- a/pixman/pixman-sse.c
+++ b/pixman/pixman-sse.c
@@ -27,6 +27,8 @@
#include <config.h>
#endif
+#include "pixman-sse.h"
+
#ifdef USE_SSE2
void
commit 917e73385f8769f84da453df99d4e8e0dccc5b23
Author: Søren Sandmann <sandmann at redhat.com>
Date: Fri Mar 14 19:20:34 2008 -0400
Require MMX and MMX_Extensions for SSE. Various code style fixes.
diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
index b0e58bb..614725a 100644
--- a/pixman/pixman-mmx.c
+++ b/pixman/pixman-mmx.c
@@ -913,8 +913,14 @@ mmxCombineAddC (uint32_t *dest, uint32_t *src, uint32_t *mask, int width)
_mm_empty();
}
-void fbComposeSetupMMX(void)
+void
+fbComposeSetupMMX(void)
{
+ static pixman_bool_t initialized = FALSE;
+
+ if (initialized)
+ return;
+
/* check if we have MMX support and initialize accordingly */
if (pixman_have_mmx())
{
@@ -944,6 +950,8 @@ void fbComposeSetupMMX(void)
pixman_composeFunctions.combineMaskU = mmxCombineMaskU;
}
+
+ iniitialized = TRUE;
}
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index d499fbd..e4430d1 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -1484,6 +1484,13 @@ static const FastPathInfo mmx_fast_paths[] =
};
#endif
+#ifdef USE_SSE2
+static const FastPathInfo sse_fast_paths[] =
+{
+ { PIXMAN_OP_NONE },
+};
+#endif
+
static const FastPathInfo c_fast_paths[] =
{
{ PIXMAN_OP_OVER, PIXMAN_solid, PIXMAN_a8, PIXMAN_r5g6b5, fbCompositeSolidMask_nx8x0565, 0 },
@@ -1556,14 +1563,6 @@ static const FastPathInfo c_fast_paths[] =
{ PIXMAN_OP_NONE },
};
-#ifdef USE_SSE2
-static const FastPathInfo sse_fast_paths[] =
-{
- { PIXMAN_OP_NONE },
-};
-#endif
-
-
static pixman_bool_t
mask_is_solid (pixman_image_t *mask)
{
@@ -1655,37 +1654,29 @@ pixman_image_composite (pixman_op_t op,
uint16_t width,
uint16_t height)
{
- pixman_bool_t srcRepeat = pSrc->type == BITS && pSrc->common.repeat == PIXMAN_REPEAT_NORMAL;
- pixman_bool_t maskRepeat = FALSE;
- pixman_bool_t srcTransform = pSrc->common.transform != NULL;
- pixman_bool_t maskTransform = FALSE;
- pixman_bool_t srcAlphaMap = pSrc->common.alpha_map != NULL;
- pixman_bool_t maskAlphaMap = FALSE;
- pixman_bool_t dstAlphaMap = pDst->common.alpha_map != NULL;
- CompositeFunc func = NULL;
+ pixman_bool_t srcRepeat = pSrc->type == BITS && pSrc->common.repeat == PIXMAN_REPEAT_NORMAL;
+ pixman_bool_t maskRepeat = FALSE;
+ pixman_bool_t srcTransform = pSrc->common.transform != NULL;
+ pixman_bool_t maskTransform = FALSE;
+ pixman_bool_t srcAlphaMap = pSrc->common.alpha_map != NULL;
+ pixman_bool_t maskAlphaMap = FALSE;
+ pixman_bool_t dstAlphaMap = pDst->common.alpha_map != NULL;
+ CompositeFunc func = NULL;
#ifdef USE_SSE2
- static pixman_bool_t sse_setup = FALSE;
- if (!sse_setup)
- {
- fbComposeSetupSSE();
- sse_setup = TRUE;
- }
+ fbComposeSetupSSE();
#endif
#ifdef USE_MMX
- static pixman_bool_t mmx_setup = FALSE;
- if (!mmx_setup)
- {
- fbComposeSetupMMX();
- mmx_setup = TRUE;
- }
+ fbComposeSetupMMX();
#endif
if (srcRepeat && srcTransform &&
pSrc->bits.width == 1 &&
pSrc->bits.height == 1)
+ {
srcTransform = FALSE;
+ }
if (pMask && pMask->type == BITS)
{
@@ -1700,7 +1691,9 @@ pixman_image_composite (pixman_op_t op,
if (maskRepeat && maskTransform &&
pMask->bits.width == 1 &&
pMask->bits.height == 1)
+ {
maskTransform = FALSE;
+ }
}
if ((pSrc->type == BITS || can_get_solid (pSrc)) && (!pMask || pMask->type == BITS)
@@ -2011,7 +2004,7 @@ pixman_have_sse (void)
if (!initialized)
{
unsigned int features = detectCPUFeatures();
- sse_present = (features & (SSE|SSE2)) == (SSE|SSE2);
+ sse_present = (features & (MMX|MMX_Extensions|SSE|SSE2)) == (MMX|MMX_Extensions|SSE|SSE2);
initialized = TRUE;
}
diff --git a/pixman/pixman-sse.c b/pixman/pixman-sse.c
index da2a4f7..cd7532d 100644
--- a/pixman/pixman-sse.c
+++ b/pixman/pixman-sse.c
@@ -29,13 +29,21 @@
#ifdef USE_SSE2
-void fbComposeSetupSSE(void)
+void
+fbComposeSetupSSE(void)
{
+ static pixman_bool_t initialized = FALSE;
+
+ if (initialized)
+ return;
+
/* check if we have SSE2 support and initialize accordingly */
if (pixman_have_sse())
{
}
+
+ initialized = TRUE;
}
-#endif /* USE_SSE2 */
\ No newline at end of file
+#endif /* USE_SSE2 */
commit 6cb327be1f4e64d09bd9fa8d444afda17ed58da4
Author: Rodrigo Kumpera <kumpera at gmail.com>
Date: Fri Mar 14 19:11:17 2008 -0400
Add build system support for SSE2.
diff --git a/configure.ac b/configure.ac
index b1c2015..c416bc8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,8 +165,37 @@ fi
AM_CONDITIONAL(USE_SSE, test $have_sse_intrinsics = yes)
+
+dnl ===========================================================================
+dnl Check for SSE2
+
+SSE_CFLAGS="-mmmx -msse2 -Winline --param inline-unit-growth=10000 --param large-function-growth=10000"
+
+have_sse2_intrinsics=no
+AC_MSG_CHECKING(whether to use SSE2 intrinsics)
+xserver_save_CFLAGS=$CFLAGS
+CFLAGS="$CFLAGS -msse2 $MMX_CFLAGS"
+
+AC_COMPILE_IFELSE([
+#include <mmintrin.h>
+#include <xmmintrin.h>
+int main () {
+ __m128i a, b, c;
+ c = _mm_xor_si128 (a, b);
+ return 0;
+}], have_sse2_intrinsics=yes)
+CFLAGS=$xserver_save_CFLAGS
+AC_MSG_RESULT($have_sse2_intrinsics)
+
+if test $have_sse2_intrinsics = yes ; then
+ AC_DEFINE(USE_SSE2, 1, [use SSE compiler intrinsics])
+fi
+
+AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes)
+
dnl ========================================================
AC_SUBST(MMX_CFLAGS)
+AC_SUBST(SSE_CFLAGS)
PKG_CHECK_MODULES(GTK, [gtk+-2.0], [HAVE_GTK=yes], [HAVE_GTK=no])
AM_CONDITIONAL(HAVE_GTK, [test "x$HAVE_GTK" = xyes])
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 66283a2..1f21f8c 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -30,3 +30,16 @@ libpixman_mmx_la_CFLAGS = $(DEP_CFLAGS) $(MMX_CFLAGS)
libpixman_mmx_la_LIBADD = $(DEP_LIBS)
libpixman_1_la_LIBADD += libpixman-mmx.la
endif
+
+
+# sse2 code
+if USE_SSE2
+noinst_LTLIBRARIES = libpixman-sse.la
+libpixman_sse_la_SOURCES = \
+ pixman-sse.c \
+ pixman-sse.h
+libpixman_sse_la_CFLAGS = $(DEP_CFLAGS) $(SSE_CFLAGS)
+libpixman_sse_la_LIBADD = $(DEP_LIBS)
+libpixman_1_la_LIBADD += libpixman-sse.la
+endif
+
diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c
index 4a97df9..d499fbd 100644
--- a/pixman/pixman-pict.c
+++ b/pixman/pixman-pict.c
@@ -33,6 +33,7 @@
#include "pixman-private.h"
#include "pixman-mmx.h"
+#include "pixman-sse.h"
#define FbFullMask(n) ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1))
@@ -1555,6 +1556,14 @@ static const FastPathInfo c_fast_paths[] =
{ PIXMAN_OP_NONE },
};
+#ifdef USE_SSE2
+static const FastPathInfo sse_fast_paths[] =
+{
+ { PIXMAN_OP_NONE },
+};
+#endif
+
+
static pixman_bool_t
mask_is_solid (pixman_image_t *mask)
{
@@ -1655,6 +1664,15 @@ pixman_image_composite (pixman_op_t op,
pixman_bool_t dstAlphaMap = pDst->common.alpha_map != NULL;
CompositeFunc func = NULL;
+#ifdef USE_SSE2
+ static pixman_bool_t sse_setup = FALSE;
+ if (!sse_setup)
+ {
+ fbComposeSetupSSE();
+ sse_setup = TRUE;
+ }
+#endif
+
#ifdef USE_MMX
static pixman_bool_t mmx_setup = FALSE;
if (!mmx_setup)
@@ -1706,9 +1724,16 @@ pixman_image_composite (pixman_op_t op,
ySrc == yMask &&
!pMask->common.component_alpha &&
!maskRepeat;
+ info = NULL;
+
+#ifdef USE_SSE2
+ if (pixman_have_sse ())
+ info = get_fast_path (sse_fast_paths, op, pSrc, pMask, pDst, pixbuf);
+ if (!info)
+#endif
#ifdef USE_MMX
- info = NULL;
+
if (pixman_have_mmx())
info = get_fast_path (mmx_fast_paths, op, pSrc, pMask, pDst, pixbuf);
if (!info)
@@ -1976,5 +2001,21 @@ pixman_have_mmx (void)
return mmx_present;
}
+
+pixman_bool_t
+pixman_have_sse (void)
+{
+ static pixman_bool_t initialized = FALSE;
+ static pixman_bool_t sse_present;
+
+ if (!initialized)
+ {
+ unsigned int features = detectCPUFeatures();
+ sse_present = (features & (SSE|SSE2)) == (SSE|SSE2);
+ initialized = TRUE;
+ }
+
+ return sse_present;
+}
#endif /* __amd64__ */
#endif
diff --git a/pixman/pixman-sse.c b/pixman/pixman-sse.c
new file mode 100644
index 0000000..da2a4f7
--- /dev/null
+++ b/pixman/pixman-sse.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright © 2008 Rodrigo Kumpera
+ *
+ * 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: Rodrigo Kumpera (kumpera at gmail.com)
+ *
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef USE_SSE2
+
+void fbComposeSetupSSE(void)
+{
+ /* check if we have SSE2 support and initialize accordingly */
+ if (pixman_have_sse())
+ {
+ }
+}
+
+
+#endif /* USE_SSE2 */
\ No newline at end of file
diff --git a/pixman/pixman-sse.h b/pixman/pixman-sse.h
new file mode 100644
index 0000000..9ef7574
--- /dev/null
+++ b/pixman/pixman-sse.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright © 2008 Rodrigo Kumpera
+ *
+ * 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: Rodrigo Kumpera (kumpera at gmail.com)
+ *
+ */
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "pixman-private.h"
+
+#ifdef USE_SSE2
+
+pixman_bool_t pixman_have_sse(void);
+
+void fbComposeSetupSSE(void);
+
+#endif /* USE_SSE2 */
More information about the xorg-commit
mailing list