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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 638 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
639 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 639 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
640 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | 640 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
641 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 641 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
642 #if defined(ENABLE_WEBRTC) | 642 #if defined(ENABLE_WEBRTC) |
643 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 643 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
644 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | 644 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) |
645 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 645 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
646 #endif | 646 #endif |
647 | 647 |
648 if (use_software_compositor_ && | |
649 !command_line->HasSwitch(switches::kEnableSoftwareCompositing)) | |
650 command_line->AppendSwitch(switches::kEnableSoftwareCompositing); | |
651 | |
652 #if defined(USE_AURA) | 648 #if defined(USE_AURA) |
653 if (!CanUseGpuBrowserCompositor()) | 649 if (!CanUseGpuBrowserCompositor()) |
654 command_line->AppendSwitch(switches::kDisableGpuCompositing); | 650 command_line->AppendSwitch(switches::kDisableGpuCompositing); |
655 #endif | 651 #endif |
656 } | 652 } |
657 | 653 |
658 void GpuDataManagerImplPrivate::AppendGpuCommandLine( | 654 void GpuDataManagerImplPrivate::AppendGpuCommandLine( |
659 CommandLine* command_line) const { | 655 CommandLine* command_line) const { |
660 DCHECK(command_line); | 656 DCHECK(command_line); |
661 | 657 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 command_line->AppendSwitch( | 733 command_line->AppendSwitch( |
738 switches::kDisableCoreAnimationPlugins); | 734 switches::kDisableCoreAnimationPlugins); |
739 } | 735 } |
740 #endif | 736 #endif |
741 } | 737 } |
742 | 738 |
743 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( | 739 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( |
744 WebPreferences* prefs) const { | 740 WebPreferences* prefs) const { |
745 DCHECK(prefs); | 741 DCHECK(prefs); |
746 | 742 |
747 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) | |
748 prefs->accelerated_compositing_enabled = false; | |
749 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 743 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
750 prefs->experimental_webgl_enabled = false; | 744 prefs->experimental_webgl_enabled = false; |
751 prefs->pepper_3d_enabled = false; | 745 prefs->pepper_3d_enabled = false; |
752 } | 746 } |
753 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D)) | 747 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D)) |
754 prefs->flash_3d_enabled = false; | 748 prefs->flash_3d_enabled = false; |
755 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) { | 749 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) { |
756 prefs->flash_stage3d_enabled = false; | 750 prefs->flash_stage3d_enabled = false; |
757 prefs->flash_stage3d_baseline_enabled = false; | 751 prefs->flash_stage3d_baseline_enabled = false; |
758 } | 752 } |
759 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) | 753 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) |
760 prefs->flash_stage3d_baseline_enabled = false; | 754 prefs->flash_stage3d_baseline_enabled = false; |
761 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) | 755 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) |
762 prefs->accelerated_2d_canvas_enabled = false; | 756 prefs->accelerated_2d_canvas_enabled = false; |
763 if (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTISAMPLING) || | 757 if (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTISAMPLING) || |
764 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) && | 758 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) && |
765 display_count_ > 1)) | 759 display_count_ > 1)) |
766 prefs->gl_multisampling_enabled = false; | 760 prefs->gl_multisampling_enabled = false; |
767 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) { | |
768 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | |
769 prefs->accelerated_compositing_for_animation_enabled = false; | |
770 } | |
771 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO)) | |
772 prefs->accelerated_compositing_for_video_enabled = false; | |
773 | 761 |
774 // Accelerated video and animation are slower than regular when using | 762 prefs->force_compositing_mode = true; |
775 // SwiftShader. 3D CSS or Pepper 3D may also be too slow to be worthwhile. | 763 prefs->accelerated_compositing_enabled = true; |
776 if (ShouldUseSwiftShader()) { | 764 prefs->accelerated_compositing_for_3d_transforms_enabled = true; |
777 prefs->accelerated_compositing_for_video_enabled = false; | 765 prefs->accelerated_compositing_for_animation_enabled = true; |
778 prefs->accelerated_compositing_for_animation_enabled = false; | 766 prefs->accelerated_compositing_for_plugins_enabled = true; |
779 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | 767 prefs->accelerated_compositing_for_video_enabled = true; |
780 prefs->accelerated_compositing_for_plugins_enabled = false; | |
781 prefs->pepper_3d_enabled = false; | |
782 } | |
783 | |
784 if (use_software_compositor_) { | |
785 prefs->force_compositing_mode = true; | |
786 prefs->accelerated_compositing_enabled = true; | |
787 prefs->accelerated_compositing_for_3d_transforms_enabled = true; | |
788 prefs->accelerated_compositing_for_animation_enabled = true; | |
789 prefs->accelerated_compositing_for_plugins_enabled = true; | |
790 prefs->accelerated_compositing_for_video_enabled = true; | |
791 } | |
792 | 768 |
793 #if defined(USE_AURA) | 769 #if defined(USE_AURA) |
794 if (!CanUseGpuBrowserCompositor()) { | 770 if (!CanUseGpuBrowserCompositor()) { |
795 prefs->accelerated_2d_canvas_enabled = false; | 771 prefs->accelerated_2d_canvas_enabled = false; |
796 prefs->pepper_3d_enabled = false; | 772 prefs->pepper_3d_enabled = false; |
797 } | 773 } |
798 #endif | 774 #endif |
799 | 775 |
800 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 776 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
801 !CommandLine::ForCurrentProcess()->HasSwitch( | 777 !CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 : complete_gpu_info_already_requested_(false), | 933 : complete_gpu_info_already_requested_(false), |
958 observer_list_(new GpuDataManagerObserverList), | 934 observer_list_(new GpuDataManagerObserverList), |
959 use_swiftshader_(false), | 935 use_swiftshader_(false), |
960 card_blacklisted_(false), | 936 card_blacklisted_(false), |
961 update_histograms_(true), | 937 update_histograms_(true), |
962 window_count_(0), | 938 window_count_(0), |
963 domain_blocking_enabled_(true), | 939 domain_blocking_enabled_(true), |
964 owner_(owner), | 940 owner_(owner), |
965 display_count_(0), | 941 display_count_(0), |
966 gpu_process_accessible_(true), | 942 gpu_process_accessible_(true), |
967 use_software_compositor_(false), | |
968 finalized_(false) { | 943 finalized_(false) { |
969 DCHECK(owner_); | 944 DCHECK(owner_); |
970 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 945 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
971 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { | 946 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
972 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 947 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
973 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); | 948 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); |
974 } | 949 } |
975 if (command_line->HasSwitch(switches::kDisableGpu)) | 950 if (command_line->HasSwitch(switches::kDisableGpu)) |
976 DisableHardwareAcceleration(); | 951 DisableHardwareAcceleration(); |
977 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) | |
978 use_software_compositor_ = true; | |
979 #if defined(USE_AURA) || defined(OS_MACOSX) | |
980 use_software_compositor_ = true; | |
981 #endif | |
982 | 952 |
983 #if defined(OS_MACOSX) | 953 #if defined(OS_MACOSX) |
984 CGGetActiveDisplayList (0, NULL, &display_count_); | 954 CGGetActiveDisplayList (0, NULL, &display_count_); |
985 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); | 955 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
986 #endif // OS_MACOSX | 956 #endif // OS_MACOSX |
987 | 957 |
988 // For testing only. | 958 // For testing only. |
989 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { | 959 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { |
990 domain_blocking_enabled_ = false; | 960 domain_blocking_enabled_ = false; |
991 } | 961 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 | 1160 |
1191 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1161 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1192 gpu_process_accessible_ = false; | 1162 gpu_process_accessible_ = false; |
1193 gpu_info_.finalized = true; | 1163 gpu_info_.finalized = true; |
1194 complete_gpu_info_already_requested_ = true; | 1164 complete_gpu_info_already_requested_ = true; |
1195 // Some observers might be waiting. | 1165 // Some observers might be waiting. |
1196 NotifyGpuInfoUpdate(); | 1166 NotifyGpuInfoUpdate(); |
1197 } | 1167 } |
1198 | 1168 |
1199 } // namespace content | 1169 } // namespace content |
OLD | NEW |