| 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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 std::string disabled_description; | 48 std::string disabled_description; |
| 49 bool fallback_to_software; | 49 bool fallback_to_software; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) { | 52 const GpuFeatureInfo GetGpuFeatureInfo(size_t index, bool* eof) { |
| 53 const base::CommandLine& command_line = | 53 const base::CommandLine& command_line = |
| 54 *base::CommandLine::ForCurrentProcess(); | 54 *base::CommandLine::ForCurrentProcess(); |
| 55 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 55 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
| 56 | 56 |
| 57 const GpuFeatureInfo kGpuFeatureInfo[] = { | 57 const GpuFeatureInfo kGpuFeatureInfo[] = { |
| 58 { | 58 {"2d_canvas", |
| 59 "2d_canvas", | 59 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), |
| 60 manager->IsFeatureBlacklisted( | 60 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || |
| 61 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), | 61 !GpuDataManagerImpl::GetInstance() |
| 62 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || | 62 ->GetGPUInfo() |
| 63 !GpuDataManagerImpl::GetInstance()-> | 63 .SupportsAccelerated2dCanvas(), |
| 64 GetGPUInfo().SupportsAccelerated2dCanvas(), | 64 "Accelerated 2D canvas is unavailable: either disabled via blacklist or" |
| 65 "Accelerated 2D canvas is unavailable: either disabled at the command" | 65 " the command line.", |
| 66 " line or not supported by the current system.", | 66 true}, |
| 67 true | 67 {kGpuCompositingFeatureName, |
| 68 }, | 68 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING), |
| 69 { | 69 command_line.HasSwitch(switches::kDisableGpuCompositing), |
| 70 kGpuCompositingFeatureName, | 70 "Gpu compositing has been disabled, either via blacklist, about:flags" |
| 71 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING), | 71 " or the command line. The browser will fall back to software compositing" |
| 72 command_line.HasSwitch(switches::kDisableGpuCompositing), | 72 " and hardware acceleration will be unavailable.", |
| 73 "Gpu compositing has been disabled, either via about:flags or" | 73 true}, |
| 74 " command line. The browser will fall back to software compositing" | 74 {kWebGLFeatureName, |
| 75 " and hardware acceleration will be unavailable.", | 75 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), |
| 76 true | 76 command_line.HasSwitch(switches::kDisableExperimentalWebGL), |
| 77 }, | 77 "WebGL has been disabled via blacklist or the command line.", false}, |
| 78 { | 78 {"flash_3d", manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D), |
| 79 kWebGLFeatureName, | 79 command_line.HasSwitch(switches::kDisableFlash3d), |
| 80 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL), | 80 "Using 3d in flash has been disabled, either via blacklist, about:flags or" |
| 81 command_line.HasSwitch(switches::kDisableExperimentalWebGL), | 81 " the command line.", |
| 82 "WebGL has been disabled via the command line.", | 82 true}, |
| 83 false | 83 {"flash_stage3d", |
| 84 }, | 84 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), |
| 85 { | 85 command_line.HasSwitch(switches::kDisableFlashStage3d), |
| 86 "flash_3d", | 86 "Using Stage3d in Flash has been disabled, either via blacklist," |
| 87 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D), | 87 " about:flags or the command line.", |
| 88 command_line.HasSwitch(switches::kDisableFlash3d), | 88 true}, |
| 89 "Using 3d in flash has been disabled, either via about:flags or" | 89 {"flash_stage3d_baseline", |
| 90 " command line.", | 90 manager->IsFeatureBlacklisted( |
| 91 true | 91 gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE) || |
| 92 }, | 92 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), |
| 93 { | 93 command_line.HasSwitch(switches::kDisableFlashStage3d), |
| 94 "flash_stage3d", | 94 "Using Stage3d Baseline profile in Flash has been disabled, either" |
| 95 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), | 95 " via blacklist, about:flags or the command line.", |
| 96 command_line.HasSwitch(switches::kDisableFlashStage3d), | 96 true}, |
| 97 "Using Stage3d in Flash has been disabled, either via about:flags or" | 97 {"video_decode", manager->IsFeatureBlacklisted( |
| 98 " command line.", | 98 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), |
| 99 true | 99 command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), |
| 100 }, | 100 "Accelerated video decode has been disabled, either via blacklist," |
| 101 { | 101 " about:flags or the command line.", |
| 102 "flash_stage3d_baseline", | 102 true}, |
| 103 manager->IsFeatureBlacklisted( | |
| 104 gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE) || | |
| 105 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D), | |
| 106 command_line.HasSwitch(switches::kDisableFlashStage3d), | |
| 107 "Using Stage3d Baseline profile in Flash has been disabled, either" | |
| 108 " via about:flags or command line.", | |
| 109 true | |
| 110 }, | |
| 111 { | |
| 112 "video_decode", | |
| 113 manager->IsFeatureBlacklisted( | |
| 114 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE), | |
| 115 command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode), | |
| 116 "Accelerated video decode has been disabled, either via about:flags" | |
| 117 " or command line.", | |
| 118 true | |
| 119 }, | |
| 120 #if defined(ENABLE_WEBRTC) | 103 #if defined(ENABLE_WEBRTC) |
| 121 { | 104 {"video_encode", manager->IsFeatureBlacklisted( |
| 122 "video_encode", | 105 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE), |
| 123 manager->IsFeatureBlacklisted( | 106 command_line.HasSwitch(switches::kDisableWebRtcHWEncoding), |
| 124 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE), | 107 "Accelerated video encode has been disabled, either via blacklist," |
| 125 command_line.HasSwitch(switches::kDisableWebRtcHWEncoding), | 108 " about:flags or the command line.", |
| 126 "Accelerated video encode has been disabled, either via about:flags" | 109 true}, |
| 127 " or command line.", | |
| 128 true | |
| 129 }, | |
| 130 #endif | 110 #endif |
| 131 #if defined(OS_CHROMEOS) | 111 #if defined(OS_CHROMEOS) |
| 132 { | 112 {"panel_fitting", |
| 133 "panel_fitting", | 113 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING), |
| 134 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_PANEL_FITTING), | 114 command_line.HasSwitch(switches::kDisablePanelFitting), |
| 135 command_line.HasSwitch(switches::kDisablePanelFitting), | 115 "Panel fitting has been disabled, either via blacklist, about:flags or" |
| 136 "Panel fitting has been disabled, either via about:flags or command" | 116 " the command line.", |
| 137 " line.", | 117 false}, |
| 138 false | |
| 139 }, | |
| 140 #endif | 118 #endif |
| 141 { | 119 {kRasterizationFeatureName, |
| 142 kRasterizationFeatureName, | 120 IsGpuRasterizationBlacklisted() && !IsGpuRasterizationEnabled() && |
| 143 IsGpuRasterizationBlacklisted() && | 121 !IsForceGpuRasterizationEnabled(), |
| 144 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled(), | 122 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && |
| 145 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && | 123 !IsGpuRasterizationBlacklisted(), |
| 146 !IsGpuRasterizationBlacklisted(), | 124 "Accelerated rasterization has been disabled, either via blacklist," |
| 147 "Accelerated rasterization has been disabled, either via about:flags" | 125 " about:flags or the command line.", |
| 148 " or command line.", | 126 true}, |
| 149 true | 127 {kMultipleRasterThreadsFeatureName, false, |
| 150 }, | 128 NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.", |
| 151 { | 129 false}, |
| 152 kMultipleRasterThreadsFeatureName, | 130 {kNativeGpuMemoryBuffersFeatureName, false, |
| 153 false, | 131 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(), |
| 154 NumberOfRendererRasterThreads() == 1, | 132 "Native GpuMemoryBuffers have been disabled, either via about:flags" |
| 155 "Raster is using a single thread.", | 133 " or command line.", |
| 156 false | 134 true}, |
| 157 }, | |
| 158 { | |
| 159 kNativeGpuMemoryBuffersFeatureName, | |
| 160 false, | |
| 161 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(), | |
| 162 "Native GpuMemoryBuffers have been disabled, either via about:flags" | |
| 163 " or command line.", | |
| 164 true | |
| 165 }, | |
| 166 }; | 135 }; |
| 167 DCHECK(index < arraysize(kGpuFeatureInfo)); | 136 DCHECK(index < arraysize(kGpuFeatureInfo)); |
| 168 *eof = (index == arraysize(kGpuFeatureInfo) - 1); | 137 *eof = (index == arraysize(kGpuFeatureInfo) - 1); |
| 169 return kGpuFeatureInfo[index]; | 138 return kGpuFeatureInfo[index]; |
| 170 } | 139 } |
| 171 | 140 |
| 172 } // namespace | 141 } // namespace |
| 173 | 142 |
| 174 int NumberOfRendererRasterThreads() { | 143 int NumberOfRendererRasterThreads() { |
| 175 int num_processors = base::SysInfo::NumberOfProcessors(); | 144 int num_processors = base::SysInfo::NumberOfProcessors(); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 363 } |
| 395 } | 364 } |
| 396 return problem_list; | 365 return problem_list; |
| 397 } | 366 } |
| 398 | 367 |
| 399 std::vector<std::string> GetDriverBugWorkarounds() { | 368 std::vector<std::string> GetDriverBugWorkarounds() { |
| 400 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); | 369 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); |
| 401 } | 370 } |
| 402 | 371 |
| 403 } // namespace content | 372 } // namespace content |
| OLD | NEW |