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

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

Issue 1375663002: Show GpuMemoryBuffer feature in chrome://gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « content/browser/gpu/compositor_util.h ('k') | content/browser/resources/gpu/info_view.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 "base/metrics/field_trial.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/sys_info.h" 11 #include "base/sys_info.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
14 #include "cc/base/switches.h" 14 #include "cc/base/switches.h"
15 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
15 #include "content/browser/gpu/gpu_data_manager_impl.h" 16 #include "content/browser/gpu/gpu_data_manager_impl.h"
16 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
17 #include "gpu/config/gpu_feature_type.h" 18 #include "gpu/config/gpu_feature_type.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 namespace { 22 namespace {
22 23
23 static bool IsGpuRasterizationBlacklisted() { 24 static bool IsGpuRasterizationBlacklisted() {
24 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 25 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
25 return manager->IsFeatureBlacklisted( 26 return manager->IsFeatureBlacklisted(
26 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); 27 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION);
27 } 28 }
28 29
29 const char* kGpuCompositingFeatureName = "gpu_compositing"; 30 const char* kGpuCompositingFeatureName = "gpu_compositing";
30 const char* kWebGLFeatureName = "webgl"; 31 const char* kWebGLFeatureName = "webgl";
31 const char* kRasterizationFeatureName = "rasterization"; 32 const char* kRasterizationFeatureName = "rasterization";
32 const char* kMultipleRasterThreadsFeatureName = "multiple_raster_threads"; 33 const char* kMultipleRasterThreadsFeatureName = "multiple_raster_threads";
34 const char* kGpuMemoryBufferFeatureName = "gpu_memory_buffer";
33 35
34 const int kMinRasterThreads = 1; 36 const int kMinRasterThreads = 1;
35 const int kMaxRasterThreads = 4; 37 const int kMaxRasterThreads = 4;
36 38
37 const int kMinMSAASampleCount = 0; 39 const int kMinMSAASampleCount = 0;
38 40
39 struct GpuFeatureInfo { 41 struct GpuFeatureInfo {
40 std::string name; 42 std::string name;
41 bool blocked; 43 bool blocked;
42 bool disabled; 44 bool disabled;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 " or command line.", 145 " or command line.",
144 true 146 true
145 }, 147 },
146 { 148 {
147 kMultipleRasterThreadsFeatureName, 149 kMultipleRasterThreadsFeatureName,
148 false, 150 false,
149 NumberOfRendererRasterThreads() == 1, 151 NumberOfRendererRasterThreads() == 1,
150 "Raster is using a single thread.", 152 "Raster is using a single thread.",
151 false 153 false
152 }, 154 },
155 {
156 kGpuMemoryBufferFeatureName,
157 false,
158 !IsNativeGpuMemoryBufferEnabled(),
159 "Raster is using fallback (shm).",
Ken Russell (switch to Gerrit) 2015/09/28 23:00:14 Could you elaborate on the description here? Perha
vignatti (out of this project) 2015/09/28 23:15:09 Done.
160 true
161 },
153 }; 162 };
154 DCHECK(index < arraysize(kGpuFeatureInfo)); 163 DCHECK(index < arraysize(kGpuFeatureInfo));
155 *eof = (index == arraysize(kGpuFeatureInfo) - 1); 164 *eof = (index == arraysize(kGpuFeatureInfo) - 1);
156 return kGpuFeatureInfo[index]; 165 return kGpuFeatureInfo[index];
157 } 166 }
158 167
159 } // namespace 168 } // namespace
160 169
161 bool IsPropertyTreeVerificationEnabled() { 170 bool IsPropertyTreeVerificationEnabled() {
162 const base::CommandLine& command_line = 171 const base::CommandLine& command_line =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bool IsZeroCopyUploadEnabled() { 210 bool IsZeroCopyUploadEnabled() {
202 const base::CommandLine& command_line = 211 const base::CommandLine& command_line =
203 *base::CommandLine::ForCurrentProcess(); 212 *base::CommandLine::ForCurrentProcess();
204 #if defined(OS_MACOSX) 213 #if defined(OS_MACOSX)
205 return !command_line.HasSwitch(switches::kDisableZeroCopy); 214 return !command_line.HasSwitch(switches::kDisableZeroCopy);
206 #else 215 #else
207 return command_line.HasSwitch(switches::kEnableZeroCopy); 216 return command_line.HasSwitch(switches::kEnableZeroCopy);
208 #endif 217 #endif
209 } 218 }
210 219
220 bool IsNativeGpuMemoryBufferEnabled() {
221 const auto& command_line = *base::CommandLine::ForCurrentProcess();
222 bool enabled =
223 command_line.HasSwitch(switches::kEnableNativeGpuMemoryBuffers);
224 BrowserGpuMemoryBufferManager* gmb_manager =
225 BrowserGpuMemoryBufferManager::current();
226
227 // We need buffer mapping configuration to proper support native GMB.
228 enabled &= gmb_manager->IsGpuMemoryBufferConfigurationSupported(
229 gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP) |
230 gmb_manager->IsGpuMemoryBufferConfigurationSupported(
231 gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::PERSISTENT_MAP);
232 return enabled;
233 }
234
211 bool IsPersistentGpuMemoryBufferEnabled() { 235 bool IsPersistentGpuMemoryBufferEnabled() {
212 // Zero copy currently doesn't take advantage of persistent buffers. 236 // Zero copy currently doesn't take advantage of persistent buffers.
213 if (IsZeroCopyUploadEnabled()) 237 if (IsZeroCopyUploadEnabled())
214 return false; 238 return false;
215 const auto& command_line = *base::CommandLine::ForCurrentProcess(); 239 const auto& command_line = *base::CommandLine::ForCurrentProcess();
216 return command_line.HasSwitch(switches::kEnablePersistentGpuMemoryBuffer); 240 return command_line.HasSwitch(switches::kEnablePersistentGpuMemoryBuffer);
217 } 241 }
218 242
219 bool IsGpuRasterizationEnabled() { 243 bool IsGpuRasterizationEnabled() {
220 const base::CommandLine& command_line = 244 const base::CommandLine& command_line =
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 status += "_off"; 338 status += "_off";
315 } else { 339 } else {
316 status = "enabled"; 340 status = "enabled";
317 if (gpu_feature_info.name == kWebGLFeatureName && 341 if (gpu_feature_info.name == kWebGLFeatureName &&
318 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) 342 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
319 status += "_readback"; 343 status += "_readback";
320 if (gpu_feature_info.name == kRasterizationFeatureName) { 344 if (gpu_feature_info.name == kRasterizationFeatureName) {
321 if (IsForceGpuRasterizationEnabled()) 345 if (IsForceGpuRasterizationEnabled())
322 status += "_force"; 346 status += "_force";
323 } 347 }
348 if (gpu_feature_info.name == kGpuMemoryBufferFeatureName) {
349 status += "_native";
350 if (IsZeroCopyUploadEnabled())
351 status += "_zero_copy";
352 else
353 status += "_one_copy";
354 }
324 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) { 355 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) {
325 const base::CommandLine& command_line = 356 const base::CommandLine& command_line =
326 *base::CommandLine::ForCurrentProcess(); 357 *base::CommandLine::ForCurrentProcess();
327 if (command_line.HasSwitch(switches::kNumRasterThreads)) 358 if (command_line.HasSwitch(switches::kNumRasterThreads))
328 status += "_force"; 359 status += "_force";
329 } 360 }
330 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) 361 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName)
331 status += "_on"; 362 status += "_on";
332 } 363 }
333 if (gpu_feature_info.name == kWebGLFeatureName && 364 if (gpu_feature_info.name == kWebGLFeatureName &&
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 412 }
382 } 413 }
383 return problem_list; 414 return problem_list;
384 } 415 }
385 416
386 std::vector<std::string> GetDriverBugWorkarounds() { 417 std::vector<std::string> GetDriverBugWorkarounds() {
387 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 418 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
388 } 419 }
389 420
390 } // namespace content 421 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/compositor_util.h ('k') | content/browser/resources/gpu/info_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698