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

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

Issue 22198004: Always enable FCM on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove kSkipGpuDataLoading => Re-enable the blacklist on the bots Created 7 years, 4 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/public/browser/compositor_util.h" 5 #include "content/public/browser/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(
gab 2013/08/15 20:07:49 This is already checked by CanDoAcceleratedComposi
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(OS_WIN) && defined(USE_AURA) 43 #if defined(OS_WIN) && defined(USE_AURA)
48 // We always want compositing on Aura Windows. 44 // We always want compositing on Aura Windows.
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.
gab 2013/08/15 20:07:49 Group command-line switches check together and mov
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 defined(OS_CHROMEOS) 58 #if defined(OS_CHROMEOS)
63 // We always want threaded compositing on ChromeOS unless it's explicitly 59 // We always want threaded compositing on ChromeOS unless it's explicitly
64 // disabled above. 60 // disabled above.
65 return true; 61 return true;
66 #endif 62 #endif
67 63
68 if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) 64 if (!CanDoAcceleratedCompositing())
69 return true;
70
71 if (IsForceCompositingModeBlacklisted())
72 return false; 65 return false;
73 66
74 base::FieldTrial* trial = 67 base::FieldTrial* trial =
75 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 68 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
76 return trial && 69 return trial &&
77 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName; 70 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName;
78 } 71 }
79 72
80 bool IsForceCompositingModeEnabled() { 73 bool IsForceCompositingModeEnabled() {
81 #if defined(OS_WIN) && defined(USE_AURA) 74 #if defined(OS_WIN) && defined(USE_AURA)
82 // We always want compositing on Aura Windows. 75 // We always want compositing on Aura Windows.
83 return true; 76 return true;
84 #endif 77 #endif
85 78
79 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
80
81 // Command line switches take precedence over blacklisting and field trials.
82 if (command_line.HasSwitch(switches::kDisableForceCompositingMode))
83 return false;
84 else if (command_line.HasSwitch(switches::kForceCompositingMode))
85 return true;
86
87 #if defined(OS_CHROMEOS)
88 // We always want compositing ChromeOS unless it's explicitly disabled above.
89 return true;
90 #endif
Zhenyao Mo 2013/08/15 20:23:37 This should be below the CanDOAcceleratedCompositi
gab 2013/08/15 21:03:19 Done.
91
86 if (!CanDoAcceleratedCompositing()) 92 if (!CanDoAcceleratedCompositing())
87 return false; 93 return false;
88 94
89 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 95 #if defined(OS_WIN)
90 96 // Windows Vista+ has been shipping with FCM enabled at 100% since M24; skip
91 // Command line switches take precedence over blacklisting and field trials. 97 // the field trial check to ensure this is always enabled on the try bots.
92 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) 98 // TODO(gab): Do the same thing in IsThreadedCompositingEnabled() once this is
93 return false; 99 // stable.
94 100 // TODO(gab): Do the same thing for Mac OS (which has been enabled at 100%
95 #if defined(OS_CHROMEOS) 101 // since M28) as well and get rid of the field trial code.
96 // We always want compositing ChromeOS unless it's explicitly disabled above.
97 return true; 102 return true;
98 #endif 103 #else
Zhenyao Mo 2013/08/15 20:23:37 According to code style, this #else is unnecessary
gab 2013/08/15 21:03:19 Done.
99
100 if (command_line.HasSwitch(switches::kForceCompositingMode))
101 return true;
102
103 if (IsForceCompositingModeBlacklisted())
104 return false;
105
106 base::FieldTrial* trial = 104 base::FieldTrial* trial =
107 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 105 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
108 106
109 // Force compositing is enabled in both the force compositing 107 // Force compositing is enabled in both the force compositing
110 // and threaded compositing mode field trials. 108 // and threaded compositing mode field trials.
111 return trial && 109 return trial &&
112 (trial->group_name() == 110 (trial->group_name() ==
113 kGpuCompositingFieldTrialForceCompositingEnabledName || 111 kGpuCompositingFieldTrialForceCompositingEnabledName ||
114 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); 112 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName);
113 #endif
115 } 114 }
116 115
117 } // namespace content 116 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698