summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorL. E. Segovia <amy@centricular.com>2024-02-24 12:20:01 +0000
committerL. E. Segovia <amy@centricular.com>2024-02-24 12:20:01 +0000
commit93587883f6aaa7f6ec034ddc7a01faf961e9ed6a (patch)
treebd4a02e7bca8931b8eea681cabe454767ee1ce73
parent5967409ba5916199ba846e2e4eb59ef1cad6af27 (diff)
x86: account for XSAVE when checking for AVX support
Fixes #65 Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/170>
-rw-r--r--orc/orccpu-x86.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/orc/orccpu-x86.c b/orc/orccpu-x86.c
index f00f8ba..defa101 100644
--- a/orc/orccpu-x86.c
+++ b/orc/orccpu-x86.c
@@ -329,13 +329,18 @@ orc_x86_cpuid_handle_standard_flags (void)
orc_x86_sse_flags |= ORC_TARGET_SSE_SSE4_2;
}
- if (ecx & (1 << 28)) {
+ // Linux mitigation for GDS requires checking for XSAVE too.
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1854795
+ // https://gitlab.freedesktop.org/gstreamer/orc/-/issues/65
+ const int xsave_enabled = ecx & (1 << 26);
+
+ if (ecx & (1 << 28) && xsave_enabled) {
orc_x86_sse_flags |= ORC_TARGET_AVX_AVX;
}
get_cpuid (0x00000007, &eax, &ebx, &ecx, &edx);
- if (ebx & (1 << 5)) {
+ if (ebx & (1 << 5) && xsave_enabled) {
orc_x86_sse_flags |= ORC_TARGET_AVX_AVX2;
}
}