| 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" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/metrics/sparse_histogram.h" | 12 #include "base/metrics/sparse_histogram.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "base/version.h" | 18 #include "base/version.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "cc/base/switches.h" | 20 #include "cc/base/switches.h" |
| 21 #include "content/browser/gpu/gpu_process_host.h" | 21 #include "content/browser/gpu/gpu_process_host.h" |
| 22 #include "content/common/gpu_host_messages.h" | 22 #include "content/common/gpu_host_messages.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/gpu_data_manager_observer.h" | 24 #include "content/public/browser/gpu_data_manager_observer.h" |
| 25 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
| 26 #include "content/public/common/content_constants.h" | 26 #include "content/public/common/content_constants.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/common/web_preferences.h" | 28 #include "content/public/common/web_preferences.h" |
| 29 #include "gpu/command_buffer/service/gpu_preferences.h" |
| 29 #include "gpu/command_buffer/service/gpu_switches.h" | 30 #include "gpu/command_buffer/service/gpu_switches.h" |
| 30 #include "gpu/config/gpu_control_list_jsons.h" | 31 #include "gpu/config/gpu_control_list_jsons.h" |
| 31 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 32 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 32 #include "gpu/config/gpu_feature_type.h" | 33 #include "gpu/config/gpu_feature_type.h" |
| 33 #include "gpu/config/gpu_info_collector.h" | 34 #include "gpu/config/gpu_info_collector.h" |
| 34 #include "gpu/config/gpu_switches.h" | 35 #include "gpu/config/gpu_switches.h" |
| 35 #include "gpu/config/gpu_util.h" | 36 #include "gpu/config/gpu_util.h" |
| 36 #include "gpu/ipc/common/memory_stats.h" | 37 #include "gpu/ipc/common/memory_stats.h" |
| 37 #include "ui/base/ui_base_switches.h" | 38 #include "ui/base/ui_base_switches.h" |
| 38 #include "ui/gl/gl_implementation.h" | 39 #include "ui/gl/gl_implementation.h" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 550 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
| 550 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; | 551 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; |
| 551 } | 552 } |
| 552 InitializeImpl(gpu_blacklist_string, | 553 InitializeImpl(gpu_blacklist_string, |
| 553 gpu_driver_bug_list_string, | 554 gpu_driver_bug_list_string, |
| 554 gpu_info); | 555 gpu_info); |
| 555 | 556 |
| 556 if (command_line->HasSwitch(switches::kSingleProcess) || | 557 if (command_line->HasSwitch(switches::kSingleProcess) || |
| 557 command_line->HasSwitch(switches::kInProcessGPU)) { | 558 command_line->HasSwitch(switches::kInProcessGPU)) { |
| 558 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | 559 command_line->AppendSwitch(switches::kDisableGpuWatchdog); |
| 559 AppendGpuCommandLine(command_line); | 560 AppendGpuCommandLine(command_line, nullptr); |
| 560 } | 561 } |
| 561 } | 562 } |
| 562 | 563 |
| 563 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { | 564 void GpuDataManagerImplPrivate::UpdateGpuInfoHelper() { |
| 564 GetContentClient()->SetGpuInfo(gpu_info_); | 565 GetContentClient()->SetGpuInfo(gpu_info_); |
| 565 | 566 |
| 566 const base::CommandLine* command_line = | 567 const base::CommandLine* command_line = |
| 567 base::CommandLine::ForCurrentProcess(); | 568 base::CommandLine::ForCurrentProcess(); |
| 568 | 569 |
| 569 std::string os_version; | 570 std::string os_version; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 648 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
| 648 #endif | 649 #endif |
| 649 | 650 |
| 650 #if defined(USE_AURA) | 651 #if defined(USE_AURA) |
| 651 if (!CanUseGpuBrowserCompositor()) | 652 if (!CanUseGpuBrowserCompositor()) |
| 652 command_line->AppendSwitch(switches::kDisableGpuCompositing); | 653 command_line->AppendSwitch(switches::kDisableGpuCompositing); |
| 653 #endif | 654 #endif |
| 654 } | 655 } |
| 655 | 656 |
| 656 void GpuDataManagerImplPrivate::AppendGpuCommandLine( | 657 void GpuDataManagerImplPrivate::AppendGpuCommandLine( |
| 657 base::CommandLine* command_line) const { | 658 base::CommandLine* command_line, |
| 659 gpu::GpuPreferences* gpu_preferences) const { |
| 658 DCHECK(command_line); | 660 DCHECK(command_line); |
| 659 | 661 |
| 660 std::string use_gl = | 662 std::string use_gl = |
| 661 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 663 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 662 switches::kUseGL); | 664 switches::kUseGL); |
| 663 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end()) | 665 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end()) |
| 664 command_line->AppendSwitch(switches::kDisableD3D11); | 666 command_line->AppendSwitch(switches::kDisableD3D11); |
| 665 if (gpu_driver_bugs_.find(gpu::DISABLE_DIRECT_COMPOSITION) != | 667 if (gpu_driver_bugs_.find(gpu::DISABLE_DIRECT_COMPOSITION) != |
| 666 gpu_driver_bugs_.end()) | 668 gpu_driver_bugs_.end()) |
| 667 command_line->AppendSwitch(switches::kDisableDirectComposition); | 669 command_line->AppendSwitch(switches::kDisableDirectComposition); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 691 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 693 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
| 692 IntSetToString(gpu_driver_bugs_)); | 694 IntSetToString(gpu_driver_bugs_)); |
| 693 } | 695 } |
| 694 | 696 |
| 695 if (!disabled_extensions_.empty()) { | 697 if (!disabled_extensions_.empty()) { |
| 696 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, | 698 command_line->AppendSwitchASCII(switches::kDisableGLExtensions, |
| 697 disabled_extensions_); | 699 disabled_extensions_); |
| 698 } | 700 } |
| 699 | 701 |
| 700 if (ShouldDisableAcceleratedVideoDecode(command_line)) { | 702 if (ShouldDisableAcceleratedVideoDecode(command_line)) { |
| 701 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 703 if (gpu_preferences) { |
| 704 gpu_preferences->disable_accelerated_video_decode = true; |
| 705 } else { |
| 706 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
| 707 } |
| 702 } | 708 } |
| 703 #if defined(ENABLE_WEBRTC) | 709 #if defined(ENABLE_WEBRTC) |
| 704 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 710 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
| 705 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 711 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
| 706 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 712 if (gpu_preferences) { |
| 713 gpu_preferences->disable_web_rtc_hw_encoding = true; |
| 714 } else { |
| 715 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
| 716 } |
| 707 } | 717 } |
| 708 #endif | 718 #endif |
| 709 | 719 |
| 710 // Pass GPU and driver information to GPU process. We try to avoid full GPU | 720 // Pass GPU and driver information to GPU process. We try to avoid full GPU |
| 711 // info collection at GPU process startup, but we need gpu vendor_id, | 721 // info collection at GPU process startup, but we need gpu vendor_id, |
| 712 // device_id, driver_vendor, driver_version for deciding whether we need to | 722 // device_id, driver_vendor, driver_version for deciding whether we need to |
| 713 // collect full info (on Linux) and for crash reporting purpose. | 723 // collect full info (on Linux) and for crash reporting purpose. |
| 714 command_line->AppendSwitchASCII(switches::kGpuVendorID, | 724 command_line->AppendSwitchASCII(switches::kGpuVendorID, |
| 715 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); | 725 base::StringPrintf("0x%04x", gpu_info_.gpu.vendor_id)); |
| 716 command_line->AppendSwitchASCII(switches::kGpuDeviceID, | 726 command_line->AppendSwitchASCII(switches::kGpuDeviceID, |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1207 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
| 1198 #if defined(OS_WIN) | 1208 #if defined(OS_WIN) |
| 1199 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1209 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
| 1200 #endif | 1210 #endif |
| 1201 complete_gpu_info_already_requested_ = true; | 1211 complete_gpu_info_already_requested_ = true; |
| 1202 // Some observers might be waiting. | 1212 // Some observers might be waiting. |
| 1203 NotifyGpuInfoUpdate(); | 1213 NotifyGpuInfoUpdate(); |
| 1204 } | 1214 } |
| 1205 | 1215 |
| 1206 } // namespace content | 1216 } // namespace content |
| OLD | NEW |