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 23 matching lines...) Expand all Loading... |
34 manager->IsFeatureBlacklisted( | 34 manager->IsFeatureBlacklisted( |
35 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), | 35 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), |
36 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || | 36 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || |
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 "gpu_compositing", |
45 manager->IsFeatureBlacklisted( | 45 manager->IsFeatureBlacklisted( |
46 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING), | 46 gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING), |
47 false, | 47 false, |
48 "Accelerated compositing has been disabled, either via about:flags or" | 48 "Gpu compositing has been disabled, either via about:flags or" |
49 " command line. This adversely affects performance of all hardware" | 49 " command line. The browser will fall back to software compositing" |
50 " accelerated features.", | 50 " and hardware acceleration will be unavailable.", |
51 true | 51 true |
52 }, | 52 }, |
53 { | 53 { |
54 "3d_css", | 54 "3d_css", |
55 manager->IsFeatureBlacklisted( | |
56 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || | |
57 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), | 55 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), |
58 command_line.HasSwitch(switches::kDisableAcceleratedLayers), | 56 command_line.HasSwitch(switches::kDisableAcceleratedLayers), |
59 "Accelerated layers have been disabled at the command line.", | 57 "Accelerated layers have been disabled at the command line.", |
60 false | 58 false |
61 }, | 59 }, |
62 { | 60 { |
63 "css_animation", | 61 "css_animation", |
64 manager->IsFeatureBlacklisted( | |
65 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || | |
66 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), | 62 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS), |
67 command_line.HasSwitch(cc::switches::kDisableThreadedAnimation) || | 63 command_line.HasSwitch(cc::switches::kDisableThreadedAnimation) || |
68 command_line.HasSwitch(switches::kDisableAcceleratedLayers), | 64 command_line.HasSwitch(switches::kDisableAcceleratedLayers), |
69 "Accelerated CSS animation has been disabled at the command line.", | 65 "Accelerated CSS animation has been disabled at the command line.", |
70 true | 66 true |
71 }, | 67 }, |
72 { | 68 { |
73 "webgl", | 69 "webgl", |
74 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), | 70 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), |
75 command_line.HasSwitch(switches::kDisableExperimentalWebGL), | 71 command_line.HasSwitch(switches::kDisableExperimentalWebGL), |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 DCHECK(index < arraysize(kGpuFeatureInfo)); | 157 DCHECK(index < arraysize(kGpuFeatureInfo)); |
162 *eof = (index == arraysize(kGpuFeatureInfo) - 1); | 158 *eof = (index == arraysize(kGpuFeatureInfo) - 1); |
163 return kGpuFeatureInfo[index]; | 159 return kGpuFeatureInfo[index]; |
164 } | 160 } |
165 | 161 |
166 bool CanDoAcceleratedCompositing() { | 162 bool CanDoAcceleratedCompositing() { |
167 const GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 163 const GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
168 | 164 |
169 // Don't use force compositing mode if gpu access has been blocked or | 165 // Don't use force compositing mode if gpu access has been blocked or |
170 // accelerated compositing is blacklisted. | 166 // accelerated compositing is blacklisted. |
171 if (!manager->GpuAccessAllowed(NULL) || | 167 if (!manager->GpuAccessAllowed(NULL)) |
172 manager->IsFeatureBlacklisted( | |
173 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) | |
174 return false; | 168 return false; |
175 | 169 |
176 // Check for SwiftShader. | 170 // Check for SwiftShader. |
177 if (manager->ShouldUseSwiftShader()) | 171 if (manager->ShouldUseSwiftShader()) |
178 return false; | 172 return false; |
179 | 173 |
180 return true; | 174 return true; |
181 } | 175 } |
182 | 176 |
183 } // namespace | 177 } // namespace |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } else if (gpu_feature_info.blocked || | 317 } else if (gpu_feature_info.blocked || |
324 gpu_access_blocked) { | 318 gpu_access_blocked) { |
325 status = "unavailable"; | 319 status = "unavailable"; |
326 if (gpu_feature_info.fallback_to_software) | 320 if (gpu_feature_info.fallback_to_software) |
327 status += "_software"; | 321 status += "_software"; |
328 else | 322 else |
329 status += "_off"; | 323 status += "_off"; |
330 } else { | 324 } else { |
331 status = "enabled"; | 325 status = "enabled"; |
332 if (gpu_feature_info.name == "webgl" && | 326 if (gpu_feature_info.name == "webgl" && |
333 (manager->IsFeatureBlacklisted( | 327 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) |
334 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) | |
335 status += "_readback"; | 328 status += "_readback"; |
336 bool has_thread = IsThreadedCompositingEnabled(); | 329 bool has_thread = IsThreadedCompositingEnabled(); |
337 if (gpu_feature_info.name == "compositing") { | 330 if (gpu_feature_info.name == "compositing") { |
338 bool force_compositing = IsForceCompositingModeEnabled(); | 331 bool force_compositing = IsForceCompositingModeEnabled(); |
339 if (force_compositing) | 332 if (force_compositing) |
340 status += "_force"; | 333 status += "_force"; |
341 if (has_thread) | 334 if (has_thread) |
342 status += "_threaded"; | 335 status += "_threaded"; |
343 } else if (gpu_feature_info.name == "css_animation") { | 336 } else if (gpu_feature_info.name == "css_animation") { |
344 if (has_thread) | 337 if (has_thread) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return problem_list; | 390 return problem_list; |
398 } | 391 } |
399 | 392 |
400 base::Value* GetDriverBugWorkarounds() { | 393 base::Value* GetDriverBugWorkarounds() { |
401 base::ListValue* workaround_list = new base::ListValue(); | 394 base::ListValue* workaround_list = new base::ListValue(); |
402 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); | 395 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); |
403 return workaround_list; | 396 return workaround_list; |
404 } | 397 } |
405 | 398 |
406 } // namespace content | 399 } // namespace content |
OLD | NEW |