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