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

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

Issue 344703002: Revert of Remove EnableThreadedCompositing from the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | 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/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (command_line.HasSwitch(cc::switches::kEnablePinchVirtualViewport)) 161 if (command_line.HasSwitch(cc::switches::kEnablePinchVirtualViewport))
162 return true; 162 return true;
163 163
164 #if defined(OS_CHROMEOS) 164 #if defined(OS_CHROMEOS)
165 return true; 165 return true;
166 #else 166 #else
167 return false; 167 return false;
168 #endif 168 #endif
169 } 169 }
170 170
171 bool IsThreadedCompositingEnabled() {
172 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
173
174 // Command line switches take precedence over blacklist.
175 if (command_line.HasSwitch(switches::kDisableThreadedCompositing))
176 return false;
177 if (command_line.HasSwitch(switches::kEnableThreadedCompositing))
178 return true;
179
180 #if defined(USE_AURA) || defined(OS_MACOSX)
181 // We always want threaded compositing on Aura and Mac (the fallback is a
182 // threaded software compositor).
183 return true;
184 #else
185 return false;
186 #endif
187 }
188
171 bool IsDelegatedRendererEnabled() { 189 bool IsDelegatedRendererEnabled() {
172 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 190 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
173 bool enabled = false; 191 bool enabled = false;
174 192
175 #if defined(USE_AURA) 193 #if defined(USE_AURA)
176 // Enable on Aura. 194 // Enable on Aura.
177 enabled = true; 195 enabled = true;
178 #endif 196 #endif
179 197
180 // Flags override. 198 // Flags override.
181 enabled |= command_line.HasSwitch(switches::kEnableDelegatedRenderer); 199 enabled |= command_line.HasSwitch(switches::kEnableDelegatedRenderer);
182 enabled &= !command_line.HasSwitch(switches::kDisableDelegatedRenderer); 200 enabled &= !command_line.HasSwitch(switches::kDisableDelegatedRenderer);
183 201
184 // Needs compositing, and thread. 202 // Needs compositing, and thread.
203 if (enabled && !IsThreadedCompositingEnabled()) {
204 enabled = false;
205 LOG(ERROR) << "Disabling delegated-rendering because it needs "
206 << "force-compositing-mode and threaded-compositing.";
207 }
208
185 return enabled; 209 return enabled;
186 } 210 }
187 211
188 bool IsImplSidePaintingEnabled() { 212 bool IsImplSidePaintingEnabled() {
189 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 213 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
190 214
191 if (command_line.HasSwitch(switches::kDisableImplSidePainting)) 215 if (command_line.HasSwitch(switches::kDisableImplSidePainting))
192 return false; 216 return false;
193 else if (command_line.HasSwitch(switches::kEnableImplSidePainting)) 217 else if (command_line.HasSwitch(switches::kEnableImplSidePainting))
194 return true; 218 return true;
195 else if (command_line.HasSwitch( 219 else if (command_line.HasSwitch(
196 switches::kEnableBleedingEdgeRenderingFastPaths)) 220 switches::kEnableBleedingEdgeRenderingFastPaths))
197 return true; 221 return true;
198 222
199 #if defined(OS_MACOSX) || defined(OS_WIN) 223 #if defined(OS_MACOSX) || defined(OS_WIN)
200 return false; 224 return false;
201 #else 225 #else
202 return true; 226 return IsThreadedCompositingEnabled();
203 #endif 227 #endif
204 } 228 }
205 229
206 bool IsGpuRasterizationEnabled() { 230 bool IsGpuRasterizationEnabled() {
207 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 231 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
208 232
209 if (!IsImplSidePaintingEnabled()) 233 if (!IsImplSidePaintingEnabled())
210 return false; 234 return false;
211 235
212 if (command_line.HasSwitch(switches::kDisableGpuRasterization)) 236 if (command_line.HasSwitch(switches::kDisableGpuRasterization))
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } else { 291 } else {
268 status = "enabled"; 292 status = "enabled";
269 if (gpu_feature_info.name == kWebGLFeatureName && 293 if (gpu_feature_info.name == kWebGLFeatureName &&
270 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) 294 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
271 status += "_readback"; 295 status += "_readback";
272 if (gpu_feature_info.name == kRasterizationFeatureName) { 296 if (gpu_feature_info.name == kRasterizationFeatureName) {
273 if (IsForceGpuRasterizationEnabled()) 297 if (IsForceGpuRasterizationEnabled())
274 status += "_force"; 298 status += "_force";
275 } 299 }
276 } 300 }
301 if (gpu_feature_info.name == kGpuCompositingFeatureName) {
302 if (IsThreadedCompositingEnabled())
303 status += "_threaded";
304 }
277 feature_status_dict->SetString( 305 feature_status_dict->SetString(
278 gpu_feature_info.name.c_str(), status.c_str()); 306 gpu_feature_info.name.c_str(), status.c_str());
279 } 307 }
280 return feature_status_dict; 308 return feature_status_dict;
281 } 309 }
282 310
283 base::Value* GetProblems() { 311 base::Value* GetProblems() {
284 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); 312 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance();
285 std::string gpu_access_blocked_reason; 313 std::string gpu_access_blocked_reason;
286 bool gpu_access_blocked = 314 bool gpu_access_blocked =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 return problem_list; 349 return problem_list;
322 } 350 }
323 351
324 base::Value* GetDriverBugWorkarounds() { 352 base::Value* GetDriverBugWorkarounds() {
325 base::ListValue* workaround_list = new base::ListValue(); 353 base::ListValue* workaround_list = new base::ListValue();
326 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); 354 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list);
327 return workaround_list; 355 return workaround_list;
328 } 356 }
329 357
330 } // namespace content 358 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/compositor_util.h ('k') | content/browser/gpu/compositor_util_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698