<div>j-b,</div><div><br></div>Whether or not fork() is slow - it probably shouldn't matter since it should only be called once to initialize the CPU capabilities, but can't you use cpuid for this?<div><br></div><div>
However, I'm not sure this line is correct: </div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">+# if defined (__SSE3__)</span></div>
<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">+    i_capabilities |= CPU_CAPABILITY_SSE3;</span><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>
</span></font></div><div><span class="Apple-style-span" style="font-size: 13px; "></span><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">__SSE3__ is defined with -msse3 is passed in to gcc whether or not the processor supports it, therefore you should still do the same check.</span></font></div>
<div><div><br></div><div><br><br><div class="gmail_quote">On Tue, Sep 22, 2009 at 4:49 PM, git version control <span dir="ltr"><<a href="mailto:git@videolan.org">git@videolan.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
vlc | branch: master | Jean-Baptiste Kempf <<a href="mailto:jb@videolan.org">jb@videolan.org</a>> | Tue Sep 22 19:34:00 2009 +0200| [ceb2efd46999603aa75a59201b4e869d9c36e458] | committer: Jean-Baptiste Kempf<br>
<br>
SSE3 detection (runtime)<br>
<br>
Isn't fork() supposed to be slow on Windows?<br>
<br>
> <a href="http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ceb2efd46999603aa75a59201b4e869d9c36e458" target="_blank">http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ceb2efd46999603aa75a59201b4e869d9c36e458</a><br>

---<br>
<br>
 src/libvlc-module.c |    8 ++++++++<br>
 src/libvlc.c        |    3 +++<br>
 src/misc/cpu.c      |   18 ++++++++++++++++++<br>
 3 files changed, 29 insertions(+), 0 deletions(-)<br>
<br>
diff --git a/src/libvlc-module.c b/src/libvlc-module.c<br>
index d92e614..18cefcd 100644<br>
--- a/src/libvlc-module.c<br>
+++ b/src/libvlc-module.c<br>
@@ -1009,6 +1009,12 @@ static const char *const ppsz_clock_descriptions[] =<br>
     "If your processor supports the SSE2 instructions set, VLC can take " \<br>
     "advantage of them.")<br>
<br>
+#define SSE3_TEXT N_("Enable CPU SSE3 support")<br>
+#define SSE3_LONGTEXT N_( \<br>
+    "If your processor supports the SSE3 instructions set, VLC can take " \<br>
+    "advantage of them.")<br>
+<br>
+<br>
 #define ALTIVEC_TEXT N_("Enable CPU AltiVec support")<br>
 #define ALTIVEC_LONGTEXT N_( \<br>
     "If your processor supports the AltiVec instructions set, VLC can take " \<br>
@@ -1927,6 +1933,8 @@ vlc_module_begin ()<br>
         change_need_restart ()<br>
     add_bool( "sse2", 1, NULL, SSE2_TEXT, SSE2_LONGTEXT, true )<br>
         change_need_restart ()<br>
+    add_bool( "sse3", 1, NULL, SSE3_TEXT, SSE3_LONGTEXT, true )<br>
+        change_need_restart ()<br>
 #endif<br>
 #if defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )<br>
     add_bool( "altivec", 1, NULL, ALTIVEC_TEXT, ALTIVEC_LONGTEXT, true )<br>
diff --git a/src/libvlc.c b/src/libvlc.c<br>
index 97755fd..a1784b1 100644<br>
--- a/src/libvlc.c<br>
+++ b/src/libvlc.c<br>
@@ -761,12 +761,15 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,<br>
         cpu_flags &= ~CPU_CAPABILITY_SSE;<br>
     if( !config_GetInt( p_libvlc, "sse2" ) )<br>
         cpu_flags &= ~CPU_CAPABILITY_SSE2;<br>
+    if( !config_GetInt( p_libvlc, "sse3" ) )<br>
+        cpu_flags &= ~CPU_CAPABILITY_SSE3;<br>
<br>
     PRINT_CAPABILITY( CPU_CAPABILITY_MMX, "MMX" );<br>
     PRINT_CAPABILITY( CPU_CAPABILITY_3DNOW, "3DNow!" );<br>
     PRINT_CAPABILITY( CPU_CAPABILITY_MMXEXT, "MMXEXT" );<br>
     PRINT_CAPABILITY( CPU_CAPABILITY_SSE, "SSE" );<br>
     PRINT_CAPABILITY( CPU_CAPABILITY_SSE2, "SSE2" );<br>
+    PRINT_CAPABILITY( CPU_CAPABILITY_SSE3, "SSE3" );<br>
<br>
 #elif defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc64__ )<br>
     if( !config_GetInt( p_libvlc, "altivec" ) )<br>
diff --git a/src/misc/cpu.c b/src/misc/cpu.c<br>
index 615484c..9ca2ab8 100644<br>
--- a/src/misc/cpu.c<br>
+++ b/src/misc/cpu.c<br>
@@ -201,6 +201,24 @@ uint32_t CPUCapabilities( void )<br>
     }<br>
 # endif<br>
<br>
+# if defined (__SSE3__)<br>
+    i_capabilities |= CPU_CAPABILITY_SSE3;<br>
+# elif defined (CAN_COMPILE_SSE3)<br>
+    if( i_ecx & 0x00000001 )<br>
+    {<br>
+        /* We test if OS supports the SSE3 instructions */<br>
+        pid_t pid = fork();<br>
+        if( pid == 0 )<br>
+        {<br>
+            /* Test a SSE3 instruction */<br>
+            __asm__ __volatile__ ( "movsldup %%xmm1, %%xmm0\n" : : );<br>
+            exit(0);<br>
+        }<br>
+        if( check_OS_capability( "SSE3", pid ) )<br>
+            i_capabilities |= CPU_CAPABILITY_SSE3;<br>
+    }<br>
+# endif<br>
+<br>
     /* test for additional capabilities */<br>
     cpuid( 0x80000000 );<br>
<br>
<br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br>
</blockquote></div><br></div></div>