Detect CPU features and install optimized transform and lighting routines. Currently, CPU features are only detected. The optimized routines have yet to be written.
- Bug:
- This routine is highly specific to Linux kernel 2.6. I'm still waiting to hear back from the glibc folk on how to do this "right".
Definition at line 56 of file common_ppc.c.
Referenced by _math_init_transformation().
{
#ifdef USE_PPC_ASM
const pid_t my_pid = getpid();
char file_name[32];
FILE * f;
#ifdef __powerpc64__
Elf64_auxv_t v;
#else
Elf32_auxv_t v;
#endif
sprintf( file_name, "/proc/%u/auxv", (unsigned) my_pid );
f = fopen( file_name, "rb" );
if ( f != NULL ) {
while( 1 ) {
ssize_t elem = fread( & v, sizeof( v ), 1, f );
if ( elem < 1 ) {
break;
}
if ( v.a_type == AT_HWCAP ) {
_mesa_ppc_cpu_features = v.a_un.a_val;
break;
}
}
fclose( f );
}
# ifndef USE_VMX_ASM
_mesa_ppc_cpu_features &= ~PPC_FEATURES_HAS_ALTIVEC;
# endif
#endif
}