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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 614 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
615 GpuDataManagerImpl::UnlockedSession session(owner_); | 615 GpuDataManagerImpl::UnlockedSession session(owner_); |
616 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 616 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
617 video_memory_usage_stats); | 617 video_memory_usage_stats); |
618 } | 618 } |
619 | 619 |
620 void GpuDataManagerImplPrivate::AppendRendererCommandLine( | 620 void GpuDataManagerImplPrivate::AppendRendererCommandLine( |
621 CommandLine* command_line) const { | 621 CommandLine* command_line) const { |
622 DCHECK(command_line); | 622 DCHECK(command_line); |
623 | 623 |
624 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { | |
625 if (!command_line->HasSwitch(switches::kDisablePepper3d)) | |
626 command_line->AppendSwitch(switches::kDisablePepper3d); | |
627 } | |
628 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) && | 624 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) && |
629 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) | 625 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) |
630 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 626 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
631 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 627 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
632 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) | 628 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) |
633 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); | 629 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); |
634 #if defined(ENABLE_WEBRTC) | 630 #if defined(ENABLE_WEBRTC) |
635 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && | 631 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && |
636 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) | 632 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) |
637 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); | 633 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); |
638 #endif | 634 #endif |
639 | 635 |
640 if (use_software_compositor_ && | 636 if (use_software_compositor_ && |
641 !command_line->HasSwitch(switches::kEnableSoftwareCompositing)) | 637 !command_line->HasSwitch(switches::kEnableSoftwareCompositing)) |
642 command_line->AppendSwitch(switches::kEnableSoftwareCompositing); | 638 command_line->AppendSwitch(switches::kEnableSoftwareCompositing); |
643 | 639 |
644 #if defined(USE_AURA) | 640 #if defined(USE_AURA) |
645 if (!CanUseGpuBrowserCompositor()) { | 641 if (!CanUseGpuBrowserCompositor()) |
646 command_line->AppendSwitch(switches::kDisableGpuCompositing); | 642 command_line->AppendSwitch(switches::kDisableGpuCompositing); |
647 command_line->AppendSwitch(switches::kDisablePepper3d); | |
648 } | |
649 #endif | 643 #endif |
650 } | 644 } |
651 | 645 |
652 void GpuDataManagerImplPrivate::AppendGpuCommandLine( | 646 void GpuDataManagerImplPrivate::AppendGpuCommandLine( |
653 CommandLine* command_line) const { | 647 CommandLine* command_line) const { |
654 DCHECK(command_line); | 648 DCHECK(command_line); |
655 | 649 |
656 std::string use_gl = | 650 std::string use_gl = |
657 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); | 651 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kUseGL); |
658 base::FilePath swiftshader_path = | 652 base::FilePath swiftshader_path = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
740 } | 734 } |
741 #endif | 735 #endif |
742 } | 736 } |
743 | 737 |
744 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( | 738 void GpuDataManagerImplPrivate::UpdateRendererWebPrefs( |
745 WebPreferences* prefs) const { | 739 WebPreferences* prefs) const { |
746 DCHECK(prefs); | 740 DCHECK(prefs); |
747 | 741 |
748 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) | 742 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) |
749 prefs->accelerated_compositing_enabled = false; | 743 prefs->accelerated_compositing_enabled = false; |
750 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) | 744 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
751 prefs->experimental_webgl_enabled = false; | 745 prefs->experimental_webgl_enabled = false; |
| 746 prefs->pepper_3d_enabled = false; |
| 747 } |
752 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D)) | 748 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D)) |
753 prefs->flash_3d_enabled = false; | 749 prefs->flash_3d_enabled = false; |
754 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) { | 750 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) { |
755 prefs->flash_stage3d_enabled = false; | 751 prefs->flash_stage3d_enabled = false; |
756 prefs->flash_stage3d_baseline_enabled = false; | 752 prefs->flash_stage3d_baseline_enabled = false; |
757 } | 753 } |
758 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) | 754 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) |
759 prefs->flash_stage3d_baseline_enabled = false; | 755 prefs->flash_stage3d_baseline_enabled = false; |
760 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) | 756 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) |
761 prefs->accelerated_2d_canvas_enabled = false; | 757 prefs->accelerated_2d_canvas_enabled = false; |
762 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING) || | 758 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_MULTISAMPLING) || |
763 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) && | 759 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) && |
764 display_count_ > 1)) | 760 display_count_ > 1)) |
765 prefs->gl_multisampling_enabled = false; | 761 prefs->gl_multisampling_enabled = false; |
766 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) { | 762 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) { |
767 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | 763 prefs->accelerated_compositing_for_3d_transforms_enabled = false; |
768 prefs->accelerated_compositing_for_animation_enabled = false; | 764 prefs->accelerated_compositing_for_animation_enabled = false; |
769 } | 765 } |
770 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO)) | 766 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO)) |
771 prefs->accelerated_compositing_for_video_enabled = false; | 767 prefs->accelerated_compositing_for_video_enabled = false; |
772 | 768 |
773 // Accelerated video and animation are slower than regular when using | 769 // Accelerated video and animation are slower than regular when using |
774 // SwiftShader. 3D CSS may also be too slow to be worthwhile. | 770 // SwiftShader. 3D CSS or Pepper 3D may also be too slow to be worthwhile. |
775 if (ShouldUseSwiftShader()) { | 771 if (ShouldUseSwiftShader()) { |
776 prefs->accelerated_compositing_for_video_enabled = false; | 772 prefs->accelerated_compositing_for_video_enabled = false; |
777 prefs->accelerated_compositing_for_animation_enabled = false; | 773 prefs->accelerated_compositing_for_animation_enabled = false; |
778 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | 774 prefs->accelerated_compositing_for_3d_transforms_enabled = false; |
779 prefs->accelerated_compositing_for_plugins_enabled = false; | 775 prefs->accelerated_compositing_for_plugins_enabled = false; |
| 776 prefs->pepper_3d_enabled = false; |
780 } | 777 } |
781 | 778 |
782 if (use_software_compositor_) { | 779 if (use_software_compositor_) { |
783 prefs->force_compositing_mode = true; | 780 prefs->force_compositing_mode = true; |
784 prefs->accelerated_compositing_enabled = true; | 781 prefs->accelerated_compositing_enabled = true; |
785 prefs->accelerated_compositing_for_3d_transforms_enabled = true; | 782 prefs->accelerated_compositing_for_3d_transforms_enabled = true; |
786 prefs->accelerated_compositing_for_plugins_enabled = true; | 783 prefs->accelerated_compositing_for_plugins_enabled = true; |
787 prefs->accelerated_compositing_for_video_enabled = true; | 784 prefs->accelerated_compositing_for_video_enabled = true; |
788 } | 785 } |
789 | 786 |
790 #if defined(USE_AURA) | 787 #if defined(USE_AURA) |
791 if (!CanUseGpuBrowserCompositor()) | 788 if (!CanUseGpuBrowserCompositor()) { |
792 prefs->accelerated_2d_canvas_enabled = false; | 789 prefs->accelerated_2d_canvas_enabled = false; |
| 790 prefs->pepper_3d_enabled = false; |
| 791 } |
793 #endif | 792 #endif |
794 } | 793 } |
795 | 794 |
796 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { | 795 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { |
797 card_blacklisted_ = true; | 796 card_blacklisted_ = true; |
798 | 797 |
799 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) | 798 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) |
800 blacklisted_features_.insert(i); | 799 blacklisted_features_.insert(i); |
801 | 800 |
802 EnableSwiftShaderIfNecessary(); | 801 EnableSwiftShaderIfNecessary(); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 | 1176 |
1178 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1177 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1179 gpu_process_accessible_ = false; | 1178 gpu_process_accessible_ = false; |
1180 gpu_info_.finalized = true; | 1179 gpu_info_.finalized = true; |
1181 complete_gpu_info_already_requested_ = true; | 1180 complete_gpu_info_already_requested_ = true; |
1182 // Some observers might be waiting. | 1181 // Some observers might be waiting. |
1183 NotifyGpuInfoUpdate(); | 1182 NotifyGpuInfoUpdate(); |
1184 } | 1183 } |
1185 | 1184 |
1186 } // namespace content | 1185 } // namespace content |
OLD | NEW |