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

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

Issue 337783002: Remove EnableThreadedCompositing from the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread: rebase Created 6 years, 5 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (command_line.HasSwitch(cc::switches::kEnablePinchVirtualViewport)) 171 if (command_line.HasSwitch(cc::switches::kEnablePinchVirtualViewport))
172 return true; 172 return true;
173 173
174 #if defined(OS_CHROMEOS) 174 #if defined(OS_CHROMEOS)
175 return true; 175 return true;
176 #else 176 #else
177 return false; 177 return false;
178 #endif 178 #endif
179 } 179 }
180 180
181 bool IsThreadedCompositingEnabled() {
182 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
183
184 // Command line switches take precedence over blacklist.
185 if (command_line.HasSwitch(switches::kDisableThreadedCompositing))
186 return false;
187 if (command_line.HasSwitch(switches::kEnableThreadedCompositing))
188 return true;
189
190 #if defined(USE_AURA) || defined(OS_MACOSX)
191 // We always want threaded compositing on Aura and Mac (the fallback is a
192 // threaded software compositor).
193 return true;
194 #else
195 return false;
196 #endif
197 }
198
199 bool IsDelegatedRendererEnabled() { 181 bool IsDelegatedRendererEnabled() {
200 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 182 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
201 bool enabled = false; 183 bool enabled = false;
202 184
203 #if defined(USE_AURA) || defined(OS_MACOSX) 185 #if defined(USE_AURA) || defined(OS_MACOSX)
204 // Enable on Aura and Mac. 186 // Enable on Aura and Mac.
205 enabled = true; 187 enabled = true;
206 #endif 188 #endif
207 189
208 // Flags override. 190 // Flags override.
209 enabled |= command_line.HasSwitch(switches::kEnableDelegatedRenderer); 191 enabled |= command_line.HasSwitch(switches::kEnableDelegatedRenderer);
210 enabled &= !command_line.HasSwitch(switches::kDisableDelegatedRenderer); 192 enabled &= !command_line.HasSwitch(switches::kDisableDelegatedRenderer);
211
212 // Needs compositing, and thread.
213 if (enabled && !IsThreadedCompositingEnabled()) {
214 enabled = false;
215 LOG(ERROR) << "Disabling delegated-rendering because it needs "
216 << "threaded-compositing.";
217 }
218
219 return enabled; 193 return enabled;
220 } 194 }
221 195
222 bool IsImplSidePaintingEnabled() { 196 bool IsImplSidePaintingEnabled() {
223 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 197 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
224 198
225 if (command_line.HasSwitch(switches::kDisableImplSidePainting)) 199 if (command_line.HasSwitch(switches::kDisableImplSidePainting))
226 return false; 200 return false;
227 else if (command_line.HasSwitch(switches::kEnableImplSidePainting)) 201 else if (command_line.HasSwitch(switches::kEnableImplSidePainting))
228 return true; 202 return true;
229 else if (command_line.HasSwitch( 203 else if (command_line.HasSwitch(
230 switches::kEnableBleedingEdgeRenderingFastPaths)) 204 switches::kEnableBleedingEdgeRenderingFastPaths))
231 return true; 205 return true;
232 206
233 #if defined(OS_MACOSX) || defined(OS_WIN) 207 #if defined(OS_MACOSX) || defined(OS_WIN)
234 return false; 208 return false;
235 #else 209 #else
236 return IsThreadedCompositingEnabled(); 210 return true;
237 #endif 211 #endif
238 } 212 }
239 213
240 bool IsGpuRasterizationEnabled() { 214 bool IsGpuRasterizationEnabled() {
241 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 215 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
242 216
243 if (!IsImplSidePaintingEnabled()) 217 if (!IsImplSidePaintingEnabled())
244 return false; 218 return false;
245 219
246 if (command_line.HasSwitch(switches::kDisableGpuRasterization)) 220 if (command_line.HasSwitch(switches::kDisableGpuRasterization))
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (gpu_feature_info.name == kWebGLFeatureName && 270 if (gpu_feature_info.name == kWebGLFeatureName &&
297 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) 271 manager->IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
298 status += "_readback"; 272 status += "_readback";
299 if (gpu_feature_info.name == kRasterizationFeatureName) { 273 if (gpu_feature_info.name == kRasterizationFeatureName) {
300 if (IsForceGpuRasterizationEnabled()) 274 if (IsForceGpuRasterizationEnabled())
301 status += "_force"; 275 status += "_force";
302 } 276 }
303 if (gpu_feature_info.name == kThreadedRasterizationFeatureName) 277 if (gpu_feature_info.name == kThreadedRasterizationFeatureName)
304 status += "_on"; 278 status += "_on";
305 } 279 }
306 if (gpu_feature_info.name == kGpuCompositingFeatureName) {
307 if (IsThreadedCompositingEnabled())
308 status += "_threaded";
309 }
310 if (gpu_feature_info.name == kWebGLFeatureName && 280 if (gpu_feature_info.name == kWebGLFeatureName &&
311 (gpu_feature_info.blocked || gpu_access_blocked) && 281 (gpu_feature_info.blocked || gpu_access_blocked) &&
312 manager->ShouldUseSwiftShader()) { 282 manager->ShouldUseSwiftShader()) {
313 status = "unavailable_software"; 283 status = "unavailable_software";
314 } 284 }
315 285
316 feature_status_dict->SetString( 286 feature_status_dict->SetString(
317 gpu_feature_info.name.c_str(), status.c_str()); 287 gpu_feature_info.name.c_str(), status.c_str());
318 } 288 }
319 return feature_status_dict; 289 return feature_status_dict;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 return problem_list; 330 return problem_list;
361 } 331 }
362 332
363 base::Value* GetDriverBugWorkarounds() { 333 base::Value* GetDriverBugWorkarounds() {
364 base::ListValue* workaround_list = new base::ListValue(); 334 base::ListValue* workaround_list = new base::ListValue();
365 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); 335 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list);
366 return workaround_list; 336 return workaround_list;
367 } 337 }
368 338
369 } // namespace content 339 } // 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