package/ffmpeg: improve inline asm handling for libpostproc
PATCH 1/1 package/ffmpeg: improve inline asm handling for libpostproc
We compile ffmpeg with runtime cpu detect enabled, which is also the default upstream:
https://ffmpeg.org/pipermail/ffmpeg-cvslog/2012-September/054876.html
http://article.gmane.org/gmane.comp.video.ffmpeg.devel/151613
If inline asm is enabled (default value) libpostproc enables code for mmx/3dnow/sse2, regardless of the target CPU chosen by buildroot:
http://git.videolan.org/gitweb.cgi/ffmpeg.git/?p=ffmpeg.git;a=blob;f=libpostproc/postprocess.c;h=1dc719cf93985d5504acb8af20441f5f3d5f9fe8;hb=refs/heads/release/2.8#l536
This patch moves the current i586-only workaround, which was based on an incomplete understanding of the problem, inside the ifeq-libpostproc code block.
Please note that inline-asm is also used on other archs besides x86, therefore we need to check both for BR2_i386 and BR2_X86_CPU_HAS_MMX.
This patch was compile-tested using these defconfigs:
BR2_x86_i486=y
BR2_PACKAGE_FFMPEG=y
BR2_PACKAGE_FFMPEG_GPL=y
BR2_PACKAGE_FFMPEG_POSTPROC=y
BR2_PACKAGE_FFMPEG=y
BR2_PACKAGE_FFMPEG_GPL=y
BR2_PACKAGE_FFMPEG_POSTPROC=y
BR2_x86_pentium_mmx=y
BR2_PACKAGE_FFMPEG=y
BR2_PACKAGE_FFMPEG_GPL=y
BR2_PACKAGE_FFMPEG_POSTPROC=y
This patch supersedes http://patchwork.ozlabs.org/patch/589461/
--- package/ffmpeg/ffmpeg.mk | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
package/ffmpeg/ffmpeg.mk +4 -5
@@ -111,6 +111,10 @@ endif ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y) FFMPEG_CONF_OPTS += --enable-postproc +# disable inline-asm on non-mmx Intel CPUs +ifeq ($(BR2_i386)$(BR2_X86_CPU_HAS_MMX),y) +FFMPEG_CONF_OPTS += --disable-inline-asm +endif else FFMPEG_CONF_OPTS += --disable-postproc endif
@@ -352,11 +356,6 @@ ifeq ($(BR2_X86_CPU_HAS_MMX),y) FFMPEG_CONF_OPTS += --enable-yasm FFMPEG_DEPENDENCIES += host-yasm else -ifeq ($(BR2_x86_i586),y) -# Needed to work around a bug with gcc 5.x: -# error: 'asm' operand has impossible constraints -FFMPEG_CONF_OPTS += --disable-inline-asm -endif FFMPEG_CONF_OPTS += --disable-yasm FFMPEG_CONF_OPTS += --disable-mmx endif
Signature · 1 line
2.7.0
PATCH 1/1 package/ffmpeg: improve inline asm handling for libpostproc
Bernd,
package/ffmpeg/ffmpeg.mk endif · line 116
Quoted 5 lines · Bernd Kuhls
ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
FFMPEG_CONF_OPTS+= --enable-postprocpackage/ffmpeg/ffmpeg.mk +3
-0+# disable inline-asm on non-mmx Intel CPUs +ifeq ($(BR2_i386)$(BR2_X86_CPU_HAS_MMX),y) +FFMPEG_CONF_OPTS += --disable-inline-asm
On x86-64, BR2_i386 is false, but BR2_X86_CPU_HAS_MMX=y, so you will disable inline-asm. Is this what you want?
Why isn't the condition simply:
ifeq ($(BR2_X86_CPU_HAS_MMX),)FFMPEG_CONF_OPTS += --disable-inline-asm
endif
Which actually matches your comment: when you have a non-MMX capable Intel CPU -> disable inline assembly.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com