aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/x86
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-05-23 19:36:09 +0200
committermarha <marha@users.sourceforge.net>2014-05-23 19:38:24 +0200
commit63bfcd0be46413dda8c22b914d12f66ea5d5c66d (patch)
tree252bfea78ff3ccfabedc3b84c8a7331c74e902cd /mesalib/src/mesa/x86
parent55cf29d7f748b814a2b8eb016fbf15635d56aa53 (diff)
downloadvcxsrv-63bfcd0be46413dda8c22b914d12f66ea5d5c66d.tar.gz
vcxsrv-63bfcd0be46413dda8c22b914d12f66ea5d5c66d.tar.bz2
vcxsrv-63bfcd0be46413dda8c22b914d12f66ea5d5c66d.zip
libX11 mesa xserver pixman git update 23 May 2014
xserver commit db2e708f31a162c6c66643d3559dd5f3e21ee06b libX11 commit e3dc0d17339e61eaf0b51b8907510984e3bf23cb pixman commit 9cd283b2eb8279824406bfd47b020d21fc00cf82 mesa commit 404387ecd72a4a9ace8c1fa6895823aabfd759ad
Diffstat (limited to 'mesalib/src/mesa/x86')
-rw-r--r--mesalib/src/mesa/x86/common_x86.c25
-rw-r--r--mesalib/src/mesa/x86/common_x86_features.h4
2 files changed, 27 insertions, 2 deletions
diff --git a/mesalib/src/mesa/x86/common_x86.c b/mesalib/src/mesa/x86/common_x86.c
index 3c1adc916..261f49170 100644
--- a/mesalib/src/mesa/x86/common_x86.c
+++ b/mesalib/src/mesa/x86/common_x86.c
@@ -47,6 +47,13 @@
#include <sys/sysctl.h>
#include <machine/cpu.h>
#endif
+#if defined(USE_X86_64_ASM)
+#include <cpuid.h>
+#if !defined(bit_SSE4_1) && defined(bit_SSE41)
+/* XXX: clang defines bit_SSE41 instead of bit_SSE4_1 */
+#define bit_SSE4_1 bit_SSE41
+#endif
+#endif
#include "main/imports.h"
#include "common_x86_asm.h"
@@ -223,7 +230,7 @@ _mesa_get_x86_features(void)
_mesa_debug(NULL, "CPUID not detected\n");
}
else {
- GLuint cpu_features;
+ GLuint cpu_features, cpu_features_ecx;
GLuint cpu_ext_features;
GLuint cpu_ext_info;
char cpu_vendor[13];
@@ -238,6 +245,7 @@ _mesa_get_x86_features(void)
/* get cpu features */
cpu_features = _mesa_x86_cpuid_edx(1);
+ cpu_features_ecx = _mesa_x86_cpuid_ecx(1);
if (cpu_features & X86_CPU_FPU)
_mesa_x86_cpu_features |= X86_FEATURE_FPU;
@@ -254,6 +262,8 @@ _mesa_get_x86_features(void)
_mesa_x86_cpu_features |= X86_FEATURE_XMM;
if (cpu_features & X86_CPU_XMM2)
_mesa_x86_cpu_features |= X86_FEATURE_XMM2;
+ if (cpu_features_ecx & X86_CPU_SSE4_1)
+ _mesa_x86_cpu_features |= X86_FEATURE_SSE4_1;
#endif
/* query extended cpu features */
@@ -330,7 +340,18 @@ _mesa_get_x86_features(void)
}
#endif
-#endif /* USE_X86_ASM */
+#elif defined(USE_X86_64_ASM)
+ 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_64_ASM */
(void) detection_debug;
}
diff --git a/mesalib/src/mesa/x86/common_x86_features.h b/mesalib/src/mesa/x86/common_x86_features.h
index 862548440..66f2cf651 100644
--- a/mesalib/src/mesa/x86/common_x86_features.h
+++ b/mesalib/src/mesa/x86/common_x86_features.h
@@ -43,6 +43,7 @@
#define X86_FEATURE_XMM2 (1<<6)
#define X86_FEATURE_3DNOWEXT (1<<7)
#define X86_FEATURE_3DNOW (1<<8)
+#define X86_FEATURE_SSE4_1 (1<<9)
/* standard X86 CPU features */
#define X86_CPU_FPU (1<<0)
@@ -50,6 +51,8 @@
#define X86_CPU_MMX (1<<23)
#define X86_CPU_XMM (1<<25)
#define X86_CPU_XMM2 (1<<26)
+/* ECX. */
+#define X86_CPU_SSE4_1 (1<<19)
/* extended X86 CPU features */
#define X86_CPUEXT_MMX_EXT (1<<22)
@@ -62,6 +65,7 @@
#define cpu_has_xmm2 (_mesa_x86_cpu_features & X86_FEATURE_XMM2)
#define cpu_has_3dnow (_mesa_x86_cpu_features & X86_FEATURE_3DNOW)
#define cpu_has_3dnowext (_mesa_x86_cpu_features & X86_FEATURE_3DNOWEXT)
+#define cpu_has_sse4_1 (_mesa_x86_cpu_features & X86_FEATURE_SSE4_1)
#endif