Index: content/browser/gpu/gpu_data_manager_impl.cc |
diff --git a/content/browser/gpu/gpu_data_manager_impl.cc b/content/browser/gpu/gpu_data_manager_impl.cc |
index 5f17f0af92f229f78a0438cacebaac1eb4d16640..b6d81d5bf975b083aea0dd5ca1121e392e33676c 100644 |
--- a/content/browser/gpu/gpu_data_manager_impl.cc |
+++ b/content/browser/gpu/gpu_data_manager_impl.cc |
@@ -78,12 +78,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 |
Ken Russell (switch to Gerrit)
2013/05/08 23:53:24
End with ".".
|
+ |
+ 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 |
@@ -154,6 +167,14 @@ void GpuDataManagerImpl::RemoveGpuSwitchCallback( |
} |
} |
+void GpuDataManagerImpl::SetDisplayCount(unsigned int display_count) { |
+ display_count_ = display_count; |
+} |
+ |
+unsigned int GpuDataManagerImpl::GetDisplayCount() const { |
+ return display_count_; |
+} |
+ |
GPUInfo GpuDataManagerImpl::GetGPUInfo() const { |
GPUInfo gpu_info; |
{ |
@@ -578,7 +599,8 @@ void GpuDataManagerImpl::UpdateRendererWebPrefs(WebPreferences* prefs) const { |
prefs->flash_stage3d_baseline_enabled = false; |
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) |
prefs->accelerated_2d_canvas_enabled = false; |
- if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_MULTISAMPLING)) |
+ if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_MULTISAMPLING) |
+ || display_count_ > 1) |
prefs->gl_multisampling_enabled = false; |
if (IsFeatureBlacklisted(GPU_FEATURE_TYPE_3D_CSS)) { |
prefs->accelerated_compositing_for_3d_transforms_enabled = false; |
@@ -715,7 +737,8 @@ GpuDataManagerImpl::GpuDataManagerImpl() |
card_blacklisted_(false), |
update_histograms_(true), |
window_count_(0), |
- domain_blocking_enabled_(true) { |
+ domain_blocking_enabled_(true), |
+ display_count_(0) { |
CommandLine* command_line = CommandLine::ForCurrentProcess(); |
if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
@@ -732,6 +755,7 @@ GpuDataManagerImpl::GpuDataManagerImpl() |
} |
#if defined(OS_MACOSX) |
+ CGGetActiveDisplayList (0, NULL, &display_count_); |
CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, this); |
#endif // OS_MACOSX |
} |