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

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

Issue 344653004: Cleanup logic that generates about:gpu feature status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed gpu switching labels Created 6 years, 6 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
« no previous file with comments | « no previous file | content/browser/resources/gpu/info_view.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/compositor_util.h" 5 #include "content/browser/gpu/compositor_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 19 matching lines...) Expand all
30 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION_FIELD_TRIAL); 30 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION_FIELD_TRIAL);
31 } 31 }
32 32
33 return manager->IsFeatureBlacklisted( 33 return manager->IsFeatureBlacklisted(
34 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); 34 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION);
35 } 35 }
36 36
37 const char* kGpuCompositingFeatureName = "gpu_compositing"; 37 const char* kGpuCompositingFeatureName = "gpu_compositing";
38 const char* kWebGLFeatureName = "webgl"; 38 const char* kWebGLFeatureName = "webgl";
39 const char* kRasterizationFeatureName = "rasterization"; 39 const char* kRasterizationFeatureName = "rasterization";
40 const char* kThreadedRasterizationFeatureName = "threaded_rasterization";
40 41
41 struct GpuFeatureInfo { 42 struct GpuFeatureInfo {
42 std::string name; 43 std::string name;
43 uint32 blocked; 44 bool blocked;
44 bool disabled; 45 bool disabled;
45 std::string disabled_description; 46 std::string disabled_description;
46 bool fallback_to_software; 47 bool fallback_to_software;
47 }; 48 };
48 49
49 const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) { 50 const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) {
50 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 51 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
51 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 52 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
52 53
53 const GpuFeatureInfo kGpuFeatureInfo[] = { 54 const GpuFeatureInfo kGpuFeatureInfo[] = {
(...skipping 23 matching lines...) Expand all
77 command_line.HasSwitch(switches::kDisableExperimentalWebGL), 78 command_line.HasSwitch(switches::kDisableExperimentalWebGL),
78 "WebGL has been disabled, either via about:flags or command line.", 79 "WebGL has been disabled, either via about:flags or command line.",
79 false 80 false
80 }, 81 },
81 { 82 {
82 "flash_3d", 83 "flash_3d",
83 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D), 84 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D),
84 command_line.HasSwitch(switches::kDisableFlash3d), 85 command_line.HasSwitch(switches::kDisableFlash3d),
85 "Using 3d in flash has been disabled, either via about:flags or" 86 "Using 3d in flash has been disabled, either via about:flags or"
86 " command line.", 87 " command line.",
87 false 88 true
88 }, 89 },
89 { 90 {
90 "flash_stage3d", 91 "flash_stage3d",
91 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), 92 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D),
92 command_line.HasSwitch(switches::kDisableFlashStage3d), 93 command_line.HasSwitch(switches::kDisableFlashStage3d),
93 "Using Stage3d in Flash has been disabled, either via about:flags or" 94 "Using Stage3d in Flash has been disabled, either via about:flags or"
94 " command line.", 95 " command line.",
95 false 96 true
96 }, 97 },
97 { 98 {
98 "flash_stage3d_baseline", 99 "flash_stage3d_baseline",
99 manager->IsFeatureBlacklisted( 100 manager->IsFeatureBlacklisted(
100 gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE) || 101 gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE) ||
101 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), 102 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D),
102 command_line.HasSwitch(switches::kDisableFlashStage3d), 103 command_line.HasSwitch(switches::kDisableFlashStage3d),
103 "Using Stage3d Baseline profile in Flash has been disabled, either" 104 "Using Stage3d Baseline profile in Flash has been disabled, either"
104 " via about:flags or command line.", 105 " via about:flags or command line.",
105 false 106 true
106 }, 107 },
107 { 108 {
108 "video_decode", 109 "video_decode",
109 manager->IsFeatureBlacklisted( 110 manager->IsFeatureBlacklisted(
110 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), 111 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE),
111 command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), 112 command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode),
112 "Accelerated video decode has been disabled, either via about:flags" 113 "Accelerated video decode has been disabled, either via about:flags"
113 " or command line.", 114 " or command line.",
114 true 115 true
115 }, 116 },
(...skipping 17 matching lines...) Expand all
133 " line.", 134 " line.",
134 false 135 false
135 }, 136 },
136 #endif 137 #endif
137 { 138 {
138 kRasterizationFeatureName, 139 kRasterizationFeatureName,
139 IsGpuRasterizationBlacklisted() && 140 IsGpuRasterizationBlacklisted() &&
140 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(), 141 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(),
141 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && 142 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() &&
142 !IsGpuRasterizationBlacklisted(), 143 !IsGpuRasterizationBlacklisted(),
143 "Accelerated rasterization has not been enabled or" 144 "Accelerated rasterization has been disabled, either via about:flags"
145 " or command line.",
146 true
147 },
148 {
149 kThreadedRasterizationFeatureName,
150 false,
151 !IsImplSidePaintingEnabled(),
152 "Threaded rasterization has not been enabled or"
144 " is not supported by the current system.", 153 " is not supported by the current system.",
145 true 154 false
146 } 155 }
156
147 }; 157 };
148 DCHECK(index < arraysize(kGpuFeatureInfo)); 158 DCHECK(index < arraysize(kGpuFeatureInfo));
149 *eof = (index == arraysize(kGpuFeatureInfo) - 1); 159 *eof = (index == arraysize(kGpuFeatureInfo) - 1);
150 return kGpuFeatureInfo[index]; 160 return kGpuFeatureInfo[index];
151 } 161 }
152 162
153 } // namespace 163 } // namespace
154 164
155 bool IsPinchVirtualViewportEnabled() { 165 bool IsPinchVirtualViewportEnabled() {
156 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 166 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); 271 !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
262 272
263 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); 273 base::DictionaryValue* feature_status_dict = new base::DictionaryValue();
264 274
265 bool eof = false; 275 bool eof = false;
266 for (size_t i = 0; !eof; ++i) { 276 for (size_t i = 0; !eof; ++i) {
267 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); 277 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof);
268 std::string status; 278 std::string status;
269 if (gpu_feature_info.disabled) { 279 if (gpu_feature_info.disabled) {
270 status = "disabled"; 280 status = "disabled";
271 if (gpu_feature_info.name == kRasterizationFeatureName) {
272 if (IsImplSidePaintingEnabled())
273 status += "_software_multithreaded";
274 else
275 status += "_software";
276 } else {
277 if (gpu_feature_info.fallback_to_software)
278 status += "_software";
279 else
280 status += "_off";
281 }
282 } else if (manager->ShouldUseSwiftShader()) {
283 status = "unavailable_software";
284 } else if (gpu_feature_info.blocked ||
285 gpu_access_blocked) {
286 status = "unavailable";
287 if (gpu_feature_info.fallback_to_software) 281 if (gpu_feature_info.fallback_to_software)
288 status += "_software"; 282 status += "_software";
289 else 283 else
290 status += "_off"; 284 status += "_off";
285 if (gpu_feature_info.name == kThreadedRasterizationFeatureName)
286 status += "_ok";
287 } else if (gpu_feature_info.blocked ||
288 gpu_access_blocked) {
289 status = "unavailable";
290 if (gpu_feature_info.fallback_to_software) {
291 status += "_software";
292 } else
293 status += "_off";
291 } else { 294 } else {
292 status = "enabled"; 295 status = "enabled";
293 if (gpu_feature_info.name == kWebGLFeatureName && 296 if (gpu_feature_info.name == kWebGLFeatureName &&
294 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) 297 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
295 status += "_readback"; 298 status += "_readback";
296 if (gpu_feature_info.name == kRasterizationFeatureName) { 299 if (gpu_feature_info.name == kRasterizationFeatureName) {
297 if (IsForceGpuRasterizationEnabled()) 300 if (IsForceGpuRasterizationEnabled())
298 status += "_force"; 301 status += "_force";
299 } 302 }
303 if (gpu_feature_info.name == kThreadedRasterizationFeatureName)
304 status += "_on";
300 } 305 }
301 if (gpu_feature_info.name == kGpuCompositingFeatureName) { 306 if (gpu_feature_info.name == kGpuCompositingFeatureName) {
302 if (IsThreadedCompositingEnabled()) 307 if (IsThreadedCompositingEnabled())
303 status += "_threaded"; 308 status += "_threaded";
304 } 309 }
310 if (gpu_feature_info.name == kWebGLFeatureName &&
311 (gpu_feature_info.blocked || gpu_access_blocked) &&
312 manager->ShouldUseSwiftShader()) {
313 status = "unavailable_software";
314 }
315
305 feature_status_dict->SetString( 316 feature_status_dict->SetString(
306 gpu_feature_info.name.c_str(), status.c_str()); 317 gpu_feature_info.name.c_str(), status.c_str());
307 } 318 }
308 return feature_status_dict; 319 return feature_status_dict;
309 } 320 }
310 321
311 base::Value* GetProblems() { 322 base::Value* GetProblems() {
312 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 323 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
313 std::string gpu_access_blocked_reason; 324 std::string gpu_access_blocked_reason;
314 bool gpu_access_blocked = 325 bool gpu_access_blocked =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 return problem_list; 360 return problem_list;
350 } 361 }
351 362
352 base::Value* GetDriverBugWorkarounds() { 363 base::Value* GetDriverBugWorkarounds() {
353 base::ListValue* workaround_list = new base::ListValue(); 364 base::ListValue* workaround_list = new base::ListValue();
354 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); 365 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list);
355 return workaround_list; 366 return workaround_list;
356 } 367 }
357 368
358 } // namespace content 369 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/resources/gpu/info_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698