OLD | NEW |
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 "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 !GpuDataManagerImpl::GetInstance()-> | 37 !GpuDataManagerImpl::GetInstance()-> |
38 GetGPUInfo().SupportsAccelerated2dCanvas(), | 38 GetGPUInfo().SupportsAccelerated2dCanvas(), |
39 "Accelerated 2D canvas is unavailable: either disabled at the command" | 39 "Accelerated 2D canvas is unavailable: either disabled at the command" |
40 " line or not supported by the current system.", | 40 " line or not supported by the current system.", |
41 true | 41 true |
42 }, | 42 }, |
43 { | 43 { |
44 "compositing", | 44 "compositing", |
45 manager->IsFeatureBlacklisted( | 45 manager->IsFeatureBlacklisted( |
46 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING), | 46 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING), |
47 command_line.HasSwitch(switches::kDisableAcceleratedCompositing), | 47 false, |
48 "Accelerated compositing has been disabled, either via about:flags or" | 48 "Accelerated compositing has been disabled, either via about:flags or" |
49 " command line. This adversely affects performance of all hardware" | 49 " command line. This adversely affects performance of all hardware" |
50 " accelerated features.", | 50 " accelerated features.", |
51 true | 51 true |
52 }, | 52 }, |
53 { | 53 { |
54 "3d_css", | 54 "3d_css", |
55 manager->IsFeatureBlacklisted( | 55 manager->IsFeatureBlacklisted( |
56 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || | 56 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || |
57 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), | 57 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), |
58 command_line.HasSwitch(switches::kDisableAcceleratedLayers), | 58 command_line.HasSwitch(switches::kDisableAcceleratedLayers), |
59 "Accelerated layers have been disabled at the command line.", | 59 "Accelerated layers have been disabled at the command line.", |
60 false | 60 false |
61 }, | 61 }, |
62 { | 62 { |
63 "css_animation", | 63 "css_animation", |
64 manager->IsFeatureBlacklisted( | 64 manager->IsFeatureBlacklisted( |
65 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || | 65 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || |
66 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), | 66 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), |
67 command_line.HasSwitch(cc::switches::kDisableThreadedAnimation) || | 67 command_line.HasSwitch(cc::switches::kDisableThreadedAnimation) || |
68 command_line.HasSwitch(switches::kDisableAcceleratedCompositing) || | |
69 command_line.HasSwitch(switches::kDisableAcceleratedLayers), | 68 command_line.HasSwitch(switches::kDisableAcceleratedLayers), |
70 "Accelerated CSS animation has been disabled at the command line.", | 69 "Accelerated CSS animation has been disabled at the command line.", |
71 true | 70 true |
72 }, | 71 }, |
73 { | 72 { |
74 "webgl", | 73 "webgl", |
75 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), | 74 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), |
76 command_line.HasSwitch(switches::kDisableExperimentalWebGL), | 75 command_line.HasSwitch(switches::kDisableExperimentalWebGL), |
77 "WebGL has been disabled, either via about:flags or command line.", | 76 "WebGL has been disabled, either via about:flags or command line.", |
78 false | 77 false |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 command_line.HasSwitch(switches::kDisableWebRtcHWEncoding), | 119 command_line.HasSwitch(switches::kDisableWebRtcHWEncoding), |
121 "Accelerated video encode has been disabled, either via about:flags" | 120 "Accelerated video encode has been disabled, either via about:flags" |
122 " or command line.", | 121 " or command line.", |
123 true | 122 true |
124 }, | 123 }, |
125 #endif | 124 #endif |
126 { | 125 { |
127 "video", | 126 "video", |
128 manager->IsFeatureBlacklisted( | 127 manager->IsFeatureBlacklisted( |
129 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO), | 128 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO), |
130 command_line.HasSwitch(switches::kDisableAcceleratedVideo) || | 129 command_line.HasSwitch(switches::kDisableAcceleratedVideo), |
131 command_line.HasSwitch(switches::kDisableAcceleratedCompositing), | |
132 "Accelerated video presentation has been disabled, either via" | 130 "Accelerated video presentation has been disabled, either via" |
133 " about:flags or command line.", | 131 " about:flags or command line.", |
134 true | 132 true |
135 }, | 133 }, |
136 #if defined(OS_CHROMEOS) | 134 #if defined(OS_CHROMEOS) |
137 { | 135 { |
138 "panel_fitting", | 136 "panel_fitting", |
139 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING), | 137 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING), |
140 command_line.HasSwitch(switches::kDisablePanelFitting), | 138 command_line.HasSwitch(switches::kDisablePanelFitting), |
141 "Panel fitting has been disabled, either via about:flags or command" | 139 "Panel fitting has been disabled, either via about:flags or command" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // accelerated compositing is blacklisted. | 174 // accelerated compositing is blacklisted. |
177 if (!manager->GpuAccessAllowed(NULL) || | 175 if (!manager->GpuAccessAllowed(NULL) || |
178 manager->IsFeatureBlacklisted( | 176 manager->IsFeatureBlacklisted( |
179 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) | 177 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) |
180 return false; | 178 return false; |
181 | 179 |
182 // Check for SwiftShader. | 180 // Check for SwiftShader. |
183 if (manager->ShouldUseSwiftShader()) | 181 if (manager->ShouldUseSwiftShader()) |
184 return false; | 182 return false; |
185 | 183 |
186 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
187 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) | |
188 return false; | |
189 | |
190 return true; | 184 return true; |
191 } | 185 } |
192 | 186 |
193 bool IsForceCompositingModeBlacklisted() { | 187 bool IsForceCompositingModeBlacklisted() { |
194 return GpuDataManagerImpl::GetInstance()->IsFeatureBlacklisted( | 188 return GpuDataManagerImpl::GetInstance()->IsFeatureBlacklisted( |
195 gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); | 189 gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); |
196 } | 190 } |
197 | 191 |
198 } // namespace | 192 } // namespace |
199 | 193 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 bool IsForceGpuRasterizationEnabled() { | 290 bool IsForceGpuRasterizationEnabled() { |
297 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 291 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
298 | 292 |
299 if (!IsImplSidePaintingEnabled()) | 293 if (!IsImplSidePaintingEnabled()) |
300 return false; | 294 return false; |
301 | 295 |
302 return command_line.HasSwitch(switches::kForceGpuRasterization); | 296 return command_line.HasSwitch(switches::kForceGpuRasterization); |
303 } | 297 } |
304 | 298 |
305 base::Value* GetFeatureStatus() { | 299 base::Value* GetFeatureStatus() { |
306 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
307 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 300 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
308 std::string gpu_access_blocked_reason; | 301 std::string gpu_access_blocked_reason; |
309 bool gpu_access_blocked = | 302 bool gpu_access_blocked = |
310 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); | 303 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); |
311 | 304 |
312 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); | 305 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); |
313 | 306 |
314 bool eof = false; | 307 bool eof = false; |
315 for (size_t i = 0; !eof; ++i) { | 308 for (size_t i = 0; !eof; ++i) { |
316 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); | 309 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); |
(...skipping 22 matching lines...) Expand all Loading... |
339 } else if (gpu_feature_info.blocked || | 332 } else if (gpu_feature_info.blocked || |
340 gpu_access_blocked) { | 333 gpu_access_blocked) { |
341 status = "unavailable"; | 334 status = "unavailable"; |
342 if (gpu_feature_info.fallback_to_software) | 335 if (gpu_feature_info.fallback_to_software) |
343 status += "_software"; | 336 status += "_software"; |
344 else | 337 else |
345 status += "_off"; | 338 status += "_off"; |
346 } else { | 339 } else { |
347 status = "enabled"; | 340 status = "enabled"; |
348 if (gpu_feature_info.name == "webgl" && | 341 if (gpu_feature_info.name == "webgl" && |
349 (command_line.HasSwitch(switches::kDisableAcceleratedCompositing) || | 342 (manager->IsFeatureBlacklisted( |
350 manager->IsFeatureBlacklisted( | 343 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) |
351 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) | |
352 status += "_readback"; | 344 status += "_readback"; |
353 bool has_thread = IsThreadedCompositingEnabled(); | 345 bool has_thread = IsThreadedCompositingEnabled(); |
354 if (gpu_feature_info.name == "compositing") { | 346 if (gpu_feature_info.name == "compositing") { |
355 bool force_compositing = IsForceCompositingModeEnabled(); | 347 bool force_compositing = IsForceCompositingModeEnabled(); |
356 if (force_compositing) | 348 if (force_compositing) |
357 status += "_force"; | 349 status += "_force"; |
358 if (has_thread) | 350 if (has_thread) |
359 status += "_threaded"; | 351 status += "_threaded"; |
360 } else if (gpu_feature_info.name == "css_animation") { | 352 } else if (gpu_feature_info.name == "css_animation") { |
361 if (has_thread) | 353 if (has_thread) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 return problem_list; | 406 return problem_list; |
415 } | 407 } |
416 | 408 |
417 base::Value* GetDriverBugWorkarounds() { | 409 base::Value* GetDriverBugWorkarounds() { |
418 base::ListValue* workaround_list = new base::ListValue(); | 410 base::ListValue* workaround_list = new base::ListValue(); |
419 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); | 411 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); |
420 return workaround_list; | 412 return workaround_list; |
421 } | 413 } |
422 | 414 |
423 } // namespace content | 415 } // namespace content |
OLD | NEW |