| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/feature_list.h" | 13 #include "base/feature_list.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #include "cc/base/math_util.h" | 21 #include "cc/base/math_util.h" |
| 22 #include "cc/base/switches.h" | 22 #include "cc/base/switches.h" |
| 23 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 23 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 24 #include "content/browser/gpu/gpu_data_manager_impl.h" | 24 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 25 #include "content/public/browser/gpu_utils.h" | 25 #include "content/public/browser/gpu_utils.h" |
| 26 #include "content/public/common/content_features.h" | 26 #include "content/public/common/content_features.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "gpu/config/gpu_feature_type.h" | 28 #include "gpu/config/gpu_feature_type.h" |
| 29 #include "ui/gl/gl_switches.h" |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 static bool IsGpuRasterizationBlacklisted() { | 35 static bool IsGpuRasterizationBlacklisted() { |
| 35 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 36 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
| 36 return manager->IsFeatureBlacklisted( | 37 return manager->IsFeatureBlacklisted( |
| 37 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); | 38 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); |
| 38 } | 39 } |
| 39 | 40 |
| 40 const char kGpuCompositingFeatureName[] = "gpu_compositing"; | 41 const char kGpuCompositingFeatureName[] = "gpu_compositing"; |
| 41 const char kWebGLFeatureName[] = "webgl"; | 42 const char kWebGLFeatureName[] = "webgl"; |
| 42 const char kRasterizationFeatureName[] = "rasterization"; | 43 const char kRasterizationFeatureName[] = "rasterization"; |
| 43 const char kMultipleRasterThreadsFeatureName[] = "multiple_raster_threads"; | 44 const char kMultipleRasterThreadsFeatureName[] = "multiple_raster_threads"; |
| 44 const char kNativeGpuMemoryBuffersFeatureName[] = "native_gpu_memory_buffers"; | 45 const char kNativeGpuMemoryBuffersFeatureName[] = "native_gpu_memory_buffers"; |
| 46 const char kWebGL2FeatureName[] = "webgl2"; |
| 45 | 47 |
| 46 const int kMinRasterThreads = 1; | 48 const int kMinRasterThreads = 1; |
| 47 const int kMaxRasterThreads = 4; | 49 const int kMaxRasterThreads = 4; |
| 48 | 50 |
| 49 const int kMinMSAASampleCount = 0; | 51 const int kMinMSAASampleCount = 0; |
| 50 | 52 |
| 51 struct GpuFeatureInfo { | 53 struct GpuFeatureInfo { |
| 52 std::string name; | 54 std::string name; |
| 53 bool blocked; | 55 bool blocked; |
| 54 bool disabled; | 56 bool disabled; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 " about:flags or the command line.", | 138 " about:flags or the command line.", |
| 137 true}, | 139 true}, |
| 138 {kMultipleRasterThreadsFeatureName, false, | 140 {kMultipleRasterThreadsFeatureName, false, |
| 139 NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.", | 141 NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.", |
| 140 false}, | 142 false}, |
| 141 {kNativeGpuMemoryBuffersFeatureName, false, | 143 {kNativeGpuMemoryBuffersFeatureName, false, |
| 142 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(), | 144 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(), |
| 143 "Native GpuMemoryBuffers have been disabled, either via about:flags" | 145 "Native GpuMemoryBuffers have been disabled, either via about:flags" |
| 144 " or command line.", | 146 " or command line.", |
| 145 true}, | 147 true}, |
| 146 {"vpx_decode", manager->IsFeatureBlacklisted( | 148 {"vpx_decode", |
| 147 gpu::GPU_FEATURE_TYPE_ACCELERATED_VPX_DECODE) || | 149 manager->IsFeatureBlacklisted( |
| 148 manager->IsFeatureBlacklisted( | 150 gpu::GPU_FEATURE_TYPE_ACCELERATED_VPX_DECODE) || |
| 149 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), | 151 manager->IsFeatureBlacklisted( |
| 152 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), |
| 150 accelerated_vpx_disabled, | 153 accelerated_vpx_disabled, |
| 151 "Accelerated VPx video decode has been disabled, either via blacklist" | 154 "Accelerated VPx video decode has been disabled, either via blacklist" |
| 152 " or the command line.", | 155 " or the command line.", |
| 153 true}, | 156 true}, |
| 157 {kWebGL2FeatureName, |
| 158 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2), |
| 159 !command_line.HasSwitch(switches::kEnableUnsafeES3APIs) || |
| 160 command_line.HasSwitch(switches::kDisableES3APIs), |
| 161 "WebGL2 has been disabled via blacklist or the command line.", |
| 162 false}, |
| 154 }; | 163 }; |
| 155 DCHECK(index < arraysize(kGpuFeatureInfo)); | 164 DCHECK(index < arraysize(kGpuFeatureInfo)); |
| 156 *eof = (index == arraysize(kGpuFeatureInfo) - 1); | 165 *eof = (index == arraysize(kGpuFeatureInfo) - 1); |
| 157 return kGpuFeatureInfo[index]; | 166 return kGpuFeatureInfo[index]; |
| 158 } | 167 } |
| 159 | 168 |
| 160 } // namespace | 169 } // namespace |
| 161 | 170 |
| 162 int NumberOfRendererRasterThreads() { | 171 int NumberOfRendererRasterThreads() { |
| 163 int num_processors = base::SysInfo::NumberOfProcessors(); | 172 int num_processors = base::SysInfo::NumberOfProcessors(); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 } | 414 } |
| 406 } | 415 } |
| 407 return problem_list; | 416 return problem_list; |
| 408 } | 417 } |
| 409 | 418 |
| 410 std::vector<std::string> GetDriverBugWorkarounds() { | 419 std::vector<std::string> GetDriverBugWorkarounds() { |
| 411 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); | 420 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); |
| 412 } | 421 } |
| 413 | 422 |
| 414 } // namespace content | 423 } // namespace content |
| OLD | NEW |