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 2a82137a58a52c90a690891f13b78e92af68e3a8..e90feafab079d5ccb33647d0063bcae394942263 100644 |
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc |
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc |
@@ -332,6 +332,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); |
} |
@@ -545,13 +548,35 @@ 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)) |
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; |
+ |
+ // Hardcode some values otherwise some blacklisting rules in |
+ // kSoftwareRenderingListJson result in a positive match as GpuControlList |
+ // assumes a match (by design) when a property is required for the |
+ // verification yet not present in the GpuInfo. |
+ gpu_info.driver_vendor = |
+ gfx::kGLImplementationOSMesaName; // Bypass rule #74. |
+ gpu_info.driver_date = "2013.8"; // Bypass rules #12 and #55. |
+ gpu_info.driver_version = "9.0.3"; // Bypass rule #23. |
+ } else { |
TRACE_EVENT0("startup", |
"GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
gpu::CollectBasicGraphicsInfo(&gpu_info); |
@@ -985,7 +1010,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)) { |
@@ -1032,6 +1058,10 @@ void GpuDataManagerImplPrivate::InitializeImpl( |
if (!gpu_blacklist_json.empty()) { |
gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kLogGpuControlListDecisions)) { |
+ gpu_blacklist_->enable_control_list_logging(); |
+ } |
gpu_blacklist_->LoadList( |
browser_version_string, gpu_blacklist_json, |
gpu::GpuControlList::kCurrentOsOnly); |