OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 const gpu::GPUInfo& gpu_info) { | 266 const gpu::GPUInfo& gpu_info) { |
267 // This function is for testing only, so disable histograms. | 267 // This function is for testing only, so disable histograms. |
268 update_histograms_ = false; | 268 update_histograms_ = false; |
269 | 269 |
270 // Prevent all further initialization. | 270 // Prevent all further initialization. |
271 finalized_ = true; | 271 finalized_ = true; |
272 | 272 |
273 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); | 273 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); |
274 } | 274 } |
275 | 275 |
276 bool GpuDataManagerImplPrivate::IsInitialized() const { | |
277 return finalized_; | |
Zhenyao Mo
2016/01/11 23:23:32
You can't use finalized_. It has a very different
| |
278 } | |
279 | |
276 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { | 280 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { |
277 #if defined(OS_CHROMEOS) | 281 #if defined(OS_CHROMEOS) |
278 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && | 282 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && |
279 base::CommandLine::ForCurrentProcess()->HasSwitch( | 283 base::CommandLine::ForCurrentProcess()->HasSwitch( |
280 switches::kDisablePanelFitting)) { | 284 switches::kDisablePanelFitting)) { |
281 return true; | 285 return true; |
282 } | 286 } |
283 #endif // OS_CHROMEOS | 287 #endif // OS_CHROMEOS |
284 if (use_swiftshader_ || ShouldUseWarp()) { | 288 if (use_swiftshader_ || ShouldUseWarp()) { |
285 // Skia's software rendering is probably more efficient than going through | 289 // Skia's software rendering is probably more efficient than going through |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 } | 555 } |
552 InitializeImpl(gpu_blacklist_string, | 556 InitializeImpl(gpu_blacklist_string, |
553 gpu_driver_bug_list_string, | 557 gpu_driver_bug_list_string, |
554 gpu_info); | 558 gpu_info); |
555 | 559 |
556 if (command_line->HasSwitch(switches::kSingleProcess) || | 560 if (command_line->HasSwitch(switches::kSingleProcess) || |
557 command_line->HasSwitch(switches::kInProcessGPU)) { | 561 command_line->HasSwitch(switches::kInProcessGPU)) { |
558 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 562 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
559 AppendGpuCommandLine(command_line); | 563 AppendGpuCommandLine(command_line); |
560 } | 564 } |
565 | |
566 finalized_ = true; | |
561 } | 567 } |
562 | 568 |
563 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 569 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
564 GetContentClient()->SetGpuInfo(gpu_info_); | 570 GetContentClient()->SetGpuInfo(gpu_info_); |
565 | 571 |
566 if (gpu_blacklist_) { | 572 if (gpu_blacklist_) { |
567 std::set<int> features = gpu_blacklist_->MakeDecision( | 573 std::set<int> features = gpu_blacklist_->MakeDecision( |
568 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 574 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); |
569 if (update_histograms_) | 575 if (update_histograms_) |
570 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 576 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 706 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
701 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 707 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
702 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 708 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
703 } | 709 } |
704 #endif | 710 #endif |
705 | 711 |
706 // Pass GPU and driver information to GPU process. We try to avoid full GPU | 712 // Pass GPU and driver information to GPU process. We try to avoid full GPU |
707 // info collection at GPU process startup, but we need gpu vendor_id, | 713 // info collection at GPU process startup, but we need gpu vendor_id, |
708 // device_id, driver_vendor, driver_version for deciding whether we need to | 714 // device_id, driver_vendor, driver_version for deciding whether we need to |
709 // collect full info (on Linux) and for crash reporting purpose. | 715 // collect full info (on Linux) and for crash reporting purpose. |
710 command_line->AppendSwitchASCII(switches::kGpuVendorID, | 716 if (!command_line->HasSwitch(switches::kGpuVendorID)) |
711 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 717 command_line->AppendSwitchASCII( |
712 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 718 switches::kGpuVendorID, |
713 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); | 719 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
714 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | 720 if (!command_line->HasSwitch(switches::kGpuDeviceID)) |
715 gpu_info_.driver_vendor); | 721 command_line->AppendSwitchASCII( |
716 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | 722 switches::kGpuDeviceID, |
717 gpu_info_.driver_version); | 723 base::StringPrintf("0x%04x", gpu_info_.gpu.device_id)); |
724 if (!command_line->HasSwitch(switches::kGpuDriverVendor)) | |
725 command_line->AppendSwitchASCII(switches::kGpuDriverVendor, | |
726 gpu_info_.driver_vendor); | |
727 if (!command_line->HasSwitch(switches::kGpuDriverVersion)) | |
728 command_line->AppendSwitchASCII(switches::kGpuDriverVersion, | |
729 gpu_info_.driver_version); | |
718 | 730 |
719 if (ShouldUseWarp() && !command_line->HasSwitch(switches::kUseANGLE)) { | 731 if (ShouldUseWarp() && !command_line->HasSwitch(switches::kUseANGLE)) { |
720 command_line->AppendSwitchASCII(switches::kUseANGLE, | 732 command_line->AppendSwitchASCII(switches::kUseANGLE, |
721 gfx::kANGLEImplementationWARPName); | 733 gfx::kANGLEImplementationWARPName); |
722 } | 734 } |
723 } | 735 } |
724 | 736 |
725 void GpuDataManagerImplPrivate::AppendPluginCommandLine( | 737 void GpuDataManagerImplPrivate::AppendPluginCommandLine( |
726 base::CommandLine* command_line) const { | 738 base::CommandLine* command_line) const { |
727 DCHECK(command_line); | 739 DCHECK(command_line); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1242 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1254 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1243 #if defined(OS_WIN) | 1255 #if defined(OS_WIN) |
1244 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1256 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1245 #endif | 1257 #endif |
1246 complete_gpu_info_already_requested_ = true; | 1258 complete_gpu_info_already_requested_ = true; |
1247 // Some observers might be waiting. | 1259 // Some observers might be waiting. |
1248 NotifyGpuInfoUpdate(); | 1260 NotifyGpuInfoUpdate(); |
1249 } | 1261 } |
1250 | 1262 |
1251 } // namespace content | 1263 } // namespace content |
OLD | NEW |