[Mesa-dev] [PATCH V4] mesa: add SSE optimisation for glDrawElements

Emil Velikov emil.l.velikov at gmail.com
Sun Oct 26 19:15:02 PDT 2014


On 26/10/14 21:37, Timothy Arceri wrote:
> Makes use of SSE to speed up compute of min and max elements
> 
> Callgrind cpu usage results from pts benchmarks:
> 
> Openarena 0.8.8: 3.67% -> 1.03%
> UrbanTerror: 2.36% -> 0.81%
> 
> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
> ---
>  src/mesa/Android.libmesa_dricore.mk |  3 +-
>  src/mesa/Makefile.am                |  3 +-
>  src/mesa/main/sse_minmax.c          | 93 +++++++++++++++++++++++++++++++++++++
>  src/mesa/main/sse_minmax.h          | 30 ++++++++++++
>  src/mesa/vbo/vbo_exec_array.c       | 14 ++++--
>  5 files changed, 138 insertions(+), 5 deletions(-)
>  create mode 100644 src/mesa/main/sse_minmax.c
>  create mode 100644 src/mesa/main/sse_minmax.h
> 
> V4:
> - fixed bugs with incrementing pointer and updating counters
> 
> V3:
> 
> - Removed sse_minmax.c from Makefile.sources
> - handle the first few values without SSE until the pointer is aligned
>  and use _mm_load_si128 rather than _mm_loadu_si128
> - guard the call to the SSE code better at build time
> 
Please squash the following hunks before commiting. This way the Android
build will actually make use of the optimisation :)

Thanks
Emil

diff --git a/src/mesa/Android.libmesa_dricore.mk
b/src/mesa/Android.libmesa_dricore.mk
index 1e6d948..6bd0323 100644
--- a/src/mesa/Android.libmesa_dricore.mk
+++ b/src/mesa/Android.libmesa_dricore.mk
@@ -55,6 +55,11 @@ LOCAL_SRC_FILES += \
 LOCAL_CFLAGS := -msse4.1
 endif

+ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
+LOCAL_CFLAGS += \
+       -DUSE_SSE41
+endif
+
 LOCAL_C_INCLUDES := \
        $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
        $(MESA_TOP)/src \
diff --git a/src/mesa/Android.libmesa_st_mesa.mk
b/src/mesa/Android.libmesa_st_mesa.mk
index 8b8d652..bc15488 100644
--- a/src/mesa/Android.libmesa_st_mesa.mk
+++ b/src/mesa/Android.libmesa_st_mesa.mk
@@ -48,6 +48,11 @@ ifeq ($(TARGET_ARCH),x86)
 endif # x86
 endif # MESA_ENABLE_ASM

+ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
+LOCAL_CFLAGS := \
+       -DUSE_SSE41
+endif
+
 LOCAL_C_INCLUDES := \
        $(call intermediates-dir-for STATIC_LIBRARIES,libmesa_program,,) \
        $(MESA_TOP)/src/gallium/auxiliary \



More information about the mesa-dev mailing list