[Mesa-dev] [PATCH 21/29] mesa: stop going behind the user's back wrt sse4.1 optimisations

Emil Velikov emil.l.velikov at gmail.com
Tue Jul 29 15:54:33 PDT 2014


If the user/builder has a setup capable of using sse4.1 it's their
responsibility to enable it.

Let's unconditionally include main/streaming-load-memcpy.c, as it
already features a ifdef __SSE4_1__ check and add a stub implementation
for people that don't have -msse4.1 enabled at compile-time.

This resolves undefined references to _mesa_streaming_load_memcpy for
the Android build and compilers not capable of sse4.1 optimizations.

Note: if your compiler is capable of -msse4.1 and you are interested
in using such optimisations, enable them explicitly.

Cc: Matt Turner <mattst88 at gmail.com>
Cc: Adrian Negreanu <adrian.m.negreanu at intel.com>
Cc: "10.1 10.2" <mesa-stable at lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 configure.ac                          |  6 ------
 src/mesa/Android.libmesa_dricore.mk   |  5 -----
 src/mesa/Makefile.am                  | 13 +------------
 src/mesa/Makefile.sources             |  1 +
 src/mesa/main/streaming-load-memcpy.h |  8 ++++++++
 5 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6d364dc..2b8df5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,12 +235,6 @@ AC_SUBST([VISIBILITY_CFLAGS])
 AC_SUBST([VISIBILITY_CXXFLAGS])
 
 dnl
-dnl Optional flags, check for compiler support
-dnl
-AX_CHECK_COMPILE_FLAG([-msse4.1], [SSE41_SUPPORTED=1], [SSE41_SUPPORTED=0])
-AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1])
-
-dnl
 dnl Hacks to enable 32 or 64 bit build
 dnl
 AC_ARG_ENABLE([32-bit],
diff --git a/src/mesa/Android.libmesa_dricore.mk b/src/mesa/Android.libmesa_dricore.mk
index 217f649..1332ebf 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -47,11 +47,6 @@ ifeq ($(TARGET_ARCH),x86)
 endif # x86
 endif # MESA_ENABLE_ASM
 
-ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
-LOCAL_SRC_FILES += \
-	$(SRCDIR)main/streaming-load-memcpy.c
-endif
-
 LOCAL_C_INCLUDES := \
 	$(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
 	$(MESA_TOP)/src/mapi \
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 88eeff9..d59af99 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -81,7 +81,7 @@ main/get_hash.h: $(GLAPI)/gl_and_es_API.xml main/get_hash_params.py 	\
 		-f $< > $@.tmp;						\
 	mv $@.tmp $@;
 
-noinst_LTLIBRARIES = $(ARCH_LIBS)
+noinst_LTLIBRARIES =
 if NEED_LIBMESA
 noinst_LTLIBRARIES += libmesa.la
 else
@@ -95,11 +95,6 @@ AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS)
 AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS)
 AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS)
 
-ARCH_LIBS =
-
-if SSE41_SUPPORTED
-ARCH_LIBS += libmesa_sse41.la
-endif
 
 MESA_ASM_FILES_FOR_ARCH =
 
@@ -129,7 +124,6 @@ libmesa_la_SOURCES = \
 
 libmesa_la_LIBADD = \
         $(top_builddir)/src/glsl/libglsl.la \
-	$(ARCH_LIBS) \
         $()
 
 libmesagallium_la_SOURCES = \
@@ -139,13 +133,8 @@ libmesagallium_la_SOURCES = \
 
 libmesagallium_la_LIBADD = \
         $(top_builddir)/src/glsl/libglsl.la \
-	$(ARCH_LIBS) \
         $()
 
-libmesa_sse41_la_SOURCES = \
-	main/streaming-load-memcpy.c
-libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1
-
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gl.pc
 
diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources
index f4904fb..e0ff80b 100644
--- a/src/mesa/Makefile.sources
+++ b/src/mesa/Makefile.sources
@@ -91,6 +91,7 @@ MAIN_FILES = \
 	$(SRCDIR)main/shared.c \
 	$(SRCDIR)main/state.c \
 	$(SRCDIR)main/stencil.c \
+	$(SRCDIR)main/streaming-load-memcpy.c \
 	$(SRCDIR)main/syncobj.c \
 	$(SRCDIR)main/texcompress.c \
 	$(SRCDIR)main/texcompress_cpal.c \
diff --git a/src/mesa/main/streaming-load-memcpy.h b/src/mesa/main/streaming-load-memcpy.h
index 41eeeec..80f0830 100644
--- a/src/mesa/main/streaming-load-memcpy.h
+++ b/src/mesa/main/streaming-load-memcpy.h
@@ -29,5 +29,13 @@
 /* Copies memory from src to dst, using SSE 4.1's MOVNTDQA to get streaming
  * read performance from uncached memory.
  */
+
+#ifdef __SSE4_1__
 void
 _mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len);
+
+#else
+static void
+_mesa_streaming_load_memcpy(void *restrict dst, void *restrict src, size_t len) {}
+
+#endif
-- 
2.0.2



More information about the mesa-dev mailing list