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

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

Issue 11930003: Add force_compositing_mode support in gpu blacklist. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 "content/public/browser/gpu_data_manager.h" 9 #include "content/public/browser/gpu_data_manager.h"
10 #include "content/public/common/content_constants.h" 10 #include "content/public/common/content_constants.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (!CanDoAcceleratedCompositing()) 47 if (!CanDoAcceleratedCompositing())
48 return false; 48 return false;
49 49
50 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 50 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
51 51
52 // Command line switches take precedence over field trials. 52 // Command line switches take precedence over field trials.
53 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || 53 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) ||
54 command_line.HasSwitch(switches::kDisableThreadedCompositing)) 54 command_line.HasSwitch(switches::kDisableThreadedCompositing))
55 return false; 55 return false;
56 56
57 GpuFeatureType blacklisted_features =
vangelis 2013/01/16 18:04:09 nit: Could you hoist that into a separate method i
Zhenyao Mo 2013/01/16 20:53:36 Done.
58 GpuDataManager::GetInstance()->GetBlacklistedFeatures();
59 if (blacklisted_features & GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE)
60 return false;
61
57 if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) 62 if (command_line.HasSwitch(switches::kEnableThreadedCompositing))
58 return true; 63 return true;
59 64
60 base::FieldTrial* trial = 65 base::FieldTrial* trial =
61 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 66 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
62 return trial && 67 return trial &&
63 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName; 68 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName;
64 } 69 }
65 70
66 bool IsForceCompositingModeEnabled() { 71 bool IsForceCompositingModeEnabled() {
67 #if defined(OS_WIN) && defined(USE_AURA) 72 #if defined(OS_WIN) && defined(USE_AURA)
68 // We always want compositing on Aura Windows. 73 // We always want compositing on Aura Windows.
69 return true; 74 return true;
70 #endif 75 #endif
71 76
72 if (!CanDoAcceleratedCompositing()) 77 if (!CanDoAcceleratedCompositing())
73 return false; 78 return false;
74 79
75 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 80 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
76 81
77 // Command line switches take precedence over field trials. 82 // Command line switches take precedence over blacklisting and field trials.
78 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) 83 if (command_line.HasSwitch(switches::kDisableForceCompositingMode))
79 return false; 84 return false;
80 85
81 if (command_line.HasSwitch(switches::kForceCompositingMode)) 86 if (command_line.HasSwitch(switches::kForceCompositingMode))
82 return true; 87 return true;
83 88
89 GpuFeatureType blacklisted_features =
90 GpuDataManager::GetInstance()->GetBlacklistedFeatures();
91 if (blacklisted_features & GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE)
92 return false;
93
84 base::FieldTrial* trial = 94 base::FieldTrial* trial =
85 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); 95 base::FieldTrialList::Find(kGpuCompositingFieldTrialName);
86 96
87 // Force compositing is enabled in both the force compositing 97 // Force compositing is enabled in both the force compositing
88 // and threaded compositing mode field trials. 98 // and threaded compositing mode field trials.
89 return trial && 99 return trial &&
90 (trial->group_name() == 100 (trial->group_name() ==
91 kGpuCompositingFieldTrialForceCompositingEnabledName || 101 kGpuCompositingFieldTrialForceCompositingEnabledName ||
92 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); 102 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName);
93 } 103 }
94 104
95 } // namespace content 105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698