| 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 "base/metrics/field_trial.h" |
| 9 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 10 #include "cc/base/switches.h" | 11 #include "cc/base/switches.h" |
| 11 #include "content/browser/gpu/gpu_data_manager_impl.h" | 12 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
| 13 #include "gpu/config/gpu_feature_type.h" | 14 #include "gpu/config/gpu_feature_type.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| 20 static bool IsGpuRasterizationBlacklisted() { |
| 21 bool field_trial_enabled = |
| 22 (base::FieldTrialList::FindFullName( |
| 23 "GpuRasterizationExpandedDeviceWhitelist") == "Enabled"); |
| 24 |
| 25 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
| 26 if (field_trial_enabled) { |
| 27 return manager->IsFeatureBlacklisted( |
| 28 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION_FIELD_TRIAL); |
| 29 } |
| 30 |
| 31 return manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); |
| 32 } |
| 33 |
| 19 const char* kGpuCompositingFeatureName = "gpu_compositing"; | 34 const char* kGpuCompositingFeatureName = "gpu_compositing"; |
| 20 const char* kWebGLFeatureName = "webgl"; | 35 const char* kWebGLFeatureName = "webgl"; |
| 21 const char* kRasterizationFeatureName = "rasterization"; | 36 const char* kRasterizationFeatureName = "rasterization"; |
| 22 | 37 |
| 23 struct GpuFeatureInfo { | 38 struct GpuFeatureInfo { |
| 24 std::string name; | 39 std::string name; |
| 25 uint32 blocked; | 40 uint32 blocked; |
| 26 bool disabled; | 41 bool disabled; |
| 27 std::string disabled_description; | 42 std::string disabled_description; |
| 28 bool fallback_to_software; | 43 bool fallback_to_software; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 "panel_fitting", | 126 "panel_fitting", |
| 112 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING), | 127 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING), |
| 113 command_line.HasSwitch(switches::kDisablePanelFitting), | 128 command_line.HasSwitch(switches::kDisablePanelFitting), |
| 114 "Panel fitting has been disabled, either via about:flags or command" | 129 "Panel fitting has been disabled, either via about:flags or command" |
| 115 " line.", | 130 " line.", |
| 116 false | 131 false |
| 117 }, | 132 }, |
| 118 #endif | 133 #endif |
| 119 { | 134 { |
| 120 kRasterizationFeatureName, | 135 kRasterizationFeatureName, |
| 121 manager->IsFeatureBlacklisted( | 136 IsGpuRasterizationBlacklisted() && |
| 122 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION) && | |
| 123 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(), | 137 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(), |
| 124 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && | 138 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && |
| 125 !manager->IsFeatureBlacklisted( | 139 !IsGpuRasterizationBlacklisted(), |
| 126 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION), | |
| 127 "Accelerated rasterization has not been enabled or" | 140 "Accelerated rasterization has not been enabled or" |
| 128 " is not supported by the current system.", | 141 " is not supported by the current system.", |
| 129 true | 142 true |
| 130 } | 143 } |
| 131 }; | 144 }; |
| 132 DCHECK(index < arraysize(kGpuFeatureInfo)); | 145 DCHECK(index < arraysize(kGpuFeatureInfo)); |
| 133 *eof = (index == arraysize(kGpuFeatureInfo) - 1); | 146 *eof = (index == arraysize(kGpuFeatureInfo) - 1); |
| 134 return kGpuFeatureInfo[index]; | 147 return kGpuFeatureInfo[index]; |
| 135 } | 148 } |
| 136 | 149 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 228 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 216 | 229 |
| 217 if (!IsImplSidePaintingEnabled()) | 230 if (!IsImplSidePaintingEnabled()) |
| 218 return false; | 231 return false; |
| 219 | 232 |
| 220 if (command_line.HasSwitch(switches::kDisableGpuRasterization)) | 233 if (command_line.HasSwitch(switches::kDisableGpuRasterization)) |
| 221 return false; | 234 return false; |
| 222 else if (command_line.HasSwitch(switches::kEnableGpuRasterization)) | 235 else if (command_line.HasSwitch(switches::kEnableGpuRasterization)) |
| 223 return true; | 236 return true; |
| 224 | 237 |
| 225 if (GpuDataManagerImpl::GetInstance()->IsFeatureBlacklisted( | 238 if (IsGpuRasterizationBlacklisted()) { |
| 226 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION)) { | |
| 227 return false; | 239 return false; |
| 228 } | 240 } |
| 229 | 241 |
| 230 return true; | 242 return true; |
| 231 } | 243 } |
| 232 | 244 |
| 233 bool IsForceGpuRasterizationEnabled() { | 245 bool IsForceGpuRasterizationEnabled() { |
| 234 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 246 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 235 | 247 |
| 236 if (!IsImplSidePaintingEnabled()) | 248 if (!IsImplSidePaintingEnabled()) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 return problem_list; | 346 return problem_list; |
| 335 } | 347 } |
| 336 | 348 |
| 337 base::Value* GetDriverBugWorkarounds() { | 349 base::Value* GetDriverBugWorkarounds() { |
| 338 base::ListValue* workaround_list = new base::ListValue(); | 350 base::ListValue* workaround_list = new base::ListValue(); |
| 339 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); | 351 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); |
| 340 return workaround_list; | 352 return workaround_list; |
| 341 } | 353 } |
| 342 | 354 |
| 343 } // namespace content | 355 } // namespace content |
| OLD | NEW |