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

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

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

Powered by Google App Engine
This is Rietveld 408576698