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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 GpuDataManagerImpl::UnlockedSession session(owner_); | 595 GpuDataManagerImpl::UnlockedSession session(owner_); |
596 observer_list_->Notify(FROM_HERE, | 596 observer_list_->Notify(FROM_HERE, |
597 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 597 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
598 video_memory_usage_stats); | 598 video_memory_usage_stats); |
599 } | 599 } |
600 | 600 |
601 void GpuDataManagerImplPrivate::AppendRendererCommandLine( | 601 void GpuDataManagerImplPrivate::AppendRendererCommandLine( |
602 base::CommandLine* command_line) const { | 602 base::CommandLine* command_line) const { |
603 DCHECK(command_line); | 603 DCHECK(command_line); |
604 | 604 |
605 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 605 if (ShouldDisableAcceleratedVideoDecode(command_line)) |
606 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | |
607 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 606 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
608 #if defined(ENABLE_WEBRTC) | 607 #if defined(ENABLE_WEBRTC) |
609 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 608 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
610 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | 609 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) |
611 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 610 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
612 #endif | 611 #endif |
613 | 612 |
614 #if defined(USE_AURA) | 613 #if defined(USE_AURA) |
615 if (!CanUseGpuBrowserCompositor()) | 614 if (!CanUseGpuBrowserCompositor()) |
616 command_line->AppendSwitch(switches::kDisableGpuCompositing); | 615 command_line->AppendSwitch(switches::kDisableGpuCompositing); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 if (!swiftshader_path.empty()) { | 650 if (!swiftshader_path.empty()) { |
652 command_line->AppendSwitchPath(switches::kSwiftShaderPath, | 651 command_line->AppendSwitchPath(switches::kSwiftShaderPath, |
653 swiftshader_path); | 652 swiftshader_path); |
654 } | 653 } |
655 | 654 |
656 if (!gpu_driver_bugs_.empty()) { | 655 if (!gpu_driver_bugs_.empty()) { |
657 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 656 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
658 IntSetToString(gpu_driver_bugs_)); | 657 IntSetToString(gpu_driver_bugs_)); |
659 } | 658 } |
660 | 659 |
661 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 660 if (ShouldDisableAcceleratedVideoDecode(command_line)) { |
662 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { | |
663 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 661 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
664 } | 662 } |
665 #if defined(ENABLE_WEBRTC) | 663 #if defined(ENABLE_WEBRTC) |
666 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 664 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
667 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 665 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
668 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 666 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
669 } | 667 } |
670 #endif | 668 #endif |
671 | 669 |
672 // Pass GPU and driver information to GPU process. We try to avoid full GPU | 670 // Pass GPU and driver information to GPU process. We try to avoid full GPU |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 display_count_ > 1)) | 730 display_count_ > 1)) |
733 prefs->gl_multisampling_enabled = false; | 731 prefs->gl_multisampling_enabled = false; |
734 | 732 |
735 #if defined(USE_AURA) | 733 #if defined(USE_AURA) |
736 if (!CanUseGpuBrowserCompositor()) { | 734 if (!CanUseGpuBrowserCompositor()) { |
737 prefs->accelerated_2d_canvas_enabled = false; | 735 prefs->accelerated_2d_canvas_enabled = false; |
738 prefs->pepper_3d_enabled = false; | 736 prefs->pepper_3d_enabled = false; |
739 } | 737 } |
740 #endif | 738 #endif |
741 | 739 |
742 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 740 const base::CommandLine* command_line = |
743 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 741 base::CommandLine::ForCurrentProcess(); |
744 switches::kDisableAcceleratedVideoDecode)) { | 742 if (!ShouldDisableAcceleratedVideoDecode(command_line) && |
| 743 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { |
745 prefs->pepper_accelerated_video_decode_enabled = true; | 744 prefs->pepper_accelerated_video_decode_enabled = true; |
746 } | 745 } |
747 } | 746 } |
748 | 747 |
749 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { | 748 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { |
750 card_blacklisted_ = true; | 749 card_blacklisted_ = true; |
751 | 750 |
752 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) | 751 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) |
753 blacklisted_features_.insert(i); | 752 blacklisted_features_.insert(i); |
754 | 753 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 return false; | 871 return false; |
873 if (ShouldUseWarp()) | 872 if (ShouldUseWarp()) |
874 return true; | 873 return true; |
875 if (ShouldUseSwiftShader()) | 874 if (ShouldUseSwiftShader()) |
876 return false; | 875 return false; |
877 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) | 876 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) |
878 return false; | 877 return false; |
879 return true; | 878 return true; |
880 } | 879 } |
881 | 880 |
| 881 |
| 882 bool GpuDataManagerImplPrivate::ShouldDisableAcceleratedVideoDecode( |
| 883 const base::CommandLine* command_line) const { |
| 884 // Make sure that we initialize the experiment first to make sure that |
| 885 // statistics are bucket correctly in all cases. |
| 886 // This experiment is temporary and will be removed once enough data |
| 887 // to resolve crbug/442039 has been collected. |
| 888 const std::string group_name = base::FieldTrialList::FindFullName( |
| 889 "DisableAcceleratedVideoDecode"); |
| 890 if (command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { |
| 891 // It was already disabled on the command line. |
| 892 return false; |
| 893 } |
| 894 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE)) |
| 895 return true; |
| 896 if (group_name == "Disabled") |
| 897 return true; |
| 898 return false; |
| 899 } |
| 900 |
882 void GpuDataManagerImplPrivate::GetDisabledExtensions( | 901 void GpuDataManagerImplPrivate::GetDisabledExtensions( |
883 std::string* disabled_extensions) const { | 902 std::string* disabled_extensions) const { |
884 DCHECK(disabled_extensions); | 903 DCHECK(disabled_extensions); |
885 | 904 |
886 *disabled_extensions = disabled_extensions_; | 905 *disabled_extensions = disabled_extensions_; |
887 } | 906 } |
888 | 907 |
889 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs( | 908 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs( |
890 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) { | 909 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) { |
891 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now()); | 910 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now()); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; | 1182 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; |
1164 #if defined(OS_WIN) | 1183 #if defined(OS_WIN) |
1165 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; | 1184 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; |
1166 #endif | 1185 #endif |
1167 complete_gpu_info_already_requested_ = true; | 1186 complete_gpu_info_already_requested_ = true; |
1168 // Some observers might be waiting. | 1187 // Some observers might be waiting. |
1169 NotifyGpuInfoUpdate(); | 1188 NotifyGpuInfoUpdate(); |
1170 } | 1189 } |
1171 | 1190 |
1172 } // namespace content | 1191 } // namespace content |
OLD | NEW |