From 595342148e45edf575c9a046124953ce893dbb9e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Mon, 11 May 2020 03:02:05 +0800 Subject: [PATCH 1/2] treewide: Update ARM NEON/VFP detection With openwrt/openwrt@8dcc1087602e2dd606e4f6e81a06aee62cfd4f4c, the ARM FPU compiler options are no longer part of CONFIG_TARGET_OPTIMIZATION. This updates various packages that look for NEON/VFP support to search CONFIG_CPU_TYPE instead. Signed-off-by: Jeffery To (cherry picked from commit 2d99ee3004a1b3aa099d90bff4eae627d11c53e8) [adapted patch for pulseaudio using autotools build] --- libs/libpng/Makefile | 4 ++-- libs/opus/Makefile | 4 ++-- multimedia/ffmpeg/Makefile | 6 +++--- sound/mpg123/Makefile | 10 ++++------ sound/pulseaudio/Makefile | 4 ++-- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libs/libpng/Makefile b/libs/libpng/Makefile index 685a43b5d..5e31a44b8 100644 --- a/libs/libpng/Makefile +++ b/libs/libpng/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpng PKG_VERSION:=1.6.37 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@SF/libpng @@ -40,7 +40,7 @@ TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --enable-shared \ --enable-static \ - $(if $(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),--enable-hardware-optimizations=yes --enable-arm-neon=yes) + $(if $(findstring neon,$(CONFIG_CPU_TYPE)),--enable-hardware-optimizations=yes --enable-arm-neon=yes) define Build/InstallDev $(INSTALL_DIR) $(1)/usr/bin diff --git a/libs/opus/Makefile b/libs/opus/Makefile index 689b7c0ea..1c106128f 100644 --- a/libs/opus/Makefile +++ b/libs/opus/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=opus PKG_VERSION:=1.3.1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://archive.mozilla.org/pub/opus @@ -47,7 +47,7 @@ ifeq ($(CONFIG_SOFT_FLOAT),y) --enable-fixed-point endif -ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),) +ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),) CONFIGURE_ARGS+= \ --enable-fixed-point endif diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index 16bbb343b..f0fece8e7 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ffmpeg PKG_VERSION:=3.4.7 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://ffmpeg.org/releases/ @@ -464,12 +464,12 @@ endif ifneq ($(findstring arm,$(CONFIG_ARCH)),) FFMPEG_CONFIGURE+= --enable-lto - ifneq ($(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION)),) + ifneq ($(findstring vfp,$(CONFIG_CPU_TYPE)),) FFMPEG_CONFIGURE+= --enable-vfp else FFMPEG_CONFIGURE+= --disable-vfp endif - ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),) + ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),) FFMPEG_CONFIGURE+= \ --enable-neon \ --enable-vfp diff --git a/sound/mpg123/Makefile b/sound/mpg123/Makefile index eae0c0431..858ad15c9 100644 --- a/sound/mpg123/Makefile +++ b/sound/mpg123/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpg123 PKG_VERSION:=1.25.13 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/mpg123 @@ -67,16 +67,14 @@ ifeq ($(CONFIG_SOFT_FLOAT),y) CONFIGURE_ARGS+= \ --with-cpu=generic_nofpu \ --enable-int-quality=yes +else ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),) + CONFIGURE_ARGS+= \ + --with-cpu=arm_fpu else CONFIGURE_ARGS+= \ --with-cpu=generic_fpu endif -ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),) - CONFIGURE_ARGS+= \ - --with-cpu=arm_fpu -endif - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(INSTALL_DATA) \ diff --git a/sound/pulseaudio/Makefile b/sound/pulseaudio/Makefile index 0ac2ed2d1..4e03d6ce6 100644 --- a/sound/pulseaudio/Makefile +++ b/sound/pulseaudio/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=pulseaudio PKG_VERSION:=12.2 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://freedesktop.org/software/pulseaudio/releases/ @@ -100,7 +100,7 @@ define Package/pulseaudio-profiles endef CONFIGURE_ARGS += \ - $(if $(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),--enable-neon-opt,--disable-neon-opt) \ + $(if $(findstring neon,$(CONFIG_CPU_TYPE)),--enable-neon-opt,--disable-neon-opt) \ --with-system-user=pulse \ --with-system-group=pulse \ --with-access-group=audio \ From a12555cc06ce5035ae3d1808f0dd3bfc9e6c1a2e Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 12 May 2020 16:03:07 +0800 Subject: [PATCH 2/2] treewide: Enable VFP/NEON optimizations for aarch64 For speexdsp, support for NEON on aarch64 was added in 1.2.0[1]. [1]: https://github.com/xiph/speexdsp/pull/8 Signed-off-by: Jeffery To (cherry picked from commit dec17eb36c69435f97c6f5635dc57a76386db818) --- libs/libpng/Makefile | 3 ++- libs/opus/Makefile | 2 +- libs/speexdsp/Makefile | 3 +-- multimedia/ffmpeg/Makefile | 9 ++++++++- sound/mpg123/Makefile | 3 +++ 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libs/libpng/Makefile b/libs/libpng/Makefile index 5e31a44b8..7f9b175d6 100644 --- a/libs/libpng/Makefile +++ b/libs/libpng/Makefile @@ -40,7 +40,8 @@ TARGET_CFLAGS += $(FPIC) CONFIGURE_ARGS += \ --enable-shared \ --enable-static \ - $(if $(findstring neon,$(CONFIG_CPU_TYPE)),--enable-hardware-optimizations=yes --enable-arm-neon=yes) + $(if $(findstring neon,$(CONFIG_CPU_TYPE))$(findstring aarch64,$(CONFIG_ARCH)), \ + --enable-hardware-optimizations=yes --enable-arm-neon=yes) define Build/InstallDev $(INSTALL_DIR) $(1)/usr/bin diff --git a/libs/opus/Makefile b/libs/opus/Makefile index 1c106128f..02d9c50f0 100644 --- a/libs/opus/Makefile +++ b/libs/opus/Makefile @@ -47,7 +47,7 @@ ifeq ($(CONFIG_SOFT_FLOAT),y) --enable-fixed-point endif -ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),) +ifneq ($(findstring neon,$(CONFIG_CPU_TYPE))$(findstring aarch64,$(CONFIG_ARCH)),) CONFIGURE_ARGS+= \ --enable-fixed-point endif diff --git a/libs/speexdsp/Makefile b/libs/speexdsp/Makefile index 284a1cab3..14a350c34 100644 --- a/libs/speexdsp/Makefile +++ b/libs/speexdsp/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=speexdsp PKG_VERSION:=1.2.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://downloads.us.xiph.org/releases/speex/ @@ -60,7 +60,6 @@ CONFIGURE_ARGS += \ --enable-shared \ --enable-static \ --disable-examples \ - $(if $(CONFIG_aarch64),--disable-neon) \ $(if $(CONFIG_SOFT_FLOAT),--enable-fixed-point --disable-float-api) $(eval $(call BuildPackage,libspeexdsp)) diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index f0fece8e7..5e8a14861 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -444,7 +444,7 @@ FFMPEG_CONFIGURE+= \ --disable-fast-unaligned \ --disable-runtime-cpudetect -else ifneq ($(findstring arm,$(CONFIG_ARCH)),) +else ifneq ($(findstring arm,$(CONFIG_ARCH))$(findstring aarch64,$(CONFIG_ARCH)),) FFMPEG_CONFIGURE+= \ --disable-runtime-cpudetect # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700) @@ -478,6 +478,13 @@ ifneq ($(findstring arm,$(CONFIG_ARCH)),) endif endif +ifneq ($(findstring aarch64,$(CONFIG_ARCH)),) + FFMPEG_CONFIGURE+= \ + --enable-lto \ + --enable-neon \ + --enable-vfp +endif + ifeq ($(ARCH),x86_64) FFMPEG_CONFIGURE+= --enable-lto endif diff --git a/sound/mpg123/Makefile b/sound/mpg123/Makefile index 858ad15c9..7b4ab74eb 100644 --- a/sound/mpg123/Makefile +++ b/sound/mpg123/Makefile @@ -70,6 +70,9 @@ ifeq ($(CONFIG_SOFT_FLOAT),y) else ifneq ($(findstring neon,$(CONFIG_CPU_TYPE)),) CONFIGURE_ARGS+= \ --with-cpu=arm_fpu +else ifneq ($(findstring aarch64,$(CONFIG_ARCH)),) + CONFIGURE_ARGS+= \ + --with-cpu=aarch64 else CONFIGURE_ARGS+= \ --with-cpu=generic_fpu