| 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" |
| 11 #include "content/browser/gpu/gpu_data_manager_impl.h" | 11 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "gpu/config/gpu_feature_type.h" | 13 #include "gpu/config/gpu_feature_type.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 struct GpuFeatureInfo { | 19 struct GpuFeatureInfo { |
| 20 std::string name; | 20 std::string name; |
| 21 uint32 blocked; | 21 uint32 blocked; |
| 22 bool disabled; | 22 bool disabled; |
| 23 std::string disabled_description; | 23 std::string disabled_description; |
| 24 bool fallback_to_software; | 24 bool fallback_to_software; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Determine if accelerated-2d-canvas is supported, which depends on whether | |
| 28 // lose_context could happen. | |
| 29 bool SupportsAccelerated2dCanvas() { | |
| 30 if (GpuDataManagerImpl::GetInstance()->GetGPUInfo().can_lose_context) | |
| 31 return false; | |
| 32 return true; | |
| 33 } | |
| 34 | |
| 35 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 36 const size_t kNumFeatures = 14; | 28 const size_t kNumFeatures = 14; |
| 37 #else | 29 #else |
| 38 const size_t kNumFeatures = 13; | 30 const size_t kNumFeatures = 13; |
| 39 #endif | 31 #endif |
| 40 const GpuFeatureInfo GetGpuFeatureInfo(size_t index) { | 32 const GpuFeatureInfo GetGpuFeatureInfo(size_t index) { |
| 41 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 33 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 42 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); | 34 GpuDataManagerImpl* manager = GpuDataManagerImpl::GetInstance(); |
| 43 | 35 |
| 44 const GpuFeatureInfo kGpuFeatureInfo[] = { | 36 const GpuFeatureInfo kGpuFeatureInfo[] = { |
| 45 { | 37 { |
| 46 "2d_canvas", | 38 "2d_canvas", |
| 47 manager->IsFeatureBlacklisted( | 39 manager->IsFeatureBlacklisted( |
| 48 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), | 40 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS), |
| 49 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || | 41 command_line.HasSwitch(switches::kDisableAccelerated2dCanvas) || |
| 50 !SupportsAccelerated2dCanvas(), | 42 !GpuDataManagerImpl::GetInstance()-> |
| 43 GetGPUInfo().SupportsAccelerated2dCanvas(), |
| 51 "Accelerated 2D canvas is unavailable: either disabled at the command" | 44 "Accelerated 2D canvas is unavailable: either disabled at the command" |
| 52 " line or not supported by the current system.", | 45 " line or not supported by the current system.", |
| 53 true | 46 true |
| 54 }, | 47 }, |
| 55 { | 48 { |
| 56 "compositing", | 49 "compositing", |
| 57 manager->IsFeatureBlacklisted( | 50 manager->IsFeatureBlacklisted( |
| 58 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING), | 51 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING), |
| 59 command_line.HasSwitch(switches::kDisableAcceleratedCompositing), | 52 command_line.HasSwitch(switches::kDisableAcceleratedCompositing), |
| 60 "Accelerated compositing has been disabled, either via about:flags or" | 53 "Accelerated compositing has been disabled, either via about:flags or" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 return problem_list; | 394 return problem_list; |
| 402 } | 395 } |
| 403 | 396 |
| 404 base::Value* GetDriverBugWorkarounds() { | 397 base::Value* GetDriverBugWorkarounds() { |
| 405 base::ListValue* workaround_list = new base::ListValue(); | 398 base::ListValue* workaround_list = new base::ListValue(); |
| 406 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); | 399 GpuDataManagerImpl::GetInstance()->GetDriverBugWorkarounds(workaround_list); |
| 407 return workaround_list; | 400 return workaround_list; |
| 408 } | 401 } |
| 409 | 402 |
| 410 } // namespace content | 403 } // namespace content |
| OLD | NEW |