diff options
author | L. E. Segovia <amy@centricular.com> | 2024-02-24 12:20:01 +0000 |
---|---|---|
committer | L. E. Segovia <amy@centricular.com> | 2024-02-24 12:20:01 +0000 |
commit | 93587883f6aaa7f6ec034ddc7a01faf961e9ed6a (patch) | |
tree | bd4a02e7bca8931b8eea681cabe454767ee1ce73 | |
parent | 5967409ba5916199ba846e2e4eb59ef1cad6af27 (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.c | 9 |
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; } } |