[Mesa-dev] [PATCH 5/7] broadcom/vc4: Build the vc4_tiling_lt_neon.c with -mfpu=neon on ARM.

Eric Anholt eric at anholt.net
Tue Aug 8 20:19:50 UTC 2017


If you don't pass this, the compiler refuses to compile the assembly for
pre-v7 CPUs.  This also keeps us from building identical, non-NEON code on
aarch64 and x86.

Fixes: a373f77662c5 ("vc4: Use a wrapper file to set VC4_BUILD_NEON instead of CFLAGS.")
---
 src/gallium/drivers/vc4/Android.mk       | 10 ++++++++++
 src/gallium/drivers/vc4/Makefile.am      |  7 +++++++
 src/gallium/drivers/vc4/Makefile.sources |  3 ++-
 src/gallium/drivers/vc4/vc4_tiling.h     | 17 +++++++++++------
 4 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/vc4/Android.mk b/src/gallium/drivers/vc4/Android.mk
index 84bfaa839f9e..eaf66ebe8cb9 100644
--- a/src/gallium/drivers/vc4/Android.mk
+++ b/src/gallium/drivers/vc4/Android.mk
@@ -23,6 +23,15 @@ LOCAL_PATH := $(call my-dir)
 # get C_SOURCES
 include $(LOCAL_PATH)/Makefile.sources
 
+# First, the architecture-specific library.
+ifeq ($(TARGET_ARCH),arm)
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := $(NEON_C_SOURCES)
+LOCAL_CFLAGS := -mfpu=neon
+LOCAL_MODULE := libmesa_broadcom_vc4_neon
+BROADCOM_VC4_NEON_LIB := $(LOCAL_MODULE)
+endif
+
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
@@ -37,6 +46,7 @@ LOCAL_STATIC_LIBRARIES := \
 	libmesa_nir
 
 LOCAL_WHOLE_STATIC_LIBRARIES := \
+	$(BROADCOM_VC4_NEON_LIB) \
 	libmesa_broadcom_cle \
 	libmesa_broadcom_genxml
 
diff --git a/src/gallium/drivers/vc4/Makefile.am b/src/gallium/drivers/vc4/Makefile.am
index 9b0ef6ef790e..4c2b7486c522 100644
--- a/src/gallium/drivers/vc4/Makefile.am
+++ b/src/gallium/drivers/vc4/Makefile.am
@@ -44,6 +44,13 @@ libvc4_la_LIBADD = \
 	$(top_builddir)/src/broadcom/cle/libbroadcom_cle.la \
 	$()
 
+if HAVE_ARM_ASM
+noinst_LTLIBRARIES += libvc4_neon.la
+libvc4_la_LIBADD += libvc4_neon.la
+libvc4_neon_la_SOURCES = $(NEON_C_SOURCES)
+libvc4_neon_la_CFLAGS = $(AM_CFLAGS) -mfpu=neon
+endif
+
 libvc4_la_LDFLAGS = $(SIM_LDFLAGS)
 
 EXTRA_DIST = kernel/README
diff --git a/src/gallium/drivers/vc4/Makefile.sources b/src/gallium/drivers/vc4/Makefile.sources
index f67dffe00636..76dea7041b72 100644
--- a/src/gallium/drivers/vc4/Makefile.sources
+++ b/src/gallium/drivers/vc4/Makefile.sources
@@ -57,7 +57,8 @@ C_SOURCES := \
 	vc4_state.c \
 	vc4_tiling.c \
 	vc4_tiling_lt.c \
-	vc4_tiling_lt_neon.c \
 	vc4_tiling.h \
 	vc4_uniforms.c \
 	$()
+
+NEON_C_SOURCES := vc4_tiling_lt_neon.c
diff --git a/src/gallium/drivers/vc4/vc4_tiling.h b/src/gallium/drivers/vc4/vc4_tiling.h
index 3168ec20a606..66767e7f1f83 100644
--- a/src/gallium/drivers/vc4/vc4_tiling.h
+++ b/src/gallium/drivers/vc4/vc4_tiling.h
@@ -89,13 +89,15 @@ vc4_load_lt_image(void *dst, uint32_t dst_stride,
                   void *src, uint32_t src_stride,
                   int cpp, const struct pipe_box *box)
 {
+#ifdef USE_ARM_ASM
         if (util_cpu_caps.has_neon) {
                 vc4_load_lt_image_neon(dst, dst_stride, src, src_stride,
                                        cpp, box);
-        } else {
-                vc4_load_lt_image_base(dst, dst_stride, src, src_stride,
-                                       cpp, box);
+                return;
         }
+#endif
+        vc4_load_lt_image_base(dst, dst_stride, src, src_stride,
+                               cpp, box);
 }
 
 static inline void
@@ -103,13 +105,16 @@ vc4_store_lt_image(void *dst, uint32_t dst_stride,
                    void *src, uint32_t src_stride,
                    int cpp, const struct pipe_box *box)
 {
+#ifdef USE_ARM_ASM
         if (util_cpu_caps.has_neon) {
                 vc4_store_lt_image_neon(dst, dst_stride, src, src_stride,
                                         cpp, box);
-        } else {
-                vc4_store_lt_image_base(dst, dst_stride, src, src_stride,
-                                        cpp, box);
+                return;
         }
+#endif
+
+        vc4_store_lt_image_base(dst, dst_stride, src, src_stride,
+                                cpp, box);
 }
 
 #endif /* VC4_TILING_H */
-- 
2.13.3



More information about the mesa-dev mailing list