Skip to contentSkip to conversation

ffmpeg: disable for ARMv7-M

PATCH New Thomas Petazzoni 3 participants 7 messages Aug 10, 2016 – Aug 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ffmpeg: disable for ARMv7-M

In the ffmpeg code, libavutil/arm/asm.S makes some assumption about the ARM architecture for which the code is built. Only ARMv4, ARMv5, ARMv6 and ARMv7-A is supported. Due to this, object files built out of ARM-optimized assembly code have the wrong architecture information, causing a failure at link time.

Adding ARMv7-M support would be possible, but it doesn't exist yet in ffmpeg, and it's pretty unlikely that ffmpeg will ever be needed on an ARMv7-M platform, so this commit takes the simple approach of disabling ffmpeg for ARMv7-M.

Fixes:

http://autobuild.buildroot.net/results/ca4c67b093afd6f14349fcdc87b02e0480172e8c/

---
 package/ffmpeg/Config.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/ffmpeg/Config.in +3 -1
index 096ff95..3a7bfd3 100644
@@ -2,7 +2,9 @@ config BR2_PACKAGE_FFMPEG_ARCH_SUPPORTS
 	bool
 	# fenv.h lacks FE_INVALID, FE_OVERFLOW & FE_UNDERFLOW on nios2
 	# ffmpeg's configure script only supports mips64 (r1) variant
-	default y if !BR2_nios2 && !BR2_mips_64r2 && !BR2_mips_64r6
+	# No support for ARMv7-M in the ARM assembly logic
+	default y if !BR2_nios2 && !BR2_mips_64r2 && !BR2_mips_64r6 && \
+		!BR2_ARM_CPU_ARMV7M
 
 menuconfig BR2_PACKAGE_FFMPEG
 	bool "ffmpeg"
Signature · 1 line
2.7.4
author Applied
#1 lore raw

PATCH 1/3 ffmpeg: disable for ARMv7-M

Hello,

Quoted 11 lines · Thomas Petazzoni

In the ffmpeg code, libavutil/arm/asm.S makes some assumption about the ARM architecture for which the code is built. Only ARMv4, ARMv5, ARMv6 and ARMv7-A is supported. Due to this, object files built out of ARM-optimized assembly code have the wrong architecture information, causing a failure at link time.

Adding ARMv7-M support would be possible, but it doesn't exist yet in ffmpeg, and it's pretty unlikely that ffmpeg will ever be needed on an ARMv7-M platform, so this commit takes the simple approach of disabling ffmpeg for ARMv7-M.

Quoted 8 lines

Fixes:

http://autobuild.buildroot.net/results/ca4c67b093afd6f14349fcdc87b02e0480172e8c/

---
 package/ffmpeg/Config.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 2/3 ffmpeg: explicitly disable NEON support

In reply to Thomas Petazzoni

When BR2_ARM_CPU_HAS_NEON=y, we pass --enable-neon. However, when BR2_ARM_CPU_HAS_NEON is disabled, we don't pass anything. This generally works fine, but turned out to integrate NEON code in ARMv7-M builds (since it's ARMv7, ffmpeg assumed it should enable NEON code).

Even though ffmpeg is now disabled for ARMv7-M, it still makes sense to be explicit, and disable NEON support when the CPU doesn't have it.

---
 package/ffmpeg/ffmpeg.mk | 2 ++
 1 file changed, 2 insertions(+)
package/ffmpeg/ffmpeg.mk +2 -0
index c42336f..2b4219a 100644
@@ -437,6 +437,8 @@ FFMPEG_CONF_OPTS += --disable-vfp
 endif
 ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
 FFMPEG_CONF_OPTS += --enable-neon
+else
+FFMPEG_CONF_OPTS += --disable-neon
 endif
 
 ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
Signature · 1 line
2.7.4
#3 lore raw

PATCH 2/3 ffmpeg: explicitly disable NEON support

Quoted 10 lines · Thomas Petazzoni

When BR2_ARM_CPU_HAS_NEON=y, we pass --enable-neon. However, when BR2_ARM_CPU_HAS_NEON is disabled, we don't pass anything. This generally works fine, but turned out to integrate NEON code in ARMv7-M builds (since it's ARMv7, ffmpeg assumed it should enable NEON code).

Even though ffmpeg is now disabled for ARMv7-M, it still makes sense to be explicit, and disable NEON support when the CPU doesn't have it.

Just an aside. You can add ?enable-thumb when the default ISA chosen is thumb

Quoted 18 lines

---
package/ffmpeg/ffmpeg.mk | 2 ++

1 file changed, 2 insertions(+)
package/ffmpeg/ffmpeg.mk +0 -0
index c42336f..2b4219a 100644
@@ -437,6 +437,8 @@ FFMPEG_CONF_OPTS += --disable-vfp

endif
ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
FFMPEG_CONF_OPTS += --enable-neon

package/ffmpeg/ffmpeg.mk +2 -0
+else
+FFMPEG_CONF_OPTS += --disable-neon

endif

Quoted 8 lines

ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
--
2.7.4

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 204 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160811/e67fffad/attachment.asc>

#4 lore raw

PATCH 2/3 ffmpeg: explicitly disable NEON support

In reply to Thomas Petazzoni
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

When BR2_ARM_CPU_HAS_NEON=y, we pass --enable-neon. However, when BR2_ARM_CPU_HAS_NEON is disabled, we don't pass anything. This generally works fine, but turned out to integrate NEON code in ARMv7-M builds (since it's ARMv7, ffmpeg assumed it should enable NEON code).

Even though ffmpeg is now disabled for ARMv7-M, it still makes sense to be explicit, and disable NEON support when the CPU doesn't have it.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 3/3 ffmpeg: don't pass --enable-mipsfpu on non-MIPS platform

In reply to Thomas Petazzoni

The current logic to pass the --{enable,disable}-mipsfpu option is:

ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
FFMPEG_CONF_OPTS += --disable-mipsfpu
else
FFMPEG_CONF_OPTS += --enable-mipsfpu
endif

In practice, this means that on MIPS soft-float, --disable-mipsfpu is passed, and that in *all* other cases, --enable-mipsfpu is passed, including if we are *not* targetting the MIPS architecture.

Even though this doesn't seem to cause any problem, it is a bit weird to see --enable-mipsfpu when you're building ffmpeg for a non-MIPS architecture, so we better fix this by enclosing the MIPS-related options in a MIPS condition.

---
 package/ffmpeg/ffmpeg.mk | 2 ++
 1 file changed, 2 insertions(+)
package/ffmpeg/ffmpeg.mk +2 -0
index 2b4219a..5a19617 100644
@@ -441,6 +441,7 @@ else
 FFMPEG_CONF_OPTS += --disable-neon
 endif
 
+ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
 ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
 FFMPEG_CONF_OPTS += --disable-mipsfpu
 else
@@ -454,6 +455,7 @@ else
 FFMPEG_CONF_OPTS += \
 	--disable-mips32r2
 endif
+endif # MIPS
 
 ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
 FFMPEG_CONF_OPTS += --enable-altivec
Signature · 1 line
2.7.4
#6 lore raw

PATCH 3/3 ffmpeg: don't pass --enable-mipsfpu on non-MIPS platform

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

The current logic to pass the --{enable,disable}-mipsfpu option is:
ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
FFMPEG_CONF_OPTS += --disable-mipsfpu
else
FFMPEG_CONF_OPTS += --enable-mipsfpu
endif

In practice, this means that on MIPS soft-float, --disable-mipsfpu is passed, and that in *all* other cases, --enable-mipsfpu is passed, including if we are *not* targetting the MIPS architecture.

Quoted 6 lines

Even though this doesn't seem to cause any problem, it is a bit weird to see --enable-mipsfpu when you're building ffmpeg for a non-MIPS architecture, so we better fix this by enclosing the MIPS-related options in a MIPS condition.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard