Fixed bug 1434 - Add AltiVec detection for OpenBSD/powerpc
Brad Smith 2012-02-29 19:31:46 PST The attached patch adds AltiVec detection for OpenBSD/powerpc. Please apply the patch to both 2.0 and 1.2.
This commit is contained in:
parent
529470a6c5
commit
9844cacdd7
1 changed files with 10 additions and 2 deletions
|
@ -33,6 +33,10 @@
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
|
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
|
||||||
#include <sys/sysctl.h> /* For AltiVec check */
|
#include <sys/sysctl.h> /* For AltiVec check */
|
||||||
|
#elif defined(__OpenBSD__) && defined(__powerpc__)
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/sysctl.h> /* For AltiVec check */
|
||||||
|
#include <machine/cpu.h>
|
||||||
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
|
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
@ -51,7 +55,7 @@
|
||||||
#define CPU_HAS_SSE41 0x00000100
|
#define CPU_HAS_SSE41 0x00000100
|
||||||
#define CPU_HAS_SSE42 0x00000200
|
#define CPU_HAS_SSE42 0x00000200
|
||||||
|
|
||||||
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__
|
#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__
|
||||||
/* This is the brute force way of detecting instruction sets...
|
/* This is the brute force way of detecting instruction sets...
|
||||||
the idea is borrowed from the libmpeg2 library - thanks!
|
the idea is borrowed from the libmpeg2 library - thanks!
|
||||||
*/
|
*/
|
||||||
|
@ -214,8 +218,12 @@ static __inline__ int
|
||||||
CPU_haveAltiVec(void)
|
CPU_haveAltiVec(void)
|
||||||
{
|
{
|
||||||
volatile int altivec = 0;
|
volatile int altivec = 0;
|
||||||
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
|
#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
|
||||||
|
#else
|
||||||
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
|
int selectors[2] = { CTL_HW, HW_VECTORUNIT };
|
||||||
|
#endif
|
||||||
int hasVectorUnit = 0;
|
int hasVectorUnit = 0;
|
||||||
size_t length = sizeof(hasVectorUnit);
|
size_t length = sizeof(hasVectorUnit);
|
||||||
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
|
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue