Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: content/browser/gpu/compositor_util.cc

Issue 2551743002: gpu: Move native memory buffer configuration into //gpu (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "gpu/ipc/host/gpu_memory_buffer_support.h"
29 #include "media/media_features.h" 30 #include "media/media_features.h"
30 #include "ui/gl/gl_switches.h" 31 #include "ui/gl/gl_switches.h"
31 32
32 namespace content { 33 namespace content {
33 34
34 namespace { 35 namespace {
35 36
36 static bool IsGpuRasterizationBlacklisted() { 37 static bool IsGpuRasterizationBlacklisted() {
37 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 38 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
38 return manager->IsFeatureBlacklisted( 39 return manager->IsFeatureBlacklisted(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 !IsForceGpuRasterizationEnabled(), 136 !IsForceGpuRasterizationEnabled(),
136 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() && 137 !IsGpuRasterizationEnabled() && !IsForceGpuRasterizationEnabled() &&
137 !IsGpuRasterizationBlacklisted(), 138 !IsGpuRasterizationBlacklisted(),
138 "Accelerated rasterization has been disabled, either via blacklist," 139 "Accelerated rasterization has been disabled, either via blacklist,"
139 " about:flags or the command line.", 140 " about:flags or the command line.",
140 true}, 141 true},
141 {kMultipleRasterThreadsFeatureName, false, 142 {kMultipleRasterThreadsFeatureName, false,
142 NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.", 143 NumberOfRendererRasterThreads() == 1, "Raster is using a single thread.",
143 false}, 144 false},
144 {kNativeGpuMemoryBuffersFeatureName, false, 145 {kNativeGpuMemoryBuffersFeatureName, false,
145 !BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled(), 146 !gpu::AreNativeGpuMemoryBuffersEnabled(),
146 "Native GpuMemoryBuffers have been disabled, either via about:flags" 147 "Native GpuMemoryBuffers have been disabled, either via about:flags"
147 " or command line.", 148 " or command line.",
148 true}, 149 true},
149 {"vpx_decode", 150 {"vpx_decode", manager->IsFeatureBlacklisted(
150 manager->IsFeatureBlacklisted( 151 gpu::GPU_FEATURE_TYPE_ACCELERATED_VPX_DECODE) ||
151 gpu::GPU_FEATURE_TYPE_ACCELERATED_VPX_DECODE) || 152 manager->IsFeatureBlacklisted(
152 manager->IsFeatureBlacklisted( 153 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE),
153 gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE),
154 accelerated_vpx_disabled, 154 accelerated_vpx_disabled,
155 "Accelerated VPx video decode has been disabled, either via blacklist" 155 "Accelerated VPx video decode has been disabled, either via blacklist"
156 " or the command line.", 156 " or the command line.",
157 true}, 157 true},
158 {kWebGL2FeatureName, 158 {kWebGL2FeatureName,
159 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2), 159 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2),
160 command_line.HasSwitch(switches::kDisableES3APIs), 160 command_line.HasSwitch(switches::kDisableES3APIs),
161 "WebGL2 has been disabled via blacklist or the command line.", 161 "WebGL2 has been disabled via blacklist or the command line.", false},
162 false},
163 }; 162 };
164 DCHECK(index < arraysize(kGpuFeatureInfo)); 163 DCHECK(index < arraysize(kGpuFeatureInfo));
165 *eof = (index == arraysize(kGpuFeatureInfo) - 1); 164 *eof = (index == arraysize(kGpuFeatureInfo) - 1);
166 return kGpuFeatureInfo[index]; 165 return kGpuFeatureInfo[index];
167 } 166 }
168 167
169 } // namespace 168 } // namespace
170 169
171 int NumberOfRendererRasterThreads() { 170 int NumberOfRendererRasterThreads() {
172 int num_processors = base::SysInfo::NumberOfProcessors(); 171 int num_processors = base::SysInfo::NumberOfProcessors();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (command_line.HasSwitch( 224 if (command_line.HasSwitch(
226 switches::kEnableGpuMemoryBufferCompositorResources)) { 225 switches::kEnableGpuMemoryBufferCompositorResources)) {
227 return true; 226 return true;
228 } 227 }
229 if (command_line.HasSwitch( 228 if (command_line.HasSwitch(
230 switches::kDisableGpuMemoryBufferCompositorResources)) { 229 switches::kDisableGpuMemoryBufferCompositorResources)) {
231 return false; 230 return false;
232 } 231 }
233 232
234 // Native GPU memory buffers are required. 233 // Native GPU memory buffers are required.
235 if (!BrowserGpuMemoryBufferManager::IsNativeGpuMemoryBuffersEnabled()) 234 if (!gpu::AreNativeGpuMemoryBuffersEnabled())
236 return false; 235 return false;
237 236
238 #if defined(OS_MACOSX) 237 #if defined(OS_MACOSX)
239 return true; 238 return true;
240 #else 239 #else
241 return false; 240 return false;
242 #endif 241 #endif
243 } 242 }
244 243
245 bool IsGpuRasterizationEnabled() { 244 bool IsGpuRasterizationEnabled() {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 413 }
415 } 414 }
416 return problem_list; 415 return problem_list;
417 } 416 }
418 417
419 std::vector<std::string> GetDriverBugWorkarounds() { 418 std::vector<std::string> GetDriverBugWorkarounds() {
420 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 419 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
421 } 420 }
422 421
423 } // namespace content 422 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698