Commit b1a07894 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Check for 3D Now! at build time

parent 0ed12fd6
...@@ -31,7 +31,7 @@ VLC_API unsigned vlc_CPU(void); ...@@ -31,7 +31,7 @@ VLC_API unsigned vlc_CPU(void);
# if defined (__i386__) || defined (__x86_64__) # if defined (__i386__) || defined (__x86_64__)
# define HAVE_FPU 1 # define HAVE_FPU 1
# define VLC_CPU_MMX 8 # define VLC_CPU_MMX 8
# define CPU_CAPABILITY_3DNOW (1<<4) # define VLC_CPU_3dNOW 16
# define VLC_CPU_MMXEXT 32 # define VLC_CPU_MMXEXT 32
# define VLC_CPU_SSE 64 # define VLC_CPU_SSE 64
# define VLC_CPU_SSE2 128 # define VLC_CPU_SSE2 128
...@@ -103,6 +103,12 @@ VLC_API unsigned vlc_CPU(void); ...@@ -103,6 +103,12 @@ VLC_API unsigned vlc_CPU(void);
# define vlc_CPU_SSE4A() ((vlc_CPU() & VLC_CPU_SSE4A) != 0) # define vlc_CPU_SSE4A() ((vlc_CPU() & VLC_CPU_SSE4A) != 0)
# endif # endif
# ifdef __3dNOW__
# define vlc_CPU_3dNOW() (1)
# else
# define vlc_CPU_3dNOW() ((vlc_CPU() & VLC_CPU_3dNOW) != 0)
# endif
# elif defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__) # elif defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
# define HAVE_FPU 1 # define HAVE_FPU 1
# define VLC_CPU_ALTIVEC 2 # define VLC_CPU_ALTIVEC 2
......
...@@ -335,7 +335,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -335,7 +335,7 @@ static int OpenDecoder( vlc_object_t *p_this )
p_context->dsp_mask |= AV_CPU_FLAG_MMX; p_context->dsp_mask |= AV_CPU_FLAG_MMX;
if( !vlc_CPU_MMXEXT() ) if( !vlc_CPU_MMXEXT() )
p_context->dsp_mask |= AV_CPU_FLAG_MMX2; p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
if( !(vlc_CPU() & CPU_CAPABILITY_3DNOW) ) if( !vlc_CPU_3dNOW() )
p_context->dsp_mask |= AV_CPU_FLAG_3DNOW; p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
if( !vlc_CPU_SSE() ) if( !vlc_CPU_SSE() )
p_context->dsp_mask |= AV_CPU_FLAG_SSE; p_context->dsp_mask |= AV_CPU_FLAG_SSE;
......
...@@ -329,7 +329,7 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -329,7 +329,7 @@ int OpenEncoder( vlc_object_t *p_this )
p_context->dsp_mask |= AV_CPU_FLAG_MMX; p_context->dsp_mask |= AV_CPU_FLAG_MMX;
if( !vlc_CPU_MMXEXT() ) if( !vlc_CPU_MMXEXT() )
p_context->dsp_mask |= AV_CPU_FLAG_MMX2; p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
if( !(vlc_CPU() & CPU_CAPABILITY_3DNOW) ) if( !vlc_CPU_3dNOW() )
p_context->dsp_mask |= AV_CPU_FLAG_3DNOW; p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
if( !vlc_CPU_SSE() ) if( !vlc_CPU_SSE() )
p_context->dsp_mask |= AV_CPU_FLAG_SSE; p_context->dsp_mask |= AV_CPU_FLAG_SSE;
......
...@@ -195,7 +195,7 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -195,7 +195,7 @@ static int OpenDecoder( vlc_object_t *p_this )
unsigned cpu = vlc_CPU(); unsigned cpu = vlc_CPU();
if( vlc_CPU_MMX() ) if( vlc_CPU_MMX() )
i_accel |= MPEG2_ACCEL_X86_MMX; i_accel |= MPEG2_ACCEL_X86_MMX;
if( cpu & CPU_CAPABILITY_3DNOW ) if( vlc_CPU_3dNOW() )
i_accel |= MPEG2_ACCEL_X86_3DNOW; i_accel |= MPEG2_ACCEL_X86_3DNOW;
if( vlc_CPU_MMXEXT() ) if( vlc_CPU_MMXEXT() )
i_accel |= MPEG2_ACCEL_X86_MMXEXT; i_accel |= MPEG2_ACCEL_X86_MMXEXT;
......
...@@ -380,12 +380,11 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) ...@@ -380,12 +380,11 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
/* Set CPU capabilities */ /* Set CPU capabilities */
id->ff_enc_c->dsp_mask = 0; id->ff_enc_c->dsp_mask = 0;
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
unsigned i_cpu = vlc_CPU();
if( !vlc_CPU_MMX() ) if( !vlc_CPU_MMX() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX;
if( !vlc_CPU_MMXEXT() ) if( !vlc_CPU_MMXEXT() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX2; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX2;
if( !(i_cpu & CPU_CAPABILITY_3DNOW) ) if( !vlc_CPU_3dNOW() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_3DNOW; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_3DNOW;
if( !vlc_CPU_SSE() ) if( !vlc_CPU_SSE() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE;
...@@ -801,12 +800,11 @@ static mtime_t VideoCommand( sout_stream_t *p_stream, sout_stream_id_t *id ) ...@@ -801,12 +800,11 @@ static mtime_t VideoCommand( sout_stream_t *p_stream, sout_stream_id_t *id )
/* Set CPU capabilities */ /* Set CPU capabilities */
id->ff_enc_c->dsp_mask = 0; id->ff_enc_c->dsp_mask = 0;
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
unsigned i_cpu = vlc_CPU();
if( !vlc_CPU_MMX() ) if( !vlc_CPU_MMX() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX;
if( !vlc_CPU_MMXEXT() ) if( !vlc_CPU_MMXEXT() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX2; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_MMX2;
if( !(i_cpu & CPU_CAPABILITY_3DNOW) ) if( !vlc_CPU_3dNOW() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_3DNOW; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_3DNOW;
if( !vlc_CPU_SSE() ) if( !vlc_CPU_SSE() )
id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE; id->ff_enc_c->dsp_mask |= AV_CPU_FLAG_SSE;
......
...@@ -649,7 +649,7 @@ int Open( vlc_object_t *p_this ) ...@@ -649,7 +649,7 @@ int Open( vlc_object_t *p_this )
else else
#endif #endif
#if defined(CAN_COMPILE_3DNOW) #if defined(CAN_COMPILE_3DNOW)
if( chroma->pixel_size == 1 && (vlc_CPU() & CPU_CAPABILITY_3DNOW) ) if( chroma->pixel_size == 1 && vlc_CPU_3dNOW() )
{ {
p_sys->pf_merge = Merge3DNow; p_sys->pf_merge = Merge3DNow;
p_sys->pf_end_merge = End3DNow; p_sys->pf_end_merge = End3DNow;
......
...@@ -138,7 +138,7 @@ static int OpenPostproc( vlc_object_t *p_this ) ...@@ -138,7 +138,7 @@ static int OpenPostproc( vlc_object_t *p_this )
i_flags |= PP_CPU_CAPS_MMX; i_flags |= PP_CPU_CAPS_MMX;
if( vlc_CPU_MMXEXT() ) if( vlc_CPU_MMXEXT() )
i_flags |= PP_CPU_CAPS_MMX2; i_flags |= PP_CPU_CAPS_MMX2;
if( vlc_CPU() & CPU_CAPABILITY_3DNOW ) if( vlc_CPU_3dNOW() )
i_flags |= PP_CPU_CAPS_3DNOW; i_flags |= PP_CPU_CAPS_3DNOW;
#elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__) #elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__)
if( vlc_CPU_ALTIVEC() ) if( vlc_CPU_ALTIVEC() )
......
...@@ -238,7 +238,7 @@ static int GetSwsCpuMask(void) ...@@ -238,7 +238,7 @@ static int GetSwsCpuMask(void)
if( vlc_CPU_MMXEXT() ) if( vlc_CPU_MMXEXT() )
i_sws_cpu |= SWS_CPU_CAPS_MMX2; i_sws_cpu |= SWS_CPU_CAPS_MMX2;
#endif #endif
if( vlc_CPU() & CPU_CAPABILITY_3DNOW ) if( vlc_CPU_3dNOW() )
i_sws_cpu |= SWS_CPU_CAPS_3DNOW; i_sws_cpu |= SWS_CPU_CAPS_3DNOW;
#elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__) #elif defined(__ppc__) || defined(__ppc64__) || defined(__powerpc__)
if( vlc_CPU_ALTIVEC() ) if( vlc_CPU_ALTIVEC() )
......
...@@ -266,9 +266,7 @@ void vlc_CPU_init (void) ...@@ -266,9 +266,7 @@ void vlc_CPU_init (void)
/* list these additional capabilities */ /* list these additional capabilities */
cpuid( 0x80000001 ); cpuid( 0x80000001 );
# if defined (__3dNOW__) # if defined (CAN_COMPILE_3DNOW)
i_capabilities |= CPU_CAPABILITY_3DNOW;
# elif defined (CAN_COMPILE_3DNOW)
if ((i_edx & 0x80000000) && vlc_CPU_check ("3D Now!", ThreeD_Now_test)) if ((i_edx & 0x80000000) && vlc_CPU_check ("3D Now!", ThreeD_Now_test))
i_capabilities |= CPU_CAPABILITY_3DNOW; i_capabilities |= CPU_CAPABILITY_3DNOW;
# endif # endif
...@@ -330,11 +328,6 @@ void vlc_CPU_dump (vlc_object_t *obj) ...@@ -330,11 +328,6 @@ void vlc_CPU_dump (vlc_object_t *obj)
char buf[200], *p = buf; char buf[200], *p = buf;
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
const unsigned flags = vlc_CPU();
#define PRINT_CAPABILITY( capability, string ) \
if (flags & (capability)) \
p += sprintf (p, "%s ", (string) )
if (vlc_CPU_MMX()) p += sprintf (p, "MMX "); if (vlc_CPU_MMX()) p += sprintf (p, "MMX ");
if (vlc_CPU_MMXEXT()) p += sprintf (p, "MMXEXT "); if (vlc_CPU_MMXEXT()) p += sprintf (p, "MMXEXT ");
if (vlc_CPU_SSE()) p += sprintf (p, "SSE ");; if (vlc_CPU_SSE()) p += sprintf (p, "SSE ");;
...@@ -344,7 +337,7 @@ void vlc_CPU_dump (vlc_object_t *obj) ...@@ -344,7 +337,7 @@ void vlc_CPU_dump (vlc_object_t *obj)
if (vlc_CPU_SSE4_1()) p += sprintf (p, "SSE4.1 ");; if (vlc_CPU_SSE4_1()) p += sprintf (p, "SSE4.1 ");;
if (vlc_CPU_SSE4_2()) p += sprintf (p, "SSE4.2 ");; if (vlc_CPU_SSE4_2()) p += sprintf (p, "SSE4.2 ");;
if (vlc_CPU_SSE4A()) p += sprintf (p, "SSE4A ");; if (vlc_CPU_SSE4A()) p += sprintf (p, "SSE4A ");;
PRINT_CAPABILITY(CPU_CAPABILITY_3DNOW, "3DNow!"); if (vlc_CPU_3dNOW()) p += sprintf (p, "3DNow! ");;
#elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__) #elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__)
if (vlc_CPU_ALTIVEC()) p += sprintf (p, "AltiVec"); if (vlc_CPU_ALTIVEC()) p += sprintf (p, "AltiVec");
......
...@@ -85,10 +85,8 @@ static void vlc_CPU_init (void) ...@@ -85,10 +85,8 @@ static void vlc_CPU_init (void)
core_caps |= VLC_CPU_SSE4_1; core_caps |= VLC_CPU_SSE4_1;
if (!strcmp (cap, "sse4a")) if (!strcmp (cap, "sse4a"))
core_caps |= VLC_CPU_SSE4A; core_caps |= VLC_CPU_SSE4A;
# ifndef __3dNOW__
if (!strcmp (cap, "3dnow")) if (!strcmp (cap, "3dnow"))
core_caps |= CPU_CAPABILITY_3DNOW; core_caps |= VLC_CPU_3dNOW;
# endif
#elif defined (__powerpc__) || defined (__powerpc64__) #elif defined (__powerpc__) || defined (__powerpc64__)
if (!strcmp (cap, "altivec supported")) if (!strcmp (cap, "altivec supported"))
...@@ -105,13 +103,6 @@ static void vlc_CPU_init (void) ...@@ -105,13 +103,6 @@ static void vlc_CPU_init (void)
if (all_caps == 0xFFFFFFFF) /* Error parsing of cpuinfo? */ if (all_caps == 0xFFFFFFFF) /* Error parsing of cpuinfo? */
all_caps = 0; /* Do not assume any capability! */ all_caps = 0; /* Do not assume any capability! */
/* Always enable capabilities that were forced during compilation */
#if defined (__i386__) || defined (__x86_64__)
# ifdef __3dNOW__
all_caps |= CPU_CAPABILITY_3DNOW;
# endif
#endif
cpu_flags = all_caps; cpu_flags = all_caps;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment