Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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)) | 743 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) |
| 748 prefs->accelerated_compositing_enabled = false; | 744 prefs->accelerated_compositing_enabled = false; |
|
piman
2014/04/11 20:30:46
There's no early out in this function, so this is
| |
| 749 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 745 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
| 750 prefs->experimental_webgl_enabled = false; | 746 prefs->experimental_webgl_enabled = false; |
| 751 prefs->pepper_3d_enabled = false; | 747 prefs->pepper_3d_enabled = false; |
| 752 } | 748 } |
| 753 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D)) | 749 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH3D)) |
| 754 prefs->flash_3d_enabled = false; | 750 prefs->flash_3d_enabled = false; |
| 755 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) { | 751 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D)) { |
| 756 prefs->flash_stage3d_enabled = false; | 752 prefs->flash_stage3d_enabled = false; |
| 757 prefs->flash_stage3d_baseline_enabled = false; | 753 prefs->flash_stage3d_baseline_enabled = false; |
| 758 } | 754 } |
| 759 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) | 755 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_FLASH_STAGE3D_BASELINE)) |
| 760 prefs->flash_stage3d_baseline_enabled = false; | 756 prefs->flash_stage3d_baseline_enabled = false; |
| 761 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) | 757 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) |
| 762 prefs->accelerated_2d_canvas_enabled = false; | 758 prefs->accelerated_2d_canvas_enabled = false; |
| 763 if (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTISAMPLING) || | 759 if (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTISAMPLING) || |
| 764 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) && | 760 (IsDriverBugWorkaroundActive(gpu::DISABLE_MULTIMONITOR_MULTISAMPLING) && |
| 765 display_count_ > 1)) | 761 display_count_ > 1)) |
| 766 prefs->gl_multisampling_enabled = false; | 762 prefs->gl_multisampling_enabled = false; |
| 767 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) { | 763 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_3D_CSS)) { |
| 768 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | 764 prefs->accelerated_compositing_for_3d_transforms_enabled = false; |
| 769 prefs->accelerated_compositing_for_animation_enabled = false; | 765 prefs->accelerated_compositing_for_animation_enabled = false; |
|
piman
2014/04/11 20:30:46
This too
(also, does that mean we can completely r
| |
| 770 } | 766 } |
| 771 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO)) | 767 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO)) |
| 772 prefs->accelerated_compositing_for_video_enabled = false; | 768 prefs->accelerated_compositing_for_video_enabled = false; |
|
piman
2014/04/11 20:30:46
This too
| |
| 773 | 769 |
| 774 // Accelerated video and animation are slower than regular when using | 770 // Accelerated video and animation are slower than regular when using |
| 775 // SwiftShader. 3D CSS or Pepper 3D may also be too slow to be worthwhile. | 771 // SwiftShader. 3D CSS or Pepper 3D may also be too slow to be worthwhile. |
| 776 if (ShouldUseSwiftShader()) { | 772 if (ShouldUseSwiftShader()) { |
| 777 prefs->accelerated_compositing_for_video_enabled = false; | |
| 778 prefs->accelerated_compositing_for_animation_enabled = false; | |
| 779 prefs->accelerated_compositing_for_3d_transforms_enabled = false; | |
| 780 prefs->accelerated_compositing_for_plugins_enabled = false; | |
| 781 prefs->pepper_3d_enabled = false; | 773 prefs->pepper_3d_enabled = false; |
| 782 } | 774 } |
| 783 | 775 |
| 784 if (use_software_compositor_) { | 776 prefs->force_compositing_mode = true; |
|
piman
2014/04/11 20:30:46
I'm lost between all the overrides... LayoutTests
| |
| 785 prefs->force_compositing_mode = true; | 777 prefs->accelerated_compositing_enabled = true; |
| 786 prefs->accelerated_compositing_enabled = true; | 778 prefs->accelerated_compositing_for_3d_transforms_enabled = true; |
| 787 prefs->accelerated_compositing_for_3d_transforms_enabled = true; | 779 prefs->accelerated_compositing_for_animation_enabled = true; |
| 788 prefs->accelerated_compositing_for_animation_enabled = true; | 780 prefs->accelerated_compositing_for_plugins_enabled = true; |
| 789 prefs->accelerated_compositing_for_plugins_enabled = true; | 781 prefs->accelerated_compositing_for_video_enabled = true; |
| 790 prefs->accelerated_compositing_for_video_enabled = true; | |
| 791 } | |
| 792 | 782 |
| 793 #if defined(USE_AURA) | 783 #if defined(USE_AURA) |
| 794 if (!CanUseGpuBrowserCompositor()) { | 784 if (!CanUseGpuBrowserCompositor()) { |
| 795 prefs->accelerated_2d_canvas_enabled = false; | 785 prefs->accelerated_2d_canvas_enabled = false; |
| 796 prefs->pepper_3d_enabled = false; | 786 prefs->pepper_3d_enabled = false; |
| 797 } | 787 } |
| 798 #endif | 788 #endif |
| 799 | 789 |
| 800 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && | 790 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && |
| 801 !CommandLine::ForCurrentProcess()->HasSwitch( | 791 !CommandLine::ForCurrentProcess()->HasSwitch( |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 : complete_gpu_info_already_requested_(false), | 947 : complete_gpu_info_already_requested_(false), |
| 958 observer_list_(new GpuDataManagerObserverList), | 948 observer_list_(new GpuDataManagerObserverList), |
| 959 use_swiftshader_(false), | 949 use_swiftshader_(false), |
| 960 card_blacklisted_(false), | 950 card_blacklisted_(false), |
| 961 update_histograms_(true), | 951 update_histograms_(true), |
| 962 window_count_(0), | 952 window_count_(0), |
| 963 domain_blocking_enabled_(true), | 953 domain_blocking_enabled_(true), |
| 964 owner_(owner), | 954 owner_(owner), |
| 965 display_count_(0), | 955 display_count_(0), |
| 966 gpu_process_accessible_(true), | 956 gpu_process_accessible_(true), |
| 967 use_software_compositor_(false), | |
| 968 finalized_(false) { | 957 finalized_(false) { |
| 969 DCHECK(owner_); | 958 DCHECK(owner_); |
| 970 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 959 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 971 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { | 960 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
| 972 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 961 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 973 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); | 962 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); |
| 974 } | 963 } |
| 975 if (command_line->HasSwitch(switches::kDisableGpu)) | 964 if (command_line->HasSwitch(switches::kDisableGpu)) |
| 976 DisableHardwareAcceleration(); | 965 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 | 966 |
| 983 #if defined(OS_MACOSX) | 967 #if defined(OS_MACOSX) |
| 984 CGGetActiveDisplayList (0, NULL, &display_count_); | 968 CGGetActiveDisplayList (0, NULL, &display_count_); |
| 985 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); | 969 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
| 986 #endif // OS_MACOSX | 970 #endif // OS_MACOSX |
| 987 | 971 |
| 988 // For testing only. | 972 // For testing only. |
| 989 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { | 973 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { |
| 990 domain_blocking_enabled_ = false; | 974 domain_blocking_enabled_ = false; |
| 991 } | 975 } |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1190 | 1174 |
| 1191 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1175 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
| 1192 gpu_process_accessible_ = false; | 1176 gpu_process_accessible_ = false; |
| 1193 gpu_info_.finalized = true; | 1177 gpu_info_.finalized = true; |
| 1194 complete_gpu_info_already_requested_ = true; | 1178 complete_gpu_info_already_requested_ = true; |
| 1195 // Some observers might be waiting. | 1179 // Some observers might be waiting. |
| 1196 NotifyGpuInfoUpdate(); | 1180 NotifyGpuInfoUpdate(); |
| 1197 } | 1181 } |
| 1198 | 1182 |
| 1199 } // namespace content | 1183 } // namespace content |
| OLD | NEW |