| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/gpu_data_manager_impl_private.h" | 5 #include "content/browser/gpu/gpu_data_manager_impl_private.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 prefs->accelerated_compositing_for_video_enabled = false; | 805 prefs->accelerated_compositing_for_video_enabled = false; |
| 806 | 806 |
| 807 // Accelerated video and animation are slower than regular when using | 807 // Accelerated video and animation are slower than regular when using |
| 808 // SwiftShader. 3D CSS may also be too slow to be worthwhile. | 808 // SwiftShader. 3D CSS may also be too slow to be worthwhile. |
| 809 if (ShouldUseSwiftShader()) { | 809 if (ShouldUseSwiftShader()) { |
| 810 prefs->accelerated_compositing_for_video_enabled = false; | 810 prefs->accelerated_compositing_for_video_enabled = false; |
| 811 prefs->accelerated_compositing_for_animation_enabled = false; | 811 prefs->accelerated_compositing_for_animation_enabled = false; |
| 812 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | 812 prefs->accelerated_compositing_for_3d_transforms_enabled = false; |
| 813 prefs->accelerated_compositing_for_plugins_enabled = false; | 813 prefs->accelerated_compositing_for_plugins_enabled = false; |
| 814 } | 814 } |
| 815 |
| 816 if (use_software_compositor_) { |
| 817 prefs->force_compositing_mode = true; |
| 818 prefs->accelerated_compositing_enabled = true; |
| 819 prefs->accelerated_compositing_for_3d_transforms_enabled = true; |
| 820 prefs->accelerated_compositing_for_plugins_enabled = true; |
| 821 } |
| 815 } | 822 } |
| 816 | 823 |
| 817 gpu::GpuSwitchingOption | 824 gpu::GpuSwitchingOption |
| 818 GpuDataManagerImplPrivate::GetGpuSwitchingOption() const { | 825 GpuDataManagerImplPrivate::GetGpuSwitchingOption() const { |
| 819 if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) | 826 if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) |
| 820 return gpu::GPU_SWITCHING_OPTION_UNKNOWN; | 827 return gpu::GPU_SWITCHING_OPTION_UNKNOWN; |
| 821 return gpu_switching_; | 828 return gpu_switching_; |
| 822 } | 829 } |
| 823 | 830 |
| 824 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { | 831 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 : complete_gpu_info_already_requested_(false), | 964 : complete_gpu_info_already_requested_(false), |
| 958 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), | 965 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), |
| 959 observer_list_(new GpuDataManagerObserverList), | 966 observer_list_(new GpuDataManagerObserverList), |
| 960 use_swiftshader_(false), | 967 use_swiftshader_(false), |
| 961 card_blacklisted_(false), | 968 card_blacklisted_(false), |
| 962 update_histograms_(true), | 969 update_histograms_(true), |
| 963 window_count_(0), | 970 window_count_(0), |
| 964 domain_blocking_enabled_(true), | 971 domain_blocking_enabled_(true), |
| 965 owner_(owner), | 972 owner_(owner), |
| 966 display_count_(0), | 973 display_count_(0), |
| 967 gpu_process_accessible_(true) { | 974 gpu_process_accessible_(true), |
| 975 use_software_compositor_(false) { |
| 968 DCHECK(owner_); | 976 DCHECK(owner_); |
| 969 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 977 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 970 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { | 978 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
| 971 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 979 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 972 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); | 980 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); |
| 973 } | 981 } |
| 974 if (command_line->HasSwitch(switches::kDisableGpu)) | 982 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 975 DisableHardwareAcceleration(); | 983 DisableHardwareAcceleration(); |
| 984 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) |
| 985 use_software_compositor_ = true; |
| 976 if (command_line->HasSwitch(switches::kGpuSwitching)) { | 986 if (command_line->HasSwitch(switches::kGpuSwitching)) { |
| 977 std::string option_string = command_line->GetSwitchValueASCII( | 987 std::string option_string = command_line->GetSwitchValueASCII( |
| 978 switches::kGpuSwitching); | 988 switches::kGpuSwitching); |
| 979 gpu::GpuSwitchingOption option = | 989 gpu::GpuSwitchingOption option = |
| 980 gpu::StringToGpuSwitchingOption(option_string); | 990 gpu::StringToGpuSwitchingOption(option_string); |
| 981 if (option != gpu::GPU_SWITCHING_OPTION_UNKNOWN) | 991 if (option != gpu::GPU_SWITCHING_OPTION_UNKNOWN) |
| 982 gpu_switching_ = option; | 992 gpu_switching_ = option; |
| 983 } | 993 } |
| 984 | 994 |
| 985 #if defined(OS_MACOSX) | 995 #if defined(OS_MACOSX) |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1219 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
| 1210 gpu_process_accessible_ = false; | 1220 gpu_process_accessible_ = false; |
| 1211 gpu_info_.finalized = true; | 1221 gpu_info_.finalized = true; |
| 1212 complete_gpu_info_already_requested_ = true; | 1222 complete_gpu_info_already_requested_ = true; |
| 1213 // Some observers might be waiting. | 1223 // Some observers might be waiting. |
| 1214 NotifyGpuInfoUpdate(); | 1224 NotifyGpuInfoUpdate(); |
| 1215 } | 1225 } |
| 1216 | 1226 |
| 1217 } // namespace content | 1227 } // namespace content |
| 1218 | 1228 |
| OLD | NEW |