Chromium Code Reviews| 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 d48c2fc617eb5dbd8d43c12f5cae38c506f65c34..513a1d5d836f8434f3bf15c8f9cabc6a09fb8efb 100644 |
| --- a/content/browser/gpu/gpu_data_manager_impl_private.cc |
| +++ b/content/browser/gpu/gpu_data_manager_impl_private.cc |
| @@ -320,6 +320,9 @@ void GpuDataManagerImplPrivate::InitializeForTesting( |
| // This function is for testing only, so disable histograms. |
| update_histograms_ = false; |
| + // Prevent all further initialization. |
| + finalized_ = true; |
| + |
| InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); |
| } |
| @@ -533,13 +536,30 @@ void GpuDataManagerImplPrivate::GetGLStrings(std::string* gl_vendor, |
| void GpuDataManagerImplPrivate::Initialize() { |
| TRACE_EVENT0("startup", "GpuDataManagerImpl::Initialize"); |
| - CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| - if (command_line->HasSwitch(switches::kSkipGpuDataLoading) && |
| - !command_line->HasSwitch(switches::kUseGpuInTests)) |
| + if (finalized_) { |
| + DLOG(INFO) << "GpuDataManagerImpl marked as finalized; skipping Initialize"; |
| + return; |
| + } |
| + |
| + const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| + if (command_line->HasSwitch(switches::kSkipGpuDataLoading)) |
|
gab
2013/10/16 15:12:09
Otherwise I just realized that this lost the previ
Zhenyao Mo
2013/10/16 19:35:23
I don't think perf bots run with kUseGpuInTests sw
|
| return; |
| gpu::GPUInfo gpu_info; |
| - { |
| + if (command_line->GetSwitchValueASCII( |
| + switches::kUseGL) == gfx::kGLImplementationOSMesaName) { |
| + // If using the OSMesa GL implementation, use fake vendor and device ids to |
| + // make sure it never gets blacklisted. This is better than simply |
| + // cancelling GPUInfo gathering as it allows us to proceed with loading the |
| + // blacklist below which may have non-device specific entries we want to |
| + // apply anyways (e.g., OS version blacklisting). |
| + gpu_info.gpu.vendor_id = 0xffff; |
| + gpu_info.gpu.device_id = 0xffff; |
| + |
| + // Also declare the driver_vendor to be osmesa to be able to specify |
| + // exceptions based on driver_vendor==osmesa for some blacklist rules. |
| + gpu_info.driver_vendor = gfx::kGLImplementationOSMesaName; |
| + } else { |
| TRACE_EVENT0("startup", |
| "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
| gpu::CollectBasicGraphicsInfo(&gpu_info); |
| @@ -973,7 +993,8 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( |
| owner_(owner), |
| display_count_(0), |
| gpu_process_accessible_(true), |
| - use_software_compositor_(false) { |
| + use_software_compositor_(false), |
| + finalized_(false) { |
| DCHECK(owner_); |
| CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
| @@ -1018,8 +1039,14 @@ void GpuDataManagerImplPrivate::InitializeImpl( |
| GetContentClient()->GetProduct()); |
| CHECK(!browser_version_string.empty()); |
| + const bool log_gpu_control_list_decisions = |
| + CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kLogGpuControlListDecisions); |
| + |
| if (!gpu_blacklist_json.empty()) { |
| gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); |
| + if (log_gpu_control_list_decisions) |
| + gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); |
| bool success = gpu_blacklist_->LoadList( |
| browser_version_string, gpu_blacklist_json, |
| gpu::GpuControlList::kCurrentOsOnly); |
| @@ -1027,6 +1054,8 @@ void GpuDataManagerImplPrivate::InitializeImpl( |
| } |
| if (!gpu_switching_list_json.empty()) { |
| gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); |
| + if (log_gpu_control_list_decisions) |
| + gpu_switching_list_->enable_control_list_logging("gpu_switching_list"); |
| bool success = gpu_switching_list_->LoadList( |
| browser_version_string, gpu_switching_list_json, |
| gpu::GpuControlList::kCurrentOsOnly); |
| @@ -1034,6 +1063,8 @@ void GpuDataManagerImplPrivate::InitializeImpl( |
| } |
| if (!gpu_driver_bug_list_json.empty()) { |
| gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); |
| + if (log_gpu_control_list_decisions) |
| + gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); |
| bool success = gpu_driver_bug_list_->LoadList( |
| browser_version_string, gpu_driver_bug_list_json, |
| gpu::GpuControlList::kCurrentOsOnly); |