| OLD | NEW |
| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "cc/base/switches.h" | 10 #include "cc/base/switches.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); | 187 gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace | 190 } // namespace |
| 191 | 191 |
| 192 bool IsThreadedCompositingEnabled() { | 192 bool IsThreadedCompositingEnabled() { |
| 193 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 193 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 194 | 194 |
| 195 // Command line switches take precedence over blacklist. | 195 // Command line switches take precedence over blacklist. |
| 196 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || | 196 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || |
| 197 command_line.HasSwitch(switches::kDisableThreadedCompositing)) { | 197 command_line.HasSwitch(switches::kDisableThreadedCompositing)) |
| 198 return false; | 198 return false; |
| 199 } else if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) { | 199 if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) |
| 200 return true; | 200 return true; |
| 201 } | |
| 202 | 201 |
| 203 #if defined(USE_AURA) || defined(OS_MACOSX) | 202 #if defined(USE_AURA) || defined(OS_MACOSX) |
| 204 // We always want threaded compositing on Aura and Mac (the fallback is a | 203 // We always want threaded compositing on Aura and Mac (the fallback is a |
| 205 // threaded software compositor). | 204 // threaded software compositor). |
| 206 return true; | 205 return true; |
| 207 #endif | 206 #else |
| 208 | |
| 209 if (!CanDoAcceleratedCompositing() || IsForceCompositingModeBlacklisted()) | 207 if (!CanDoAcceleratedCompositing() || IsForceCompositingModeBlacklisted()) |
| 210 return false; | 208 return false; |
| 211 | 209 |
| 212 #if defined(OS_WIN) | 210 #if defined(OS_WIN) |
| 213 // Windows Vista+ has been shipping with TCM enabled at 100% since M24 and | 211 // Windows Vista+ has been shipping with TCM enabled at 100% since M24 and |
| 214 // The blacklist check above takes care of returning false before this hits | 212 // The blacklist check above takes care of returning false before this hits |
| 215 // on unsupported Win versions. | 213 // on unsupported Win versions. |
| 216 return true; | 214 return true; |
| 215 #else |
| 216 return false; |
| 217 #endif | 217 #endif |
| 218 | 218 #endif |
| 219 return false; | |
| 220 } | 219 } |
| 221 | 220 |
| 222 bool IsForceCompositingModeEnabled() { | 221 bool IsForceCompositingModeEnabled() { |
| 223 // Force compositing mode is a subset of threaded compositing mode. | 222 // Force compositing mode is a subset of threaded compositing mode. |
| 224 if (IsThreadedCompositingEnabled()) | 223 if (IsThreadedCompositingEnabled()) |
| 225 return true; | 224 return true; |
| 226 | 225 |
| 227 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 226 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 228 | 227 |
| 229 // Command line switches take precedence over blacklisting. | 228 // Command line switches take precedence over blacklisting. |
| 230 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) | 229 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) |
| 231 return false; | 230 return false; |
| 232 else if (command_line.HasSwitch(switches::kForceCompositingMode)) | 231 if (command_line.HasSwitch(switches::kForceCompositingMode)) |
| 233 return true; | 232 return true; |
| 234 | 233 |
| 235 if (!CanDoAcceleratedCompositing() || IsForceCompositingModeBlacklisted()) | 234 if (!CanDoAcceleratedCompositing() || IsForceCompositingModeBlacklisted()) |
| 236 return false; | 235 return false; |
| 237 | 236 |
| 238 #if defined(OS_MACOSX) || defined(OS_WIN) | 237 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 239 // Windows Vista+ has been shipping with TCM enabled at 100% since M24 and | 238 // Windows Vista+ has been shipping with TCM enabled at 100% since M24 and |
| 240 // Mac OSX 10.8+ since M28. The blacklist check above takes care of returning | 239 // Mac OSX 10.8+ since M28. The blacklist check above takes care of returning |
| 241 // false before this hits on unsupported Win/Mac versions. | 240 // false before this hits on unsupported Win/Mac versions. |
| 242 return true; | 241 return true; |
| 242 #else |
| 243 return false; |
| 243 #endif | 244 #endif |
| 244 | |
| 245 return false; | |
| 246 } | 245 } |
| 247 | 246 |
| 248 bool IsDelegatedRendererEnabled() { | 247 bool IsDelegatedRendererEnabled() { |
| 249 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 248 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 250 bool enabled = false; | 249 bool enabled = false; |
| 251 | 250 |
| 252 #if defined(USE_AURA) | 251 #if defined(USE_AURA) |
| 253 // Enable on Aura. | 252 // Enable on Aura. |
| 254 enabled = true; | 253 enabled = true; |
| 255 #endif | 254 #endif |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 return problem_list; | 396 return problem_list; |
| 398 } | 397 } |
| 399 | 398 |
| 400 base::Value* GetDriverBugWorkarounds() { | 399 base::Value* GetDriverBugWorkarounds() { |
| 401 base::ListValue* workaround_list = new base::ListValue(); | 400 base::ListValue* workaround_list = new base::ListValue(); |
| 402 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); | 401 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); |
| 403 return workaround_list; | 402 return workaround_list; |
| 404 } | 403 } |
| 405 | 404 |
| 406 } // namespace content | 405 } // namespace content |
| OLD | NEW |