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

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: merge up to r219022 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/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(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.
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)) {
53 return false;
54 } else if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) {
55 return true;
56 }
57
58 if (!CanDoAcceleratedCompositing())
60 return false; 59 return false;
61 60
62 #if defined(OS_CHROMEOS) 61 #if defined(OS_CHROMEOS)
63 // We always want threaded compositing on ChromeOS unless it's explicitly 62 // We always want threaded compositing on ChromeOS unless it's explicitly
64 // disabled above. 63 // disabled above.
65 return true; 64 return true;
66 #endif 65 #endif
67 66
68 if (command_line.HasSwitch(switches::kEnableThreadedCompositing))
69 return true;
70
71 if (IsForceCompositingModeBlacklisted())
72 return false;
73
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
86 if (!CanDoAcceleratedCompositing())
87 return false;
88
89 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 79 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
90 80
91 // Command line switches take precedence over blacklisting and field trials. 81 // Command line switches take precedence over blacklisting and field trials.
92 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) 82 if (command_line.HasSwitch(switches::kDisableForceCompositingMode))
93 return false; 83 return false;
84 else if (command_line.HasSwitch(switches::kForceCompositingMode))
85 return true;
86
87 if (!CanDoAcceleratedCompositing())
88 return false;
94 89
95 #if defined(OS_CHROMEOS) 90 #if defined(OS_CHROMEOS)
96 // We always want compositing ChromeOS unless it's explicitly disabled above. 91 // We always want compositing ChromeOS unless it's explicitly disabled above.
97 return true; 92 return true;
93 #elif defined(OS_WIN)
94 // Windows Vista+ has been shipping with FCM enabled at 100% since M24; skip
95 // the field trial check to ensure this is always enabled on the try bots.
96 // TODO(gab): Do the same thing in IsThreadedCompositingEnabled() once this is
97 // stable.
98 // TODO(gab): Do the same thing for Mac OS (which has been enabled at 100%
99 // since M28) as well and get rid of the field trial code.
100 return true;
98 #endif 101 #endif
99 102
100 if (command_line.HasSwitch(switches::kForceCompositingMode))
101 return true;
102
103 if (IsForceCompositingModeBlacklisted())
104 return false;
105
106 base::FieldTrial* trial = 103 base::FieldTrial* trial =
107 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 104 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
108 105
109 // Force compositing is enabled in both the force compositing 106 // Force compositing is enabled in both the force compositing
110 // and threaded compositing mode field trials. 107 // and threaded compositing mode field trials.
111 return trial && 108 return trial &&
112 (trial->group_name() == 109 (trial->group_name() ==
113 kGpuCompositingFieldTrialForceCompositingEnabledName || 110 kGpuCompositingFieldTrialForceCompositingEnabledName ||
114 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); 111 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName);
115 } 112 }
116 113
117 } // namespace content 114 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/gpu/gpu_feature_browsertest.cc ('k') | content/browser/gpu/compositor_util_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698