summaryrefslogtreecommitdiffstats
path: root/cpudetect.c
diff options
context:
space:
mode:
authornplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-10-05 00:12:04 +0000
committernplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-10-05 00:12:04 +0000
commita99eefdfefe6a8220497c908329149b82ff32d66 (patch)
treec9fe031767a02de28572a2cf091054849bfa24f3 /cpudetect.c
parent9c19753fcce2fc49f78df518138dcff84ab6e00a (diff)
downloadmpv-a99eefdfefe6a8220497c908329149b82ff32d66.tar.bz2
mpv-a99eefdfefe6a8220497c908329149b82ff32d66.tar.xz
Detect sse/2 on intel mac, Valtteri Vuorikoski(vuori@sci.fi)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20058 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'cpudetect.c')
-rw-r--r--cpudetect.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cpudetect.c b/cpudetect.c
index 5bb10ac4d6..7003c572c6 100644
--- a/cpudetect.c
+++ b/cpudetect.c
@@ -182,7 +182,7 @@ void GetCpuCaps( CpuCaps *caps)
#endif
/* FIXME: Does SSE2 need more OS support, too? */
-#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
if (caps->hasSSE)
check_os_katmai_support();
if (!caps->hasSSE)
@@ -345,16 +345,23 @@ LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
* and RedHat patched 2.2 kernels that have broken exception handling
* support for user space apps that do SSE.
*/
+
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#define SSE_SYSCTL_NAME "hw.instruction_sse"
+#elif defined(__APPLE__)
+#define SSE_SYSCTL_NAME "hw.optional.sse"
+#endif
+
static void check_os_katmai_support( void )
{
#ifdef ARCH_X86_64
gCpuCaps.hasSSE=1;
gCpuCaps.hasSSE2=1;
-#elif defined(__FreeBSD__) || defined(__DragonFly__)
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
int has_sse=0, ret;
size_t len=sizeof(has_sse);
- ret = sysctlbyname("hw.instruction_sse", &has_sse, &len, NULL, 0);
+ ret = sysctlbyname(SSE_SYSCTL_NAME, &has_sse, &len, NULL, 0);
if (ret || !has_sse)
gCpuCaps.hasSSE=0;