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

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

Issue 1121653002: Experiment for disabling accelerated video decoding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 GpuDataManagerImpl::UnlockedSession session(owner_); 592 GpuDataManagerImpl::UnlockedSession session(owner_);
593 observer_list_->Notify(FROM_HERE, 593 observer_list_->Notify(FROM_HERE,
594 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, 594 &GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate,
595 video_memory_usage_stats); 595 video_memory_usage_stats);
596 } 596 }
597 597
598 void GpuDataManagerImplPrivate::AppendRendererCommandLine( 598 void GpuDataManagerImplPrivate::AppendRendererCommandLine(
599 base::CommandLine* command_line) const { 599 base::CommandLine* command_line) const {
600 DCHECK(command_line); 600 DCHECK(command_line);
601 601
602 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && 602 if (ShouldDisableAcceleratedVideoDecode(command_line))
603 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
604 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); 603 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
605 #if defined(ENABLE_WEBRTC) 604 #if defined(ENABLE_WEBRTC)
606 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && 605 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) &&
607 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) 606 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding))
608 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); 607 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding);
609 #endif 608 #endif
610 609
611 #if defined(USE_AURA) 610 #if defined(USE_AURA)
612 if (!CanUseGpuBrowserCompositor()) 611 if (!CanUseGpuBrowserCompositor())
613 command_line->AppendSwitch(switches::kDisableGpuCompositing); 612 command_line->AppendSwitch(switches::kDisableGpuCompositing);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 if (!swiftshader_path.empty()) { 647 if (!swiftshader_path.empty()) {
649 command_line->AppendSwitchPath(switches::kSwiftShaderPath, 648 command_line->AppendSwitchPath(switches::kSwiftShaderPath,
650 swiftshader_path); 649 swiftshader_path);
651 } 650 }
652 651
653 if (!gpu_driver_bugs_.empty()) { 652 if (!gpu_driver_bugs_.empty()) {
654 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, 653 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds,
655 IntSetToString(gpu_driver_bugs_)); 654 IntSetToString(gpu_driver_bugs_));
656 } 655 }
657 656
658 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && 657 if (ShouldDisableAcceleratedVideoDecode(command_line)) {
659 !command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
660 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode); 658 command_line->AppendSwitch(switches::kDisableAcceleratedVideoDecode);
661 } 659 }
662 #if defined(ENABLE_WEBRTC) 660 #if defined(ENABLE_WEBRTC)
663 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) && 661 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE) &&
664 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { 662 !command_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) {
665 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding); 663 command_line->AppendSwitch(switches::kDisableWebRtcHWEncoding);
666 } 664 }
667 #endif 665 #endif
668 666
669 // Pass GPU and driver information to GPU process. We try to avoid full GPU 667 // Pass GPU and driver information to GPU process. We try to avoid full GPU
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 display_count_ > 1)) 727 display_count_ > 1))
730 prefs->gl_multisampling_enabled = false; 728 prefs->gl_multisampling_enabled = false;
731 729
732 #if defined(USE_AURA) 730 #if defined(USE_AURA)
733 if (!CanUseGpuBrowserCompositor()) { 731 if (!CanUseGpuBrowserCompositor()) {
734 prefs->accelerated_2d_canvas_enabled = false; 732 prefs->accelerated_2d_canvas_enabled = false;
735 prefs->pepper_3d_enabled = false; 733 prefs->pepper_3d_enabled = false;
736 } 734 }
737 #endif 735 #endif
738 736
739 if (!IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) && 737 if (!ShouldDisableAcceleratedVideoDecode(
738 base::CommandLine::ForCurrentProcess()) &&
DaleCurtis 2015/05/02 17:37:09 Extract command_line into a local variable?
hubbe 2015/05/04 19:16:21 Done.
740 !base::CommandLine::ForCurrentProcess()->HasSwitch( 739 !base::CommandLine::ForCurrentProcess()->HasSwitch(
741 switches::kDisableAcceleratedVideoDecode)) { 740 switches::kDisableAcceleratedVideoDecode)) {
742 prefs->pepper_accelerated_video_decode_enabled = true; 741 prefs->pepper_accelerated_video_decode_enabled = true;
743 } 742 }
744 } 743 }
745 744
746 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { 745 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() {
747 card_blacklisted_ = true; 746 card_blacklisted_ = true;
748 747
749 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) 748 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 return false; 868 return false;
870 if (ShouldUseWarp()) 869 if (ShouldUseWarp())
871 return true; 870 return true;
872 if (ShouldUseSwiftShader()) 871 if (ShouldUseSwiftShader())
873 return false; 872 return false;
874 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING)) 873 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_GPU_COMPOSITING))
875 return false; 874 return false;
876 return true; 875 return true;
877 } 876 }
878 877
878 bool GpuDataManagerImplPrivate::ShouldDisableAcceleratedVideoDecode(
879 base::CommandLine* command_line) const {
880 const std::string group_name = base::FieldTrialList::FindFullName(
DaleCurtis 2015/05/02 17:37:09 Pair with if statement below.
hubbe 2015/05/04 19:16:21 No, it needs to be called here as it affects how s
DaleCurtis 2015/05/04 19:38:17 Can you add a comment for that, that's not obvious
hubbe 2015/05/04 20:46:16 Done.
881 "DisableAcceleratedVideoDecode");
882 if (command_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) {
883 // It was already disabled on the command line.
884 return false;
885 }
886 if (IsFeatureBlacklisted(gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE)) {
887 return true;
888 }
889 if (group_name == "Disabled") {
890 return true;
891 }
DaleCurtis 2015/05/02 17:37:09 Style for this file seems to be no {} for one line
hubbe 2015/05/04 19:16:21 Done.
892 return false;
893 }
894
879 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs( 895 void GpuDataManagerImplPrivate::BlockDomainFrom3DAPIs(
880 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) { 896 const GURL& url, GpuDataManagerImpl::DomainGuilt guilt) {
881 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now()); 897 BlockDomainFrom3DAPIsAtTime(url, guilt, base::Time::Now());
882 } 898 }
883 899
884 bool GpuDataManagerImplPrivate::Are3DAPIsBlocked(const GURL& url, 900 bool GpuDataManagerImplPrivate::Are3DAPIsBlocked(const GURL& url,
885 int render_process_id, 901 int render_process_id,
886 int render_view_id, 902 int render_view_id,
887 ThreeDAPIType requester) { 903 ThreeDAPIType requester) {
888 bool blocked = Are3DAPIsBlockedAtTime(url, base::Time::Now()) != 904 bool blocked = Are3DAPIsBlockedAtTime(url, base::Time::Now()) !=
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure; 1169 gpu_info_.context_info_state = gpu::kCollectInfoFatalFailure;
1154 #if defined(OS_WIN) 1170 #if defined(OS_WIN)
1155 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure; 1171 gpu_info_.dx_diagnostics_info_state = gpu::kCollectInfoFatalFailure;
1156 #endif 1172 #endif
1157 complete_gpu_info_already_requested_ = true; 1173 complete_gpu_info_already_requested_ = true;
1158 // Some observers might be waiting. 1174 // Some observers might be waiting.
1159 NotifyGpuInfoUpdate(); 1175 NotifyGpuInfoUpdate();
1160 } 1176 }
1161 1177
1162 } // namespace content 1178 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698