diff mbox

[FFmpeg-devel] avcodec/x86/cavsdsp: Put MMX code under mmx check

Message ID 20170305024206.19343-1-michael@niedermayer.cc
State Accepted
Headers show

Commit Message

Michael Niedermayer March 5, 2017, 2:42 a.m. UTC
Without this the FPU state becomes trashed and causes mysterious
fate failures with cpuflags=0

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/x86/cavsdsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

James Almer March 5, 2017, 3 a.m. UTC | #1
On 3/4/2017 11:42 PM, Michael Niedermayer wrote:
> Without this the FPU state becomes trashed and causes mysterious
> fate failures with cpuflags=0
> 
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavcodec/x86/cavsdsp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
> index 4b20e655a7..d5c63c5128 100644
> --- a/libavcodec/x86/cavsdsp.c
> +++ b/libavcodec/x86/cavsdsp.c
> @@ -565,7 +565,9 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
>  {
>      av_unused int cpu_flags = av_get_cpu_flags();
>  
> -    cavsdsp_init_mmx(c, avctx);
> +    if (INLINE_MMXEXT(cpu_flags))

This should be MMX, not MMXEXT. Also some of the functions are yasm/nasm, not inline.
Either add INLINE_MMX() and EXTERNAL_MMX() inside cavsdsp_init_mmx() where needed,
or use X86_MMX() here.

> +        cavsdsp_init_mmx(c, avctx);
> +
>  #if HAVE_AMD3DNOW_INLINE
>      if (INLINE_AMD3DNOW(cpu_flags))
>          cavsdsp_init_3dnow(c, avctx);
>
Michael Niedermayer March 5, 2017, 10:54 a.m. UTC | #2
On Sun, Mar 05, 2017 at 12:00:16AM -0300, James Almer wrote:
> On 3/4/2017 11:42 PM, Michael Niedermayer wrote:
> > Without this the FPU state becomes trashed and causes mysterious
> > fate failures with cpuflags=0
> > 
> > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> > ---
> >  libavcodec/x86/cavsdsp.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
> > index 4b20e655a7..d5c63c5128 100644
> > --- a/libavcodec/x86/cavsdsp.c
> > +++ b/libavcodec/x86/cavsdsp.c
> > @@ -565,7 +565,9 @@ av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
> >  {
> >      av_unused int cpu_flags = av_get_cpu_flags();
> >  
> > -    cavsdsp_init_mmx(c, avctx);
> > +    if (INLINE_MMXEXT(cpu_flags))
> 
> This should be MMX, not MMXEXT. Also some of the functions are yasm/nasm, not inline.
> Either add INLINE_MMX() and EXTERNAL_MMX() inside cavsdsp_init_mmx() where needed,
> or use X86_MMX() here.

interrestingly, i saw this issue when i copy and pasted this and
intended to fix it before posting the patch. Quite obviously i didnt
must have been distracted ...

ill fix these before applying

[...]
diff mbox

Patch

diff --git a/libavcodec/x86/cavsdsp.c b/libavcodec/x86/cavsdsp.c
index 4b20e655a7..d5c63c5128 100644
--- a/libavcodec/x86/cavsdsp.c
+++ b/libavcodec/x86/cavsdsp.c
@@ -565,7 +565,9 @@  av_cold void ff_cavsdsp_init_x86(CAVSDSPContext *c, AVCodecContext *avctx)
 {
     av_unused int cpu_flags = av_get_cpu_flags();
 
-    cavsdsp_init_mmx(c, avctx);
+    if (INLINE_MMXEXT(cpu_flags))
+        cavsdsp_init_mmx(c, avctx);
+
 #if HAVE_AMD3DNOW_INLINE
     if (INLINE_AMD3DNOW(cpu_flags))
         cavsdsp_init_3dnow(c, avctx);