From: Brad Smith Date: Sat, 31 Jul 2010 09:07:02 +0000 (-0400) Subject: Add support for AltiVec detection for OpenBSD/PowerPC. X-Git-Tag: pixman-0.19.2~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb50e9cc95a780a5e60d557f2aa23d82d2280b73;p=platform%2Fupstream%2Fpixman.git Add support for AltiVec detection for OpenBSD/PowerPC. Bug 29331. --- diff --git a/pixman/pixman-cpu.c b/pixman/pixman-cpu.c index e96b140..1b31885 100644 --- a/pixman/pixman-cpu.c +++ b/pixman/pixman-cpu.c @@ -61,6 +61,29 @@ pixman_have_vmx (void) return have_vmx; } +#elif defined (__OpenBSD__) +#include +#include +#include + +static pixman_bool_t +pixman_have_vmx (void) +{ + if (!initialized) + { + int mib[2] = { CTL_MACHDEP, CPU_ALTIVEC }; + size_t length = sizeof(have_vmx); + int error = + sysctl (&mib, 2, &have_vmx, &length, NULL, 0); + + if (error) + have_vmx = FALSE; + + initialized = TRUE; + } + return have_vmx; +} + #elif defined (__linux__) #include #include @@ -123,7 +146,7 @@ pixman_have_vmx (void) return have_vmx; } -#else /* !__APPLE__ && !__linux__ */ +#else /* !__APPLE__ && !__OpenBSD__ && !__linux__ */ #include #include