[MPlayer-dev-eng] [PATCH] Solaris support for SSE(2) autodetection

Milan Jurik milan.jurik at xylab.cz
Sun Sep 14 14:52:07 CEST 2008


Hi,

I never contributed here yet, so if I'm doing something wrong, then I'm 
sorry. Here is small patch for cpudetect.c, to support SSE/SSE2 
autodetection:


--- mplayer/cpudetect.c Sun Sep 14 11:31:53 2008
+++ mplayer-fixed/cpudetect.c   Sun Sep 14 11:43:17 2008
@@ -29,6 +29,10 @@
 #include <signal.h>
 #endif
 
+#ifdef __sun
+#include <sys/auxv.h>
+#endif
+
 #ifdef WIN32
 #include <windows.h>
 #endif
@@ -187,7 +191,7 @@
 #if defined(__linux__) || defined(__FreeBSD__) || 
defined(__FreeBSD_kernel__) \
   || defined(__NetBSD__) || defined(__OpenBSD__) || 
defined(__DragonFly__) \
   || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) \
-  || defined(__OS2__)
+  || defined(__OS2__) || defined(__sun)
                if (caps->hasSSE)
                        check_os_katmai_support();
                if (!caps->hasSSE)
@@ -363,6 +367,29 @@
 #ifdef ARCH_X86_64
    gCpuCaps.hasSSE=1;
    gCpuCaps.hasSSE2=1;
+#elif defined(__sun)
+   uint_t ui;
+
+   mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+
+   (void) getisax(&ui, 1);
+
+   if (ui & AV_386_SSE) {
+      gCpuCaps.hasSSE = 1;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
+   } else {
+      gCpuCaps.hasSSE = 0;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+   }
+
+   mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE2... " );
+   if (ui & AV_386_SSE2) {
+      gCpuCaps.hasSSE2 = 1;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
+   } else {
+      gCpuCaps.hasSSE2 = 0;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+   }
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || 
defined(__DragonFly__) || defined(__APPLE__)
    int has_sse=0, ret;
    size_t len=sizeof(has_sse);



Best regards,

Milan



More information about the MPlayer-dev-eng mailing list