aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/gallium
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-07-25 09:24:55 +0200
committermarha <marha@users.sourceforge.net>2013-07-25 09:24:55 +0200
commitaf62a89a4e677bc0a10094be86816b2e273b2c4a (patch)
tree3cceb0e23b7ab79dbcedb27c5546cf2666c1c7a0 /mesalib/src/gallium
parentde54c5b749b3eefb75d420840c889533a58aa342 (diff)
parentacf3535c75d7c79154b6b89c66567317944d244c (diff)
downloadvcxsrv-af62a89a4e677bc0a10094be86816b2e273b2c4a.tar.gz
vcxsrv-af62a89a4e677bc0a10094be86816b2e273b2c4a.tar.bz2
vcxsrv-af62a89a4e677bc0a10094be86816b2e273b2c4a.zip
Merge remote-tracking branch 'origin/released'
* origin/released: xserver mesa git update 25 Jul 2013 Conflicts: xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c
Diffstat (limited to 'mesalib/src/gallium')
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_cpu_detect.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c
index b118fc8ae..588fc7c72 100644
--- a/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c
+++ b/mesalib/src/gallium/auxiliary/util/u_cpu_detect.c
@@ -67,7 +67,7 @@
#if defined(PIPE_OS_WINDOWS)
#include <windows.h>
-#if defined(MSVC)
+#if defined(PIPE_CC_MSVC)
#include <intrin.h>
#endif
#endif
@@ -211,6 +211,27 @@ cpuid(uint32_t ax, uint32_t *p)
p[3] = 0;
#endif
}
+
+static INLINE uint64_t xgetbv(void)
+{
+#if defined(PIPE_CC_GCC)
+ uint32_t eax, edx;
+
+ __asm __volatile (
+ ".byte 0x0f, 0x01, 0xd0" // xgetbv isn't supported on gcc < 4.4
+ : "=a"(eax),
+ "=d"(edx)
+ : "c"(0)
+ );
+
+ return ((uint64_t)edx << 32) | eax;
+#elif defined(PIPE_CC_MSVC) && defined(_MSC_FULL_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
+ return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
+#else
+ return 0;
+#endif
+
+}
#endif /* X86 or X86_64 */
void
@@ -284,7 +305,9 @@ util_cpu_detect(void)
util_cpu_caps.has_sse4_1 = (regs2[2] >> 19) & 1;
util_cpu_caps.has_sse4_2 = (regs2[2] >> 20) & 1;
util_cpu_caps.has_popcnt = (regs2[2] >> 23) & 1;
- util_cpu_caps.has_avx = (regs2[2] >> 28) & 1;
+ util_cpu_caps.has_avx = ((regs2[2] >> 28) & 1) && // AVX
+ ((regs2[2] >> 27) & 1) && // OSXSAVE
+ ((xgetbv() & 6) == 6); // XMM & YMM
util_cpu_caps.has_f16c = (regs2[2] >> 29) & 1;
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */