Commit ceb2efd4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

SSE3 detection (runtime)

Isn't fork() supposed to be slow on Windows?
parent 8146a7f0
......@@ -1009,6 +1009,12 @@ static const char *const ppsz_clock_descriptions[] =
"If your processor supports the SSE2 instructions set, VLC can take " \
"advantage of them.")
#define SSE3_TEXT N_("Enable CPU SSE3 support")
#define SSE3_LONGTEXT N_( \
"If your processor supports the SSE3 instructions set, VLC can take " \
"advantage of them.")
#define ALTIVEC_TEXT N_("Enable CPU AltiVec support")
#define ALTIVEC_LONGTEXT N_( \
"If your processor supports the AltiVec instructions set, VLC can take " \
......@@ -1927,6 +1933,8 @@ vlc_module_begin ()
change_need_restart ()
add_bool( "sse2", 1, NULL, SSE2_TEXT, SSE2_LONGTEXT, true )
change_need_restart ()
add_bool( "sse3", 1, NULL, SSE3_TEXT, SSE3_LONGTEXT, true )
change_need_restart ()
#endif
#if defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
add_bool( "altivec", 1, NULL, ALTIVEC_TEXT, ALTIVEC_LONGTEXT, true )
......
......@@ -761,12 +761,15 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
cpu_flags &= ~CPU_CAPABILITY_SSE;
if( !config_GetInt( p_libvlc, "sse2" ) )
cpu_flags &= ~CPU_CAPABILITY_SSE2;
if( !config_GetInt( p_libvlc, "sse3" ) )
cpu_flags &= ~CPU_CAPABILITY_SSE3;
PRINT_CAPABILITY( CPU_CAPABILITY_MMX, "MMX" );
PRINT_CAPABILITY( CPU_CAPABILITY_3DNOW, "3DNow!" );
PRINT_CAPABILITY( CPU_CAPABILITY_MMXEXT, "MMXEXT" );
PRINT_CAPABILITY( CPU_CAPABILITY_SSE, "SSE" );
PRINT_CAPABILITY( CPU_CAPABILITY_SSE2, "SSE2" );
PRINT_CAPABILITY( CPU_CAPABILITY_SSE3, "SSE3" );
#elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )
if( !config_GetInt( p_libvlc, "altivec" ) )
......
......@@ -201,6 +201,24 @@ uint32_t CPUCapabilities( void )
}
# endif
# if defined (__SSE3__)
i_capabilities |= CPU_CAPABILITY_SSE3;
# elif defined (CAN_COMPILE_SSE3)
if( i_ecx & 0x00000001 )
{
/* We test if OS supports the SSE3 instructions */
pid_t pid = fork();
if( pid == 0 )
{
/* Test a SSE3 instruction */
__asm__ __volatile__ ( "movsldup %%xmm1, %%xmm0\n" : : );
exit(0);
}
if( check_OS_capability( "SSE3", pid ) )
i_capabilities |= CPU_CAPABILITY_SSE3;
}
# endif
/* test for additional capabilities */
cpuid( 0x80000000 );
......
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