Index: content/browser/gpu/gpu_data_manager_impl_private.cc |
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc |
index 161f07b1bff27f3fb959bb7f7246051317fbc24f..9ba1ef99245e52f4519fa3591e5e464e45fe3853 100644 |
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc |
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc |
@@ -7,6 +7,7 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
#include "base/command_line.h" |
+#include "base/cpu.h" |
#include "base/metrics/field_trial.h" |
#include "base/metrics/histogram.h" |
#include "base/metrics/sparse_histogram.h" |
@@ -247,6 +248,49 @@ void DisplayReconfigCallback(CGDirectDisplayID display, |
} |
#endif // OS_MACOSX |
+#if defined(OS_LINUX) |
+bool ShouldEnableAcceleratedVideoDecodeInLinux() { |
+#if defined(OS_CHROMEOS) |
+ return true; |
+#endif // defined(OS_CHROMEOS) |
+ |
+// Allow only latest Intel architecture. +IvyBridge |
+#if defined(ARCH_CPU_X86_FAMILY) |
+ struct CPU { |
+ int family; // family of the processor |
+ int model; // model of processor |
+ }; |
Avi (use Gerrit)
2016/02/26 17:57:40
put operator< here and use std::tie...
struct CPU
dshwang
2016/02/26 18:11:35
chromium code style prohibits from adding any meth
Avi (use Gerrit)
2016/02/26 18:33:28
Hm.
OK, leave it in the binary_search, but use st
|
+ const CPU kIntelWhitelistTable[] = { |
+ // http://instlatx64.atw.hu/ for CPUID |
+ {0x06, 0x3A}, // IvyBridge |
+ {0x06, 0x3C}, // Haswell |
+ {0x06, 0x3D}, // Broadwell |
+ {0x06, 0x3E}, // IvyBridge |
+ {0x06, 0x3F}, // Haswell |
+ {0x06, 0x45}, // Haswell |
+ {0x06, 0x46}, // Haswell |
+ {0x06, 0x47}, // Broadwell-H |
+ {0x06, 0x4C}, // Braswell |
+ {0x06, 0x4E}, // Skylake |
+ {0x06, 0x56}, // Broadwell-DE |
+ }; |
+ |
+ base::CPU cpuid; |
+ const CPU search_elem = {cpuid.family(), cpuid.model()}; |
+ bool allowed = |
+ std::binary_search(kIntelWhitelistTable, |
+ kIntelWhitelistTable + arraysize(kIntelWhitelistTable), |
+ search_elem, [](const CPU& a, const CPU& b) { |
+ return a.family < b.family || |
+ (a.family == b.family && a.model < b.model); |
Avi (use Gerrit)
2016/02/26 17:57:40
... and not in here.
|
+ }); |
+ return allowed; |
+#endif // defined(ARCH_CPU_X86_FAMILY) |
+ |
+ return false; |
+} |
+#endif |
+ |
// Block all domains' use of 3D APIs for this many milliseconds if |
// approaching a threshold where system stability might be compromised. |
const int64_t kBlockAllDomainsMs = 10000; |
@@ -954,6 +998,11 @@ bool GpuDataManagerImplPrivate::ShouldDisableAcceleratedVideoDecode( |
if (group_name == "Disabled") |
return true; |
+#if defined(OS_LINUX) |
+ if (!ShouldEnableAcceleratedVideoDecodeInLinux()) |
+ return true; |
+#endif |
+ |
// Accelerated decode is never available with --disable-gpu. |
return command_line->HasSwitch(switches::kDisableGpu); |
} |