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

Unified Diff: ui/gl/gpu_switching_manager.cc

Issue 1142423005: [M44 Merge] Refine dual-GPU detection on Mac OS X. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2403
Patch Set: Created 5 years, 7 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 | « ui/gl/gpu_switching_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gpu_switching_manager.cc
diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc
index 23fc2ffade4f86c1c6f4801196b448a997a1ea54..36ad7adde2ab26bd31c8628c5075511f5430c947 100644
--- a/ui/gl/gpu_switching_manager.cc
+++ b/ui/gl/gpu_switching_manager.cc
@@ -32,7 +32,6 @@ GpuSwitchingManager::GpuSwitchingManager()
gpu_switching_option_set_(false),
supports_dual_gpus_(false),
supports_dual_gpus_set_(false),
- gpu_count_(0),
platform_specific_(new PlatformSpecific) {
#if defined(OS_MACOSX)
platform_specific_->discrete_pixel_format = nullptr;
@@ -91,7 +90,7 @@ bool GpuSwitchingManager::SupportsDualGpus() {
// Browser process.
// We only compute this flag in the browser process.
#if defined(OS_MACOSX)
- flag = (gpu_count_ == 2);
+ flag = (vendor_ids_.size() == 2);
if (flag && command_line.HasSwitch(switches::kUseGL) &&
command_line.GetSwitchValueASCII(switches::kUseGL) !=
gfx::kGLImplementationDesktopName)
@@ -99,6 +98,17 @@ bool GpuSwitchingManager::SupportsDualGpus() {
if (flag && !base::mac::IsOSLionOrLater())
flag = false;
+
+ if (flag) {
+ // Only advertise that we have two GPUs to the rest of
+ // Chrome's code if we find an Intel GPU and some other
+ // vendor's GPU. Otherwise we don't understand the
+ // configuration and don't deal well with it (an example being
+ // the dual AMD GPUs in recent Mac Pros).
+ const uint32 intel = 0x8086;
+ flag = ((vendor_ids_[0] == intel && vendor_ids_[1] != intel) ||
+ (vendor_ids_[0] != intel && vendor_ids_[1] == intel));
+ }
#endif // OS_MACOSX
}
supports_dual_gpus_ = flag;
@@ -107,8 +117,9 @@ bool GpuSwitchingManager::SupportsDualGpus() {
return supports_dual_gpus_;
}
-void GpuSwitchingManager::SetGpuCount(size_t gpu_count) {
- gpu_count_ = gpu_count;
+void GpuSwitchingManager::SetGpuVendorIds(
+ const std::vector<uint32>& vendor_ids) {
+ vendor_ids_ = vendor_ids;
}
void GpuSwitchingManager::AddObserver(GpuSwitchingObserver* observer) {
« no previous file with comments | « ui/gl/gpu_switching_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698