Uses the cpuid.h header provided by gcc and clang. Other platforms are encouraged to switch. --- src/mesa/main/cpuinfo.c | 2 +- src/mesa/main/cpuinfo.h | 2 +- src/mesa/x86/common_x86.c | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c index 8d482a6..d017598 100644 --- a/src/mesa/main/cpuinfo.c +++ b/src/mesa/main/cpuinfo.c @@ -34,7 +34,7 @@ void _mesa_get_cpu_features(void) { -#ifdef USE_X86_ASM +#if defined USE_X86_ASM || defined __x86_64__ _mesa_get_x86_features(); #endif } diff --git a/src/mesa/main/cpuinfo.h b/src/mesa/main/cpuinfo.h index 3678889..6fd32ad 100644 --- a/src/mesa/main/cpuinfo.h +++ b/src/mesa/main/cpuinfo.h @@ -27,7 +27,7 @@ #define CPUINFO_H -#if defined(USE_X86_ASM) +#if defined(USE_X86_ASM) || defined(__x86_64__) #include "x86/common_x86_asm.h" #endif diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 87fa68a..672226d 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -47,6 +47,9 @@ #include <sys/sysctl.h> #include <machine/cpu.h> #endif +#if defined(__x86_64__) +#include <cpuid.h> +#endif #include "main/imports.h" #include "common_x86_asm.h" @@ -333,6 +336,17 @@ _mesa_get_x86_features(void) } #endif +#elif defined __x86_64__ + unsigned int uninitialized_var(eax), uninitialized_var(ebx), + uninitialized_var(ecx), uninitialized_var(edx); + + /* Always available on x86-64. */ + _mesa_x86_cpu_features |= X86_FEATURE_XMM | X86_FEATURE_XMM2; + + __get_cpuid(1, &eax, &ebx, &ecx, &edx); + + if (ecx & bit_SSE4_1) + _mesa_x86_cpu_features |= X86_FEATURE_SSE4_1; #endif /* USE_X86_ASM */ (void) detection_debug; -- 1.8.3.2 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev