Chromium Code Reviews| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 switches::kGpuSwitching); | 312 switches::kGpuSwitching); |
| 313 if (option == switches::kGpuSwitchingOptionNameForceDiscrete) { | 313 if (option == switches::kGpuSwitchingOptionNameForceDiscrete) { |
| 314 workarounds->erase(gpu::FORCE_INTEGRATED_GPU); | 314 workarounds->erase(gpu::FORCE_INTEGRATED_GPU); |
| 315 workarounds->insert(gpu::FORCE_DISCRETE_GPU); | 315 workarounds->insert(gpu::FORCE_DISCRETE_GPU); |
| 316 } else if (option == switches::kGpuSwitchingOptionNameForceIntegrated) { | 316 } else if (option == switches::kGpuSwitchingOptionNameForceIntegrated) { |
| 317 workarounds->erase(gpu::FORCE_DISCRETE_GPU); | 317 workarounds->erase(gpu::FORCE_DISCRETE_GPU); |
| 318 workarounds->insert(gpu::FORCE_INTEGRATED_GPU); | 318 workarounds->insert(gpu::FORCE_INTEGRATED_GPU); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 void UpdateAcceleratedVideoDecode( | |
| 323 const GpuDataManagerImplPrivate* gpu_manager) { | |
| 324 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 325 #if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_ANDROID) | |
|
Ami GONE FROM CHROMIUM
2014/03/03 20:38:38
Why is this #if needed, considering the feature is
| |
| 326 if (gpu_manager->IsFeatureBlacklisted( | |
| 327 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | |
| 328 !command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode)) | |
| 329 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | |
| 330 #else | |
| 331 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | |
| 332 #endif | |
| 333 } | |
| 334 | |
| 322 // Block all domains' use of 3D APIs for this many milliseconds if | 335 // Block all domains' use of 3D APIs for this many milliseconds if |
| 323 // approaching a threshold where system stability might be compromised. | 336 // approaching a threshold where system stability might be compromised. |
| 324 const int64 kBlockAllDomainsMs = 10000; | 337 const int64 kBlockAllDomainsMs = 10000; |
| 325 const int kNumResetsWithinDuration = 1; | 338 const int kNumResetsWithinDuration = 1; |
| 326 | 339 |
| 327 // Enums for UMA histograms. | 340 // Enums for UMA histograms. |
| 328 enum BlockStatusHistogram { | 341 enum BlockStatusHistogram { |
| 329 BLOCK_STATUS_NOT_BLOCKED, | 342 BLOCK_STATUS_NOT_BLOCKED, |
| 330 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, | 343 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, |
| 331 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, | 344 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 video_memory_usage_stats); | 652 video_memory_usage_stats); |
| 640 } | 653 } |
| 641 | 654 |
| 642 void GpuDataManagerImplPrivate::AppendRendererCommandLine( | 655 void GpuDataManagerImplPrivate::AppendRendererCommandLine( |
| 643 CommandLine* command_line) const { | 656 CommandLine* command_line) const { |
| 644 DCHECK(command_line); | 657 DCHECK(command_line); |
| 645 | 658 |
| 646 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) && | 659 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) && |
| 647 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) | 660 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) |
| 648 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 661 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 649 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 662 UpdateAcceleratedVideoDecode(this); |
| 650 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | |
| 651 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | |
| 652 #if defined(ENABLE_WEBRTC) | 663 #if defined(ENABLE_WEBRTC) |
| 653 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 664 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
| 654 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | 665 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) |
| 655 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 666 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
| 656 #endif | 667 #endif |
| 657 | 668 |
| 658 if (use_software_compositor_ && | 669 if (use_software_compositor_ && |
| 659 !command_line->HasSwitch(switches::kEnableSoftwareCompositing)) | 670 !command_line->HasSwitch(switches::kEnableSoftwareCompositing)) |
| 660 command_line->AppendSwitch(switches::kEnableSoftwareCompositing); | 671 command_line->AppendSwitch(switches::kEnableSoftwareCompositing); |
| 661 | 672 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 if (!swiftshader_path.empty()) { | 710 if (!swiftshader_path.empty()) { |
| 700 command_line->AppendSwitchPath(switches::kSwiftShaderPath, | 711 command_line->AppendSwitchPath(switches::kSwiftShaderPath, |
| 701 swiftshader_path); | 712 swiftshader_path); |
| 702 } | 713 } |
| 703 | 714 |
| 704 if (!gpu_driver_bugs_.empty()) { | 715 if (!gpu_driver_bugs_.empty()) { |
| 705 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 716 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
| 706 IntSetToString(gpu_driver_bugs_)); | 717 IntSetToString(gpu_driver_bugs_)); |
| 707 } | 718 } |
| 708 | 719 |
| 709 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 720 UpdateAcceleratedVideoDecode(this); |
| 710 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { | |
| 711 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | |
| 712 } | |
| 713 #if defined(ENABLE_WEBRTC) | 721 #if defined(ENABLE_WEBRTC) |
| 714 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 722 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
| 715 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 723 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
| 716 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 724 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
| 717 } | 725 } |
| 718 #endif | 726 #endif |
| 719 | 727 |
| 720 // Pass GPU and driver information to GPU process. We try to avoid full GPU | 728 // Pass GPU and driver information to GPU process. We try to avoid full GPU |
| 721 // info collection at GPU process startup, but we need gpu vendor_id, | 729 // info collection at GPU process startup, but we need gpu vendor_id, |
| 722 // device_id, driver_vendor, driver_version for deciding whether we need to | 730 // device_id, driver_vendor, driver_version for deciding whether we need to |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1168 | 1176 |
| 1169 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1177 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
| 1170 gpu_process_accessible_ = false; | 1178 gpu_process_accessible_ = false; |
| 1171 gpu_info_.finalized = true; | 1179 gpu_info_.finalized = true; |
| 1172 complete_gpu_info_already_requested_ = true; | 1180 complete_gpu_info_already_requested_ = true; |
| 1173 // Some observers might be waiting. | 1181 // Some observers might be waiting. |
| 1174 NotifyGpuInfoUpdate(); | 1182 NotifyGpuInfoUpdate(); |
| 1175 } | 1183 } |
| 1176 | 1184 |
| 1177 } // namespace content | 1185 } // namespace content |
| OLD | NEW |