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 fbc776cb9be2cf1e07915ce5184724a4a8f1e23a..74cef694525ef96d89dad54e3072667335ee7d33 100644 |
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc |
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc |
@@ -216,12 +216,25 @@ std::string IntSetToString(const std::set<int>& list) { |
void DisplayReconfigCallback(CGDirectDisplayID display, |
CGDisplayChangeSummaryFlags flags, |
void* gpu_data_manager) { |
- if (flags & kCGDisplayAddFlag) { |
- GpuDataManagerImpl* manager = |
- reinterpret_cast<GpuDataManagerImpl*>(gpu_data_manager); |
- DCHECK(manager); |
- manager->HandleGpuSwitch(); |
+ if(flags == kCGDisplayBeginConfigurationFlag) |
+ return; // This call contains no information about the display change |
+ |
+ GpuDataManagerImpl* manager = |
+ reinterpret_cast<GpuDataManagerImpl*>(gpu_data_manager); |
+ DCHECK(manager); |
+ |
+ uint32_t displayCount; |
+ CGGetActiveDisplayList(0, NULL, &displayCount); |
+ |
+ bool fireGpuSwitch = flags & kCGDisplayAddFlag; |
+ |
+ if (displayCount != manager->GetDisplayCount()) { |
+ manager->SetDisplayCount(displayCount); |
+ fireGpuSwitch = true; |
} |
+ |
+ if (fireGpuSwitch) |
+ manager->HandleGpuSwitch(); |
} |
#endif // OS_MACOSX |
@@ -342,6 +355,14 @@ size_t GpuDataManagerImplPrivate::GetBlacklistedFeatureCount() const { |
return blacklisted_features_.size(); |
} |
+void GpuDataManagerImplPrivate::SetDisplayCount(unsigned int display_count) { |
+ display_count_ = display_count; |
+} |
+ |
+unsigned int GpuDataManagerImplPrivate::GetDisplayCount() const { |
+ return display_count_; |
+} |
+ |
gpu::GPUInfo GpuDataManagerImplPrivate::GetGPUInfo() const { |
return gpu_info_; |
} |
@@ -750,7 +771,8 @@ void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( |
prefs->flash_stage3d_baseline_enabled = false; |
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) |
prefs->accelerated_2d_canvas_enabled = false; |
- if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING)) |
+ if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING) |
+ || display_count_ > 1) |
prefs->gl_multisampling_enabled = false; |
if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) { |
prefs->accelerated_compositing_for_3d_transforms_enabled = false; |
@@ -899,7 +921,8 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( |
update_histograms_(true), |
window_count_(0), |
domain_blocking_enabled_(true), |
- owner_(owner) { |
+ owner_(owner), |
+ display_count_(0) { |
DCHECK(owner_); |
CommandLine* command_line = CommandLine::ForCurrentProcess(); |
if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
@@ -918,6 +941,7 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( |
} |
#if defined(OS_MACOSX) |
+ CGGetActiveDisplayList (0, NULL, &display_count_); |
CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
#endif // OS_MACOSX |
} |