Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1303)

Unified Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 1743543004: Enable Accelerated Video Decode in Linux Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use std::tie Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..74daf8e1993cba81a02d220d4df05baff31a83f0 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,48 @@ 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
+ };
+ 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()};
allan.jensen 2016/04/15 09:16:20 This seems completely wrong. VAAPI is usually co
+ bool allowed = std::binary_search(
+ kIntelWhitelistTable,
+ kIntelWhitelistTable + arraysize(kIntelWhitelistTable), search_elem,
+ [](const CPU& a, const CPU& b) {
+ return std::tie(a.family, a.model) < std::tie(b.family, b.model);
+ });
+ 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 +997,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);
}
« no previous file with comments | « no previous file | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698