| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if (enabled && | 262 if (enabled && |
| 263 (!IsForceCompositingModeEnabled() || !IsThreadedCompositingEnabled())) { | 263 (!IsForceCompositingModeEnabled() || !IsThreadedCompositingEnabled())) { |
| 264 enabled = false; | 264 enabled = false; |
| 265 LOG(ERROR) << "Disabling delegated-rendering because it needs " | 265 LOG(ERROR) << "Disabling delegated-rendering because it needs " |
| 266 << "force-compositing-mode and threaded-compositing."; | 266 << "force-compositing-mode and threaded-compositing."; |
| 267 } | 267 } |
| 268 | 268 |
| 269 return enabled; | 269 return enabled; |
| 270 } | 270 } |
| 271 | 271 |
| 272 bool IsImplSidePaintingEnabled() { |
| 273 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 274 |
| 275 if (command_line.HasSwitch(switches::kDisableImplSidePainting)) |
| 276 return false; |
| 277 else if (command_line.HasSwitch(switches::kEnableImplSidePainting)) |
| 278 return true; |
| 279 |
| 280 #if defined(OS_ANDROID) |
| 281 return true; |
| 282 #else |
| 283 return false; |
| 284 #endif |
| 285 } |
| 286 |
| 272 base::Value* GetFeatureStatus() { | 287 base::Value* GetFeatureStatus() { |
| 273 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 288 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 274 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 289 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
| 275 std::string gpu_access_blocked_reason; | 290 std::string gpu_access_blocked_reason; |
| 276 bool gpu_access_blocked = | 291 bool gpu_access_blocked = |
| 277 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); | 292 !manager->GpuAccessAllowed(&gpu_access_blocked_reason); |
| 278 | 293 |
| 279 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); | 294 base::DictionaryValue* feature_status_dict = new base::DictionaryValue(); |
| 280 | 295 |
| 281 bool eof = false; | 296 bool eof = false; |
| 282 for (size_t i = 0; !eof; ++i) { | 297 for (size_t i = 0; !eof; ++i) { |
| 283 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); | 298 const GpuFeatureInfo gpu_feature_info = GetGpuFeatureInfo(i, &eof); |
| 284 // force_compositing_mode status is part of the compositing status. | 299 // force_compositing_mode status is part of the compositing status. |
| 285 if (gpu_feature_info.name == "force_compositing_mode") | 300 if (gpu_feature_info.name == "force_compositing_mode") |
| 286 continue; | 301 continue; |
| 287 | 302 |
| 288 std::string status; | 303 std::string status; |
| 289 if (gpu_feature_info.disabled) { | 304 if (gpu_feature_info.disabled) { |
| 290 status = "disabled"; | 305 status = "disabled"; |
| 291 if (gpu_feature_info.name == "css_animation") { | 306 if (gpu_feature_info.name == "css_animation") { |
| 292 status += "_software_animated"; | 307 status += "_software_animated"; |
| 293 } else if (gpu_feature_info.name == "raster") { | 308 } else if (gpu_feature_info.name == "raster") { |
| 294 if (cc::switches::IsImplSidePaintingEnabled()) | 309 if (IsImplSidePaintingEnabled()) |
| 295 status += "_software_multithreaded"; | 310 status += "_software_multithreaded"; |
| 296 else | 311 else |
| 297 status += "_software"; | 312 status += "_software"; |
| 298 } else { | 313 } else { |
| 299 if (gpu_feature_info.fallback_to_software) | 314 if (gpu_feature_info.fallback_to_software) |
| 300 status += "_software"; | 315 status += "_software"; |
| 301 else | 316 else |
| 302 status += "_off"; | 317 status += "_off"; |
| 303 } | 318 } |
| 304 } else if (manager->ShouldUseSwiftShader()) { | 319 } else if (manager->ShouldUseSwiftShader()) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 326 status += "_threaded"; | 341 status += "_threaded"; |
| 327 } | 342 } |
| 328 if (gpu_feature_info.name == "css_animation") { | 343 if (gpu_feature_info.name == "css_animation") { |
| 329 if (has_thread) | 344 if (has_thread) |
| 330 status = "accelerated_threaded"; | 345 status = "accelerated_threaded"; |
| 331 else | 346 else |
| 332 status = "accelerated"; | 347 status = "accelerated"; |
| 333 } | 348 } |
| 334 } | 349 } |
| 335 // TODO(reveman): Remove this when crbug.com/223286 has been fixed. | 350 // TODO(reveman): Remove this when crbug.com/223286 has been fixed. |
| 336 if (gpu_feature_info.name == "raster" && | 351 if (gpu_feature_info.name == "raster" && IsImplSidePaintingEnabled()) |
| 337 cc::switches::IsImplSidePaintingEnabled()) { | |
| 338 status = "disabled_software_multithreaded"; | 352 status = "disabled_software_multithreaded"; |
| 339 } | |
| 340 feature_status_dict->SetString( | 353 feature_status_dict->SetString( |
| 341 gpu_feature_info.name.c_str(), status.c_str()); | 354 gpu_feature_info.name.c_str(), status.c_str()); |
| 342 } | 355 } |
| 343 return feature_status_dict; | 356 return feature_status_dict; |
| 344 } | 357 } |
| 345 | 358 |
| 346 base::Value* GetProblems() { | 359 base::Value* GetProblems() { |
| 347 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 360 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
| 348 std::string gpu_access_blocked_reason; | 361 std::string gpu_access_blocked_reason; |
| 349 bool gpu_access_blocked = | 362 bool gpu_access_blocked = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 return problem_list; | 397 return problem_list; |
| 385 } | 398 } |
| 386 | 399 |
| 387 base::Value* GetDriverBugWorkarounds() { | 400 base::Value* GetDriverBugWorkarounds() { |
| 388 base::ListValue* workaround_list = new base::ListValue(); | 401 base::ListValue* workaround_list = new base::ListValue(); |
| 389 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); | 402 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); |
| 390 return workaround_list; | 403 return workaround_list; |
| 391 } | 404 } |
| 392 | 405 |
| 393 } // namespace content | 406 } // namespace content |
| OLD | NEW |