xf86-video-intel: src/sna/sna_cpu.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Mar 26 08:46:53 PDT 2013
src/sna/sna_cpu.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 9620f419076202ebc89b4c7f1c06374fb2554f28
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Mar 26 15:44:42 2013 +0000
sna: Fix AVX2 detection
It requires use of the cpuid feature eax=7:ecx=0, so it requires the
extended version of __cpuid to pass in the subfeature.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_cpu.c b/src/sna/sna_cpu.c
index 1386988..ab4942b 100644
--- a/src/sna/sna_cpu.c
+++ b/src/sna/sna_cpu.c
@@ -41,10 +41,12 @@
unsigned sna_cpu_detect(void)
{
+ unsigned max = __get_cpuid_max(false, 0);
unsigned int eax, ebx, ecx, edx;
unsigned features = 0;
- if (__get_cpuid(1, &eax, &ebx, &ecx, &edx)) {
+ if (max >= 1) {
+ __cpuid(1, eax, ebx, ecx, edx);
if (ecx & bit_SSE3)
features |= SSE3;
@@ -70,7 +72,8 @@ unsigned sna_cpu_detect(void)
features |= SSE2;
}
- if (__get_cpuid(7, &eax, &ebx, &ecx, &edx)) {
+ if (max >= 7) {
+ __cpuid_count(7, 0, eax, ebx, ecx, edx);
if (ebx & bit_AVX2)
features |= AVX2;
}
More information about the xorg-commit
mailing list