Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 239083006: Change ACCELERATED_COMPOSITING blacklist to GPU_COMPOSITING. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blacklistaccel: addbackflag Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 std::vector<uint32> flag_disabled_entries; 138 std::vector<uint32> flag_disabled_entries;
139 disabled = true; 139 disabled = true;
140 blacklist->GetDecisionEntries(&flag_disabled_entries, disabled); 140 blacklist->GetDecisionEntries(&flag_disabled_entries, disabled);
141 for (size_t i = 0; i < flag_disabled_entries.size(); ++i) { 141 for (size_t i = 0; i < flag_disabled_entries.size(); ++i) {
142 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry", 142 UMA_HISTOGRAM_ENUMERATION("GPU.BlacklistTestResultsPerDisabledEntry",
143 flag_disabled_entries[i], max_entry_id + 1); 143 flag_disabled_entries[i], max_entry_id + 1);
144 } 144 }
145 145
146 const gpu::GpuFeatureType kGpuFeatures[] = { 146 const gpu::GpuFeatureType kGpuFeatures[] = {
147 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS, 147 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS,
148 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING, 148 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING, gpu::GPU_FEATURE_TYPE_WEBGL};
149 gpu::GPU_FEATURE_TYPE_WEBGL
150 };
151 const std::string kGpuBlacklistFeatureHistogramNames[] = { 149 const std::string kGpuBlacklistFeatureHistogramNames[] = {
152 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas", 150 "GPU.BlacklistFeatureTestResults.Accelerated2dCanvas",
153 "GPU.BlacklistFeatureTestResults.AcceleratedCompositing", 151 "GPU.BlacklistFeatureTestResults.GpuCompositing",
154 "GPU.BlacklistFeatureTestResults.Webgl", 152 "GPU.BlacklistFeatureTestResults.Webgl", };
155 };
156 const bool kGpuFeatureUserFlags[] = { 153 const bool kGpuFeatureUserFlags[] = {
157 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas), 154 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas),
158 false, 155 command_line.HasSwitch(switches::kDisableGpu),
159 command_line.HasSwitch(switches::kDisableExperimentalWebGL), 156 command_line.HasSwitch(switches::kDisableExperimentalWebGL), };
160 };
161 #if defined(OS_WIN) 157 #if defined(OS_WIN)
162 const std::string kGpuBlacklistFeatureHistogramNamesWin[] = { 158 const std::string kGpuBlacklistFeatureHistogramNamesWin[] = {
163 "GPU.BlacklistFeatureTestResultsWindows.Accelerated2dCanvas", 159 "GPU.BlacklistFeatureTestResultsWindows.Accelerated2dCanvas",
164 "GPU.BlacklistFeatureTestResultsWindows.AcceleratedCompositing", 160 "GPU.BlacklistFeatureTestResultsWindows.GpuCompositing",
165 "GPU.BlacklistFeatureTestResultsWindows.Webgl", 161 "GPU.BlacklistFeatureTestResultsWindows.Webgl", };
166 };
167 #endif 162 #endif
168 const size_t kNumFeatures = 163 const size_t kNumFeatures =
169 sizeof(kGpuFeatures) / sizeof(gpu::GpuFeatureType); 164 sizeof(kGpuFeatures) / sizeof(gpu::GpuFeatureType);
170 for (size_t i = 0; i < kNumFeatures; ++i) { 165 for (size_t i = 0; i < kNumFeatures; ++i) {
171 // We can't use UMA_HISTOGRAM_ENUMERATION here because the same name is 166 // We can't use UMA_HISTOGRAM_ENUMERATION here because the same name is
172 // expected if the macro is used within a loop. 167 // expected if the macro is used within a loop.
173 GpuFeatureStatus value = kGpuFeatureEnabled; 168 GpuFeatureStatus value = kGpuFeatureEnabled;
174 if (blacklisted_features.count(kGpuFeatures[i])) 169 if (blacklisted_features.count(kGpuFeatures[i]))
175 value = kGpuFeatureBlacklisted; 170 value = kGpuFeatureBlacklisted;
176 else if (kGpuFeatureUserFlags[i]) 171 else if (kGpuFeatureUserFlags[i])
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 base::FilePath swiftshader_path = 660 base::FilePath swiftshader_path =
666 CommandLine::ForCurrentProcess()->GetSwitchValuePath( 661 CommandLine::ForCurrentProcess()->GetSwitchValuePath(
667 switches::kSwiftShaderPath); 662 switches::kSwiftShaderPath);
668 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end()) 663 if (gpu_driver_bugs_.find(gpu::DISABLE_D3D11) != gpu_driver_bugs_.end())
669 command_line->AppendSwitch(switches::kDisableD3D11); 664 command_line->AppendSwitch(switches::kDisableD3D11);
670 if (use_swiftshader_) { 665 if (use_swiftshader_) {
671 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader"); 666 command_line->AppendSwitchASCII(switches::kUseGL, "swiftshader");
672 if (swiftshader_path.empty()) 667 if (swiftshader_path.empty())
673 swiftshader_path = swiftshader_path_; 668 swiftshader_path = swiftshader_path_;
674 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) || 669 } else if ((IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL) ||
675 IsFeatureBlacklisted( 670 IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING) ||
676 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) ||
677 IsFeatureBlacklisted( 671 IsFeatureBlacklisted(
678 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && 672 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) &&
679 (use_gl == "any")) { 673 (use_gl == "any")) {
680 command_line->AppendSwitchASCII( 674 command_line->AppendSwitchASCII(
681 switches::kUseGL, gfx::kGLImplementationOSMesaName); 675 switches::kUseGL, gfx::kGLImplementationOSMesaName);
682 } else if (!use_gl.empty()) { 676 } else if (!use_gl.empty()) {
683 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); 677 command_line->AppendSwitchASCII(switches::kUseGL, use_gl);
684 } 678 }
685 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) 679 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
686 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); 680 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true");
687 else 681 else
688 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); 682 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
689 683
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 } 717 }
724 718
725 void GpuDataManagerImplPrivate::AppendPluginCommandLine( 719 void GpuDataManagerImplPrivate::AppendPluginCommandLine(
726 CommandLine* command_line) const { 720 CommandLine* command_line) const {
727 DCHECK(command_line); 721 DCHECK(command_line);
728 722
729 #if defined(OS_MACOSX) 723 #if defined(OS_MACOSX)
730 // TODO(jbauman): Add proper blacklist support for core animation plugins so 724 // TODO(jbauman): Add proper blacklist support for core animation plugins so
731 // special-casing this video card won't be necessary. See 725 // special-casing this video card won't be necessary. See
732 // http://crbug.com/134015 726 // http://crbug.com/134015
733 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) { 727 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) {
734 if (!command_line->HasSwitch( 728 if (!command_line->HasSwitch(
735 switches::kDisableCoreAnimationPlugins)) 729 switches::kDisableCoreAnimationPlugins))
736 command_line->AppendSwitch( 730 command_line->AppendSwitch(
737 switches::kDisableCoreAnimationPlugins); 731 switches::kDisableCoreAnimationPlugins);
738 } 732 }
739 #endif 733 #endif
740 } 734 }
741 735
742 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( 736 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs(
743 WebPreferences* prefs) const { 737 WebPreferences* prefs) const {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 gpu_info_.secondary_gpus[ii].active = false; 881 gpu_info_.secondary_gpus[ii].active = false;
888 } 882 }
889 } 883 }
890 gpu_info_.gpu.active = false; 884 gpu_info_.gpu.active = false;
891 } 885 }
892 UpdateGpuInfoHelper(); 886 UpdateGpuInfoHelper();
893 return true; 887 return true;
894 } 888 }
895 889
896 bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const { 890 bool GpuDataManagerImplPrivate::CanUseGpuBrowserCompositor() const {
897 return !ShouldUseSwiftShader() && 891 if (ShouldUseSwiftShader())
898 !IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING); 892 return false;
893 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
894 return false;
895 return true;
899 } 896 }
900 897
901 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs( 898 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs(
902 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) { 899 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) {
903 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now()); 900 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now());
904 } 901 }
905 902
906 bool GpuDataManagerImplPrivate::Are3DAPIsBlocked(const GURL& url, 903 bool GpuDataManagerImplPrivate::Are3DAPIsBlocked(const GURL& url,
907 int render_process_id, 904 int render_process_id,
908 int render_view_id, 905 int render_view_id,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 } 1000 }
1004 1001
1005 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures( 1002 void GpuDataManagerImplPrivate::UpdateBlacklistedFeatures(
1006 const std::set<int>& features) { 1003 const std::set<int>& features) {
1007 CommandLine* command_line = CommandLine::ForCurrentProcess(); 1004 CommandLine* command_line = CommandLine::ForCurrentProcess();
1008 blacklisted_features_ = features; 1005 blacklisted_features_ = features;
1009 1006
1010 // Force disable using the GPU for these features, even if they would 1007 // Force disable using the GPU for these features, even if they would
1011 // otherwise be allowed. 1008 // otherwise be allowed.
1012 if (card_blacklisted_ || 1009 if (card_blacklisted_ ||
1013 command_line->HasSwitch(switches::kBlacklistAcceleratedCompositing)) { 1010 command_line->HasSwitch(switches::kBlacklistGpuCompositing)) {
1014 blacklisted_features_.insert( 1011 blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING);
1015 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING);
1016 } 1012 }
1017 if (card_blacklisted_ || 1013 if (card_blacklisted_ ||
1018 command_line->HasSwitch(switches::kBlacklistWebGL)) { 1014 command_line->HasSwitch(switches::kBlacklistWebGL)) {
1019 blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL); 1015 blacklisted_features_.insert(gpu::GPU_FEATURE_TYPE_WEBGL);
1020 } 1016 }
1021 1017
1022 EnableSwiftShaderIfNecessary(); 1018 EnableSwiftShaderIfNecessary();
1023 } 1019 }
1024 1020
1025 void GpuDataManagerImplPrivate::UpdatePreliminaryBlacklistedFeatures() { 1021 void GpuDataManagerImplPrivate::UpdatePreliminaryBlacklistedFeatures() {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1156
1161 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1157 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1162 gpu_process_accessible_ = false; 1158 gpu_process_accessible_ = false;
1163 gpu_info_.finalized = true; 1159 gpu_info_.finalized = true;
1164 complete_gpu_info_already_requested_ = true; 1160 complete_gpu_info_already_requested_ = true;
1165 // Some observers might be waiting. 1161 // Some observers might be waiting.
1166 NotifyGpuInfoUpdate(); 1162 NotifyGpuInfoUpdate();
1167 } 1163 }
1168 1164
1169 } // namespace content 1165 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698