[x264-devel] ppc: Add detection of AltiVec support for FreeBSD

Anton Mitrofanov git at videolan.org
Sun Oct 11 19:01:09 CEST 2015


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Thu Oct  1 01:02:16 2015 +0300| [75992107adcc8317ba2888e3957a7d56f16b5cd4] | committer: Henrik Gramner

ppc: Add detection of AltiVec support for FreeBSD

Patch from FreeBSD ports.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=75992107adcc8317ba2888e3957a7d56f16b5cd4
---

 common/cpu.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/cpu.c b/common/cpu.c
index e311bab..4423144 100644
--- a/common/cpu.c
+++ b/common/cpu.c
@@ -318,7 +318,7 @@ uint32_t x264_cpu_detect( void )
 
 #elif ARCH_PPC
 
-#if SYS_MACOSX || SYS_OPENBSD
+#if SYS_MACOSX || SYS_OPENBSD || SYS_FREEBSD
 #include <sys/sysctl.h>
 uint32_t x264_cpu_detect( void )
 {
@@ -326,12 +326,16 @@ uint32_t x264_cpu_detect( void )
     uint32_t cpu = 0;
 #if SYS_OPENBSD
     int      selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
-#else
+#elif SYS_MACOSX
     int      selectors[2] = { CTL_HW, HW_VECTORUNIT };
 #endif
     int      has_altivec = 0;
     size_t   length = sizeof( has_altivec );
+#if SYS_MACOSX || SYS_OPENBSD
     int      error = sysctl( selectors, 2, &has_altivec, &length, NULL, 0 );
+#else
+    int      error = sysctlbyname( "hw.altivec", &has_altivec, &length, NULL, 0 );
+#endif
 
     if( error == 0 && has_altivec != 0 )
         cpu |= X264_CPU_ALTIVEC;



More information about the x264-devel mailing list