diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 10:38:51 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 10:38:51 +0000 |
commit | 35b744c89c1ca729f78a20aa3c271dbf050369a1 (patch) | |
tree | 1da2d2841e175c4733f5ddac6008f8c31e51d84a /media/base | |
parent | 0652cfab2f8db969f5128d7584e20826e7d788d0 (diff) | |
download | chromium_src-35b744c89c1ca729f78a20aa3c271dbf050369a1.zip chromium_src-35b744c89c1ca729f78a20aa3c271dbf050369a1.tar.gz chromium_src-35b744c89c1ca729f78a20aa3c271dbf050369a1.tar.bz2 |
Proper detection of MMX and SSE support
This patch implements MMS and SSE detection on x86 CPU.
BUG=None
TEST=Video runs on computers without MMX and SSE
Review URL: http://codereview.chromium.org/8133022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/cpu_features_x86.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/media/base/cpu_features_x86.cc b/media/base/cpu_features_x86.cc index 2839ff8..d1c70c5 100644 --- a/media/base/cpu_features_x86.cc +++ b/media/base/cpu_features_x86.cc @@ -50,18 +50,30 @@ static inline void getcpuid(int info_type, int info[4]) { #endif bool hasMMX() { - // TODO(hclam): Acutually checks it. +#if defined(ARCH_CPU_X86_64) + // Every X86_64 processor has MMX. return true; +#else + int cpu_info[4] = { 0 }; + getcpuid(1, cpu_info); + return (cpu_info[3] & (1<<23)) != 0; +#endif } bool hasSSE() { - // TODO(hclam): Actually checks it. +#if defined(ARCH_CPU_X86_64) + // Every X86_64 processor has SSE. return true; +#else + int cpu_info[4] = { 0 }; + getcpuid(1, cpu_info); + return (cpu_info[3] & (1<<25)) != 0; +#endif } bool hasSSE2() { #if defined(ARCH_CPU_X86_64) - /* All x86_64 machines have SSE2, so don't even bother checking. */ + // All X86_64 machines have SSE2, so don't even bother checking. return true; #else int cpu_info[4] = { 0 }; |