[FFmpeg-devel] [PATCH] Fix configure to disable MMX for Pentium Pro
Janne Grunau
janne-ffmpeg
Thu Aug 26 14:36:25 CEST 2010
On Thu, Aug 26, 2010 at 01:52:22AM -0400, Jason Garrett-Glaser wrote:
> On Thu, Aug 26, 2010 at 12:44 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
> > Attached. ?This is essentially fixing an oversight in r21277.
> >
> > -Eli
>
> This means every distro who uses --cpu=i686 or similar will silently
> have their ffmpeg crippled the next time they make a build.
>
> I would rather roll back r21277 than apply this patch.
What about requriring --enable-runtime-cpudetect for i686 with mmx and
crippling emms() in that case like attached patch?
Janne
-------------- next part --------------
Index: configure
===================================================================
--- configure (revision 24944)
+++ configure (working copy)
@@ -2104,6 +2104,21 @@
cpuflags="-march=$cpu"
disable cmov
;;
+ # targets that do support conditional mov (cmov) but not mmx
+ i686|pentiumpro|core2)
+ cpuflags="-march=$cpu"
+ enable cmov
+ enable fast_cmov
+ if ! disabled runtime_cpudetect && ! enabled runtime_cpudetect; then
+ enable runtime_cpudetect
+ warn "CPU without MMX detected, assuming distro build and " \
+ "enabling runtime cpu detectinon. Use " \
+ "--disable-runtime-cpudetect if you are building " \
+ "especially for CPU without MMX. Performance will suffer!"
+ else
+ disable mmx
+ fi
+ ;;
# targets that do support conditional mov (cmov)
i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona|atom)
cpuflags="-march=$cpu"
Index: libavcodec/dsputil.h
===================================================================
--- libavcodec/dsputil.h (revision 24944)
+++ libavcodec/dsputil.h (working copy)
@@ -631,6 +631,14 @@
static inline void emms(void)
{
+#if CONFIG_RUNTIME_CPUDETECT
+ static mm_flags;
+ if (unlikely(!mm_flags)) {
+ mm_flags = mm_support();
+ if (!mm_flags)
+ mm_flags = FF_MM_FORCE;
+ if (mm_flags & FF_MM_MMX)
+#endif /* CONFIG_RUNTIME_CPUDETECT */
__asm__ volatile ("emms;":::"memory");
}
More information about the ffmpeg-devel
mailing list