# HG changeset patch # User ramiro # Date 1238697082 0 # Node ID d8a28bef8bc3f5977167be604240d3cd0a010e97 # Parent 290420c32921f6167e0cc3b7abcc1a81d2ead9a0 swscale: Execute sfence and emms depending on runtime flags. diff -r 290420c32921 -r d8a28bef8bc3 libswscale/swscale_template.c --- a/libswscale/swscale_template.c Thu Apr 02 09:20:48 2009 +0000 +++ b/libswscale/swscale_template.c Thu Apr 02 18:31:22 2009 +0000 @@ -26,15 +26,6 @@ #undef PAVGB #undef PREFETCH #undef PREFETCHW -#undef EMMS -#undef SFENCE - -#if HAVE_AMD3DNOW -/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ -#define EMMS "femms" -#else -#define EMMS "emms" -#endif #if HAVE_AMD3DNOW #define PREFETCH "prefetch" @@ -48,12 +39,6 @@ #endif #if HAVE_MMX2 -#define SFENCE "sfence" -#else -#define SFENCE " # nop" -#endif - -#if HAVE_MMX2 #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" #elif HAVE_AMD3DNOW #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" @@ -3209,8 +3194,10 @@ fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255); #if HAVE_MMX - __asm__ volatile(SFENCE:::"memory"); - __asm__ volatile(EMMS:::"memory"); + if (flags & SWS_CPU_CAPS_MMX2 ) __asm__ volatile("sfence":::"memory"); + /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ + if (flags & SWS_CPU_CAPS_3DNOW) __asm__ volatile("femms" :::"memory"); + else __asm__ volatile("emms" :::"memory"); #endif /* store changed local vars back in the context */ c->dstY= dstY;