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

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

Issue 23534006: Enable GPU blacklist in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add early SetUp to AcceleratedCompositingBlocked and finalized_ state after GpuDataManagerImplPriva… Created 7 years, 3 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 | Annotate | Revision Log
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/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "build/build_config.h"
9 #include "content/public/browser/gpu_data_manager.h" 10 #include "content/public/browser/gpu_data_manager.h"
10 #include "content/public/common/content_constants.h" 11 #include "content/public/common/content_constants.h"
11 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
12 #include "gpu/config/gpu_feature_type.h" 13 #include "gpu/config/gpu_feature_type.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 namespace { 17 namespace {
17 18
18 bool CanDoAcceleratedCompositing() { 19 bool CanDoAcceleratedCompositing() {
(...skipping 10 matching lines...) Expand all
29 if (manager->ShouldUseSwiftShader()) 30 if (manager->ShouldUseSwiftShader())
30 return false; 31 return false;
31 32
32 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 33 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
33 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) 34 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing))
34 return false; 35 return false;
35 36
36 return true; 37 return true;
37 } 38 }
38 39
39 bool IsForceCompositingModeBlacklisted() {
40 return GpuDataManager::GetInstance()->IsFeatureBlacklisted(
41 gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE);
42 }
43
44 } // namespace 40 } // namespace
45 41
46 bool IsThreadedCompositingEnabled() { 42 bool IsThreadedCompositingEnabled() {
47 #if defined(USE_AURA) 43 #if defined(USE_AURA)
48 // We always want threaded compositing on Aura. 44 // We always want threaded compositing on Aura.
49 return true; 45 return true;
50 #endif 46 #endif
51 47
52 if (!CanDoAcceleratedCompositing())
53 return false;
54
55 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 48 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
56 49
57 // Command line switches take precedence over blacklist and field trials. 50 // Command line switches take precedence over blacklist and field trials.
58 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || 51 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) ||
59 command_line.HasSwitch(switches::kDisableThreadedCompositing)) 52 command_line.HasSwitch(switches::kDisableThreadedCompositing)) {
60 return false; 53 return false;
54 } else if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) {
55 return true;
56 }
61 57
62 if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) 58 if (!CanDoAcceleratedCompositing())
63 return true;
64
65 if (IsForceCompositingModeBlacklisted())
66 return false; 59 return false;
67 60
68 base::FieldTrial* trial = 61 base::FieldTrial* trial =
69 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 62 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
70 return trial && 63 return trial &&
71 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName; 64 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName;
72 } 65 }
73 66
74 bool IsForceCompositingModeEnabled() { 67 bool IsForceCompositingModeEnabled() {
75 #if defined(USE_AURA) 68 #if defined(USE_AURA)
76 // We always want compositing on Aura. 69 // We always want compositing on Aura.
77 return true; 70 return true;
78 #endif 71 #endif
79 72
80 if (!CanDoAcceleratedCompositing())
81 return false;
82
83 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 73 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
84 74
85 // Command line switches take precedence over blacklisting and field trials. 75 // Command line switches take precedence over blacklisting and field trials.
86 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) 76 if (command_line.HasSwitch(switches::kDisableForceCompositingMode))
87 return false; 77 return false;
88 78 else if (command_line.HasSwitch(switches::kForceCompositingMode))
89 if (command_line.HasSwitch(switches::kForceCompositingMode))
90 return true; 79 return true;
91 80
92 if (IsForceCompositingModeBlacklisted()) 81 if (!CanDoAcceleratedCompositing())
93 return false; 82 return false;
94 83
95 base::FieldTrial* trial = 84 base::FieldTrial* trial =
96 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 85 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
97 86
98 // Force compositing is enabled in both the force compositing 87 // Force compositing is enabled in both the force compositing
99 // and threaded compositing mode field trials. 88 // and threaded compositing mode field trials.
100 return trial && 89 return trial &&
101 (trial->group_name() == 90 (trial->group_name() ==
102 kGpuCompositingFieldTrialForceCompositingEnabledName || 91 kGpuCompositingFieldTrialForceCompositingEnabledName ||
103 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); 92 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName);
104 } 93 }
105 94
106 } // namespace content 95 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698