[MPlayer-dev-eng] [PATCH] PowerPC AltiVec detection support for OpenBSD

Brad brad at comstyle.com
Sat Apr 9 21:24:07 CEST 2011


The following diff allows the CPU detection code to use the sysctl(3) OpenBSD provides
for AltiVec detection with PowerPC CPUs.


Index: cpudetect.c
===================================================================
--- cpudetect.c	(revision 33237)
+++ cpudetect.c	(working copy)
@@ -419,6 +419,10 @@
 
 #ifdef __APPLE__
 #include <sys/sysctl.h>
+#elif defined(__OpenBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
 #elif defined(__AMIGAOS4__)
 /* nothing */
 #else
@@ -457,13 +461,17 @@
     caps->isX86=0;
     caps->hasAltiVec = 0;
 #if HAVE_ALTIVEC
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__OpenBSD__)
 /*
   rip-off from ffmpeg altivec detection code.
   this code also appears on Apple's AltiVec pages.
  */
     {
+#ifdef __OpenBSD__
+        int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
+#else
         int sels[2] = {CTL_HW, HW_VECTORUNIT};
+#endif
         int has_vu = 0;
         size_t len = sizeof(has_vu);
         int err;

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.



More information about the MPlayer-dev-eng mailing list