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

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

Issue 19267016: Add a flag to allow renderer to use software compositor when GL compositor doesn't work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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) 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
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 : complete_gpu_info_already_requested_(false), 963 : complete_gpu_info_already_requested_(false),
957 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), 964 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC),
958 observer_list_(new GpuDataManagerObserverList), 965 observer_list_(new GpuDataManagerObserverList),
959 use_swiftshader_(false), 966 use_swiftshader_(false),
960 card_blacklisted_(false), 967 card_blacklisted_(false),
961 update_histograms_(true), 968 update_histograms_(true),
962 window_count_(0), 969 window_count_(0),
963 domain_blocking_enabled_(true), 970 domain_blocking_enabled_(true),
964 owner_(owner), 971 owner_(owner),
965 display_count_(0), 972 display_count_(0),
966 gpu_process_accessible_(true) { 973 gpu_process_accessible_(true),
974 use_software_compositor_(false) {
967 DCHECK(owner_); 975 DCHECK(owner_);
968 CommandLine* command_line = CommandLine::ForCurrentProcess(); 976 CommandLine* command_line = CommandLine::ForCurrentProcess();
969 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { 977 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) {
970 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); 978 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas);
971 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); 979 command_line->AppendSwitch(switches::kDisableAcceleratedLayers);
972 } 980 }
973 if (command_line->HasSwitch(switches::kDisableGpu)) 981 if (command_line->HasSwitch(switches::kDisableGpu))
974 DisableHardwareAcceleration(); 982 DisableHardwareAcceleration();
983 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing))
984 use_software_compositor_ = true;
975 if (command_line->HasSwitch(switches::kGpuSwitching)) { 985 if (command_line->HasSwitch(switches::kGpuSwitching)) {
976 std::string option_string = command_line->GetSwitchValueASCII( 986 std::string option_string = command_line->GetSwitchValueASCII(
977 switches::kGpuSwitching); 987 switches::kGpuSwitching);
978 gpu::GpuSwitchingOption option = 988 gpu::GpuSwitchingOption option =
979 gpu::StringToGpuSwitchingOption(option_string); 989 gpu::StringToGpuSwitchingOption(option_string);
980 if (option != gpu::GPU_SWITCHING_OPTION_UNKNOWN) 990 if (option != gpu::GPU_SWITCHING_OPTION_UNKNOWN)
981 gpu_switching_ = option; 991 gpu_switching_ = option;
982 } 992 }
983 993
984 #if defined(OS_MACOSX) 994 #if defined(OS_MACOSX)
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { 1218 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() {
1209 gpu_process_accessible_ = false; 1219 gpu_process_accessible_ = false;
1210 gpu_info_.finalized = true; 1220 gpu_info_.finalized = true;
1211 complete_gpu_info_already_requested_ = true; 1221 complete_gpu_info_already_requested_ = true;
1212 // Some observers might be waiting. 1222 // Some observers might be waiting.
1213 NotifyGpuInfoUpdate(); 1223 NotifyGpuInfoUpdate();
1214 } 1224 }
1215 1225
1216 } // namespace content 1226 } // namespace content
1217 1227
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698