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

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

Issue 2902773004: cc: Add finch feature flag for checker-imaging. (Closed)
Patch Set: Created 3 years, 7 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
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/features.h"
21 #include "cc/base/math_util.h" 22 #include "cc/base/math_util.h"
22 #include "cc/base/switches.h" 23 #include "cc/base/switches.h"
23 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 24 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
24 #include "content/browser/gpu/gpu_data_manager_impl.h" 25 #include "content/browser/gpu/gpu_data_manager_impl.h"
25 #include "content/public/browser/gpu_utils.h" 26 #include "content/public/browser/gpu_utils.h"
26 #include "content/public/common/content_features.h" 27 #include "content/public/common/content_features.h"
27 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
28 #include "gpu/config/gpu_feature_type.h" 29 #include "gpu/config/gpu_feature_type.h"
29 #include "gpu/ipc/host/gpu_memory_buffer_support.h" 30 #include "gpu/ipc/host/gpu_memory_buffer_support.h"
30 #include "media/media_features.h" 31 #include "media/media_features.h"
31 #include "ui/gl/gl_switches.h" 32 #include "ui/gl/gl_switches.h"
32 33
33 namespace content { 34 namespace content {
34 35
35 namespace { 36 namespace {
36 37
37 static bool IsGpuRasterizationBlacklisted() { 38 static bool IsGpuRasterizationBlacklisted() {
38 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 39 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
39 return manager->IsFeatureBlacklisted( 40 return manager->IsFeatureBlacklisted(
40 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION); 41 gpu::GPU_FEATURE_TYPE_GPU_RASTERIZATION);
41 } 42 }
42 43
43 const char kGpuCompositingFeatureName[] = "gpu_compositing"; 44 const char kGpuCompositingFeatureName[] = "gpu_compositing";
44 const char kWebGLFeatureName[] = "webgl"; 45 const char kWebGLFeatureName[] = "webgl";
45 const char kRasterizationFeatureName[] = "rasterization"; 46 const char kRasterizationFeatureName[] = "rasterization";
46 const char kMultipleRasterThreadsFeatureName[] = "multiple_raster_threads"; 47 const char kMultipleRasterThreadsFeatureName[] = "multiple_raster_threads";
47 const char kNativeGpuMemoryBuffersFeatureName[] = "native_gpu_memory_buffers"; 48 const char kNativeGpuMemoryBuffersFeatureName[] = "native_gpu_memory_buffers";
48 const char kWebGL2FeatureName[] = "webgl2"; 49 const char kWebGL2FeatureName[] = "webgl2";
50 const char kCheckerImagingFeatureName[] = "checker_imaging";
49 51
50 const int kMinRasterThreads = 1; 52 const int kMinRasterThreads = 1;
51 const int kMaxRasterThreads = 4; 53 const int kMaxRasterThreads = 4;
52 54
53 const int kMinMSAASampleCount = 0; 55 const int kMinMSAASampleCount = 0;
54 56
55 struct GpuFeatureInfo { 57 struct GpuFeatureInfo {
56 std::string name; 58 std::string name;
57 bool blocked; 59 bool blocked;
58 bool disabled; 60 bool disabled;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 false}, 141 false},
140 {kNativeGpuMemoryBuffersFeatureName, false, 142 {kNativeGpuMemoryBuffersFeatureName, false,
141 !gpu::AreNativeGpuMemoryBuffersEnabled(), 143 !gpu::AreNativeGpuMemoryBuffersEnabled(),
142 "Native GpuMemoryBuffers have been disabled, either via about:flags" 144 "Native GpuMemoryBuffers have been disabled, either via about:flags"
143 " or command line.", 145 " or command line.",
144 true}, 146 true},
145 {kWebGL2FeatureName, 147 {kWebGL2FeatureName,
146 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2), 148 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL2),
147 command_line.HasSwitch(switches::kDisableES3APIs), 149 command_line.HasSwitch(switches::kDisableES3APIs),
148 "WebGL2 has been disabled via blacklist or the command line.", false}, 150 "WebGL2 has been disabled via blacklist or the command line.", false},
151 {kCheckerImagingFeatureName, false, !IsCheckerImagingEnabled(),
152 "Checker-imaging has been disabled via finch trial or the command line.",
153 false},
149 }; 154 };
150 DCHECK(index < arraysize(kGpuFeatureInfo)); 155 DCHECK(index < arraysize(kGpuFeatureInfo));
151 *eof = (index == arraysize(kGpuFeatureInfo) - 1); 156 *eof = (index == arraysize(kGpuFeatureInfo) - 1);
152 return kGpuFeatureInfo[index]; 157 return kGpuFeatureInfo[index];
153 } 158 }
154 159
155 } // namespace 160 } // namespace
156 161
157 int NumberOfRendererRasterThreads() { 162 int NumberOfRendererRasterThreads() {
158 int num_processors = base::SysInfo::NumberOfProcessors(); 163 int num_processors = base::SysInfo::NumberOfProcessors();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 291
287 if (command_line.HasSwitch(cc::switches::kDisableMainFrameBeforeActivation)) 292 if (command_line.HasSwitch(cc::switches::kDisableMainFrameBeforeActivation))
288 return false; 293 return false;
289 294
290 if (command_line.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation)) 295 if (command_line.HasSwitch(cc::switches::kEnableMainFrameBeforeActivation))
291 return true; 296 return true;
292 297
293 return true; 298 return true;
294 } 299 }
295 300
301 bool IsCheckerImagingEnabled() {
302 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
303 cc::switches::kEnableCheckerImaging))
304 return true;
305
306 if (base::FeatureList::IsEnabled(cc::features::kEnableCheckerImaging))
307 return true;
308
309 return false;
310 }
311
296 base::DictionaryValue* GetFeatureStatus() { 312 base::DictionaryValue* GetFeatureStatus() {
297 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 313 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
298 std::string gpu_access_blocked_reason; 314 std::string gpu_access_blocked_reason;
299 bool gpu_access_blocked = 315 bool gpu_access_blocked =
300 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); 316 !manager->GpuAccessAllowed(&gpu_access_blocked_reason);
301 317
302 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); 318 base::DictionaryValue* feature_status_dict = new base::DictionaryValue();
303 319
304 bool eof = false; 320 bool eof = false;
305 for (size_t i = 0; !eof; ++i) { 321 for (size_t i = 0; !eof; ++i) {
(...skipping 22 matching lines...) Expand all
328 status += "_force"; 344 status += "_force";
329 } 345 }
330 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) { 346 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) {
331 const base::CommandLine& command_line = 347 const base::CommandLine& command_line =
332 *base::CommandLine::ForCurrentProcess(); 348 *base::CommandLine::ForCurrentProcess();
333 if (command_line.HasSwitch(switches::kNumRasterThreads)) 349 if (command_line.HasSwitch(switches::kNumRasterThreads))
334 status += "_force"; 350 status += "_force";
335 } 351 }
336 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName) 352 if (gpu_feature_info.name == kMultipleRasterThreadsFeatureName)
337 status += "_on"; 353 status += "_on";
354 if (gpu_feature_info.name == kCheckerImagingFeatureName) {
355 const base::CommandLine& command_line =
356 *base::CommandLine::ForCurrentProcess();
357 if (command_line.HasSwitch(cc::switches::kEnableCheckerImaging))
358 status += "_force";
359 status += "_on";
360 }
338 } 361 }
339 if (gpu_feature_info.name == kWebGLFeatureName && 362 if (gpu_feature_info.name == kWebGLFeatureName &&
340 (gpu_feature_info.blocked || gpu_access_blocked) && 363 (gpu_feature_info.blocked || gpu_access_blocked) &&
341 manager->ShouldUseSwiftShader()) { 364 manager->ShouldUseSwiftShader()) {
342 status = "unavailable_software"; 365 status = "unavailable_software";
343 } 366 }
344 367
345 feature_status_dict->SetString(gpu_feature_info.name, status); 368 feature_status_dict->SetString(gpu_feature_info.name, status);
346 } 369 }
347 return feature_status_dict; 370 return feature_status_dict;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 408 }
386 } 409 }
387 return problem_list; 410 return problem_list;
388 } 411 }
389 412
390 std::vector<std::string> GetDriverBugWorkarounds() { 413 std::vector<std::string> GetDriverBugWorkarounds() {
391 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(); 414 return GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds();
392 } 415 }
393 416
394 } // namespace content 417 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698