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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 std::stringstream size; | 287 std::stringstream size; |
288 size << default_tile_size; | 288 size << default_tile_size; |
289 command_line->AppendSwitchASCII( | 289 command_line->AppendSwitchASCII( |
290 switches::kDefaultTileWidth, size.str()); | 290 switches::kDefaultTileWidth, size.str()); |
291 command_line->AppendSwitchASCII( | 291 command_line->AppendSwitchASCII( |
292 switches::kDefaultTileHeight, size.str()); | 292 switches::kDefaultTileHeight, size.str()); |
293 } | 293 } |
294 } | 294 } |
295 #endif // OS_ANDROID | 295 #endif // OS_ANDROID |
296 | 296 |
| 297 // Overwrite force gpu workaround if a commandline switch exists. |
| 298 void AdjustGpuSwitchingOption(std::set<int>* workarounds) { |
| 299 DCHECK(workarounds); |
| 300 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 301 std::string option = command_line.GetSwitchValueASCII( |
| 302 switches::kGpuSwitching); |
| 303 if (option == switches::kGpuSwitchingOptionNameForceDiscrete) { |
| 304 workarounds->erase(gpu::FORCE_INTEGRATED_GPU); |
| 305 workarounds->insert(gpu::FORCE_DISCRETE_GPU); |
| 306 } else if (option == switches::kGpuSwitchingOptionNameForceIntegrated) { |
| 307 workarounds->erase(gpu::FORCE_DISCRETE_GPU); |
| 308 workarounds->insert(gpu::FORCE_INTEGRATED_GPU); |
| 309 } |
| 310 } |
| 311 |
297 // Block all domains' use of 3D APIs for this many milliseconds if | 312 // Block all domains' use of 3D APIs for this many milliseconds if |
298 // approaching a threshold where system stability might be compromised. | 313 // approaching a threshold where system stability might be compromised. |
299 const int64 kBlockAllDomainsMs = 10000; | 314 const int64 kBlockAllDomainsMs = 10000; |
300 const int kNumResetsWithinDuration = 1; | 315 const int kNumResetsWithinDuration = 1; |
301 | 316 |
302 // Enums for UMA histograms. | 317 // Enums for UMA histograms. |
303 enum BlockStatusHistogram { | 318 enum BlockStatusHistogram { |
304 BLOCK_STATUS_NOT_BLOCKED, | 319 BLOCK_STATUS_NOT_BLOCKED, |
305 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, | 320 BLOCK_STATUS_SPECIFIC_DOMAIN_BLOCKED, |
306 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, | 321 BLOCK_STATUS_ALL_DOMAINS_BLOCKED, |
307 BLOCK_STATUS_MAX | 322 BLOCK_STATUS_MAX |
308 }; | 323 }; |
309 | 324 |
310 } // namespace anonymous | 325 } // namespace anonymous |
311 | 326 |
312 void GpuDataManagerImplPrivate::InitializeForTesting( | 327 void GpuDataManagerImplPrivate::InitializeForTesting( |
313 const std::string& gpu_blacklist_json, | 328 const std::string& gpu_blacklist_json, |
314 const gpu::GPUInfo& gpu_info) { | 329 const gpu::GPUInfo& gpu_info) { |
315 // This function is for testing only, so disable histograms. | 330 // This function is for testing only, so disable histograms. |
316 update_histograms_ = false; | 331 update_histograms_ = false; |
317 | 332 |
318 // Prevent all further initialization. | 333 // Prevent all further initialization. |
319 finalized_ = true; | 334 finalized_ = true; |
320 | 335 |
321 InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info); | 336 InitializeImpl(gpu_blacklist_json, std::string(), gpu_info); |
322 } | 337 } |
323 | 338 |
324 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { | 339 bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const { |
325 #if defined(OS_CHROMEOS) | 340 #if defined(OS_CHROMEOS) |
326 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && | 341 if (feature == gpu::GPU_FEATURE_TYPE_PANEL_FITTING && |
327 CommandLine::ForCurrentProcess()->HasSwitch( | 342 CommandLine::ForCurrentProcess()->HasSwitch( |
328 switches::kDisablePanelFitting)) { | 343 switches::kDisablePanelFitting)) { |
329 return true; | 344 return true; |
330 } | 345 } |
331 #endif // OS_CHROMEOS | 346 #endif // OS_CHROMEOS |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 TRACE_EVENT0("startup", | 573 TRACE_EVENT0("startup", |
559 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); | 574 "GpuDataManagerImpl::Initialize:CollectBasicGraphicsInfo"); |
560 gpu::CollectBasicGraphicsInfo(&gpu_info); | 575 gpu::CollectBasicGraphicsInfo(&gpu_info); |
561 } | 576 } |
562 #if defined(ARCH_CPU_X86_FAMILY) | 577 #if defined(ARCH_CPU_X86_FAMILY) |
563 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) | 578 if (!gpu_info.gpu.vendor_id || !gpu_info.gpu.device_id) |
564 gpu_info.finalized = true; | 579 gpu_info.finalized = true; |
565 #endif | 580 #endif |
566 | 581 |
567 std::string gpu_blacklist_string; | 582 std::string gpu_blacklist_string; |
568 std::string gpu_switching_list_string; | |
569 std::string gpu_driver_bug_list_string; | 583 std::string gpu_driver_bug_list_string; |
570 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && | 584 if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist) && |
571 !command_line->HasSwitch(switches::kUseGpuInTests)) { | 585 !command_line->HasSwitch(switches::kUseGpuInTests)) { |
572 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; | 586 gpu_blacklist_string = gpu::kSoftwareRenderingListJson; |
573 gpu_switching_list_string = gpu::kGpuSwitchingListJson; | |
574 } | 587 } |
575 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { | 588 if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) { |
576 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; | 589 gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson; |
577 } | 590 } |
578 InitializeImpl(gpu_blacklist_string, | 591 InitializeImpl(gpu_blacklist_string, |
579 gpu_switching_list_string, | |
580 gpu_driver_bug_list_string, | 592 gpu_driver_bug_list_string, |
581 gpu_info); | 593 gpu_info); |
582 } | 594 } |
583 | 595 |
584 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { | 596 void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) { |
585 // No further update of gpu_info if falling back to SwiftShader. | 597 // No further update of gpu_info if falling back to SwiftShader. |
586 if (use_swiftshader_) | 598 if (use_swiftshader_) |
587 return; | 599 return; |
588 | 600 |
589 gpu::MergeGPUInfo(&gpu_info_, gpu_info); | 601 gpu::MergeGPUInfo(&gpu_info_, gpu_info); |
590 complete_gpu_info_already_requested_ = | 602 complete_gpu_info_already_requested_ = |
591 complete_gpu_info_already_requested_ || gpu_info_.finalized; | 603 complete_gpu_info_already_requested_ || gpu_info_.finalized; |
592 | 604 |
593 GetContentClient()->SetGpuInfo(gpu_info_); | 605 GetContentClient()->SetGpuInfo(gpu_info_); |
594 | 606 |
595 if (gpu_blacklist_) { | 607 if (gpu_blacklist_) { |
596 std::set<int> features = gpu_blacklist_->MakeDecision( | 608 std::set<int> features = gpu_blacklist_->MakeDecision( |
597 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 609 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); |
598 if (update_histograms_) | 610 if (update_histograms_) |
599 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); | 611 UpdateStats(gpu_info_, gpu_blacklist_.get(), features); |
600 | 612 |
601 UpdateBlacklistedFeatures(features); | 613 UpdateBlacklistedFeatures(features); |
602 } | 614 } |
603 if (gpu_switching_list_) { | |
604 std::set<int> option = gpu_switching_list_->MakeDecision( | |
605 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | |
606 if (option.size() == 1) { | |
607 // Blacklist decision should not overwrite commandline switch from users. | |
608 CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
609 if (!command_line->HasSwitch(switches::kGpuSwitching)) { | |
610 gpu_switching_ = static_cast<gpu::GpuSwitchingOption>( | |
611 *(option.begin())); | |
612 } | |
613 } | |
614 } | |
615 if (gpu_driver_bug_list_) { | 615 if (gpu_driver_bug_list_) { |
616 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( | 616 gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision( |
617 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); | 617 gpu::GpuControlList::kOsAny, std::string(), gpu_info_); |
618 } | 618 } |
| 619 AdjustGpuSwitchingOption(&gpu_driver_bugs_); |
619 | 620 |
620 // We have to update GpuFeatureType before notify all the observers. | 621 // We have to update GpuFeatureType before notify all the observers. |
621 NotifyGpuInfoUpdate(); | 622 NotifyGpuInfoUpdate(); |
622 } | 623 } |
623 | 624 |
624 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( | 625 void GpuDataManagerImplPrivate::UpdateVideoMemoryUsageStats( |
625 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { | 626 const GPUVideoMemoryUsageStats& video_memory_usage_stats) { |
626 GpuDataManagerImpl::UnlockedSession session(owner_); | 627 GpuDataManagerImpl::UnlockedSession session(owner_); |
627 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, | 628 observer_list_->Notify(&GpuDataManagerObserver::OnVideoMemoryUsageStatsUpdate, |
628 video_memory_usage_stats); | 629 video_memory_usage_stats); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 IsFeatureBlacklisted( | 692 IsFeatureBlacklisted( |
692 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || | 693 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING) || |
693 IsFeatureBlacklisted( | 694 IsFeatureBlacklisted( |
694 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && | 695 gpu::GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS)) && |
695 (use_gl == "any")) { | 696 (use_gl == "any")) { |
696 command_line->AppendSwitchASCII( | 697 command_line->AppendSwitchASCII( |
697 switches::kUseGL, gfx::kGLImplementationOSMesaName); | 698 switches::kUseGL, gfx::kGLImplementationOSMesaName); |
698 } else if (!use_gl.empty()) { | 699 } else if (!use_gl.empty()) { |
699 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); | 700 command_line->AppendSwitchASCII(switches::kUseGL, use_gl); |
700 } | 701 } |
701 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { | 702 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) |
702 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); | 703 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true"); |
703 switch (gpu_switching_) { | 704 else |
704 case gpu::GPU_SWITCHING_OPTION_FORCE_DISCRETE: | |
705 command_line->AppendSwitchASCII(switches::kGpuSwitching, | |
706 switches::kGpuSwitchingOptionNameForceDiscrete); | |
707 break; | |
708 case gpu::GPU_SWITCHING_OPTION_FORCE_INTEGRATED: | |
709 command_line->AppendSwitchASCII(switches::kGpuSwitching, | |
710 switches::kGpuSwitchingOptionNameForceIntegrated); | |
711 break; | |
712 case gpu::GPU_SWITCHING_OPTION_AUTOMATIC: | |
713 case gpu::GPU_SWITCHING_OPTION_UNKNOWN: | |
714 break; | |
715 } | |
716 } else { | |
717 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); | 705 command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false"); |
718 } | |
719 | 706 |
720 if (!swiftshader_path.empty()) { | 707 if (!swiftshader_path.empty()) { |
721 command_line->AppendSwitchPath(switches::kSwiftShaderPath, | 708 command_line->AppendSwitchPath(switches::kSwiftShaderPath, |
722 swiftshader_path); | 709 swiftshader_path); |
723 } | 710 } |
724 | 711 |
725 if (!gpu_driver_bugs_.empty()) { | 712 if (!gpu_driver_bugs_.empty()) { |
726 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, | 713 command_line->AppendSwitchASCII(switches::kGpuDriverBugWorkarounds, |
727 IntSetToString(gpu_driver_bugs_)); | 714 IntSetToString(gpu_driver_bugs_)); |
728 } | 715 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 prefs->accelerated_compositing_for_plugins_enabled = true; | 815 prefs->accelerated_compositing_for_plugins_enabled = true; |
829 prefs->accelerated_compositing_for_video_enabled = true; | 816 prefs->accelerated_compositing_for_video_enabled = true; |
830 } | 817 } |
831 | 818 |
832 #if defined(USE_AURA) | 819 #if defined(USE_AURA) |
833 if (!CanUseGpuBrowserCompositor()) | 820 if (!CanUseGpuBrowserCompositor()) |
834 prefs->accelerated_2d_canvas_enabled = false; | 821 prefs->accelerated_2d_canvas_enabled = false; |
835 #endif | 822 #endif |
836 } | 823 } |
837 | 824 |
838 gpu::GpuSwitchingOption | |
839 GpuDataManagerImplPrivate::GetGpuSwitchingOption() const { | |
840 if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) | |
841 return gpu::GPU_SWITCHING_OPTION_UNKNOWN; | |
842 return gpu_switching_; | |
843 } | |
844 | |
845 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { | 825 void GpuDataManagerImplPrivate::DisableHardwareAcceleration() { |
846 card_blacklisted_ = true; | 826 card_blacklisted_ = true; |
847 | 827 |
848 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) | 828 for (int i = 0; i < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++i) |
849 blacklisted_features_.insert(i); | 829 blacklisted_features_.insert(i); |
850 | 830 |
851 EnableSwiftShaderIfNecessary(); | 831 EnableSwiftShaderIfNecessary(); |
852 NotifyGpuInfoUpdate(); | 832 NotifyGpuInfoUpdate(); |
853 } | 833 } |
854 | 834 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 950 |
971 // static | 951 // static |
972 GpuDataManagerImplPrivate* GpuDataManagerImplPrivate::Create( | 952 GpuDataManagerImplPrivate* GpuDataManagerImplPrivate::Create( |
973 GpuDataManagerImpl* owner) { | 953 GpuDataManagerImpl* owner) { |
974 return new GpuDataManagerImplPrivate(owner); | 954 return new GpuDataManagerImplPrivate(owner); |
975 } | 955 } |
976 | 956 |
977 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( | 957 GpuDataManagerImplPrivate::GpuDataManagerImplPrivate( |
978 GpuDataManagerImpl* owner) | 958 GpuDataManagerImpl* owner) |
979 : complete_gpu_info_already_requested_(false), | 959 : complete_gpu_info_already_requested_(false), |
980 gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC), | |
981 observer_list_(new GpuDataManagerObserverList), | 960 observer_list_(new GpuDataManagerObserverList), |
982 use_swiftshader_(false), | 961 use_swiftshader_(false), |
983 card_blacklisted_(false), | 962 card_blacklisted_(false), |
984 update_histograms_(true), | 963 update_histograms_(true), |
985 window_count_(0), | 964 window_count_(0), |
986 domain_blocking_enabled_(true), | 965 domain_blocking_enabled_(true), |
987 owner_(owner), | 966 owner_(owner), |
988 display_count_(0), | 967 display_count_(0), |
989 gpu_process_accessible_(true), | 968 gpu_process_accessible_(true), |
990 use_software_compositor_(false), | 969 use_software_compositor_(false), |
991 finalized_(false) { | 970 finalized_(false) { |
992 DCHECK(owner_); | 971 DCHECK(owner_); |
993 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 972 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
994 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { | 973 if (command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) { |
995 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 974 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
996 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); | 975 command_line->AppendSwitch(switches::kDisableAcceleratedLayers); |
997 } | 976 } |
998 if (command_line->HasSwitch(switches::kDisableGpu)) | 977 if (command_line->HasSwitch(switches::kDisableGpu)) |
999 DisableHardwareAcceleration(); | 978 DisableHardwareAcceleration(); |
1000 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) | 979 if (command_line->HasSwitch(switches::kEnableSoftwareCompositing)) |
1001 use_software_compositor_ = true; | 980 use_software_compositor_ = true; |
1002 //TODO(jbauman): enable for Chrome OS and Linux | 981 //TODO(jbauman): enable for Chrome OS and Linux |
1003 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 982 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
1004 use_software_compositor_ = true; | 983 use_software_compositor_ = true; |
1005 #endif | 984 #endif |
1006 if (command_line->HasSwitch(switches::kGpuSwitching)) { | |
1007 std::string option_string = command_line->GetSwitchValueASCII( | |
1008 switches::kGpuSwitching); | |
1009 gpu::GpuSwitchingOption option = | |
1010 gpu::StringToGpuSwitchingOption(option_string); | |
1011 if (option != gpu::GPU_SWITCHING_OPTION_UNKNOWN) | |
1012 gpu_switching_ = option; | |
1013 } | |
1014 | 985 |
1015 #if defined(OS_MACOSX) | 986 #if defined(OS_MACOSX) |
1016 CGGetActiveDisplayList (0, NULL, &display_count_); | 987 CGGetActiveDisplayList (0, NULL, &display_count_); |
1017 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); | 988 CGDisplayRegisterReconfigurationCallback(DisplayReconfigCallback, owner_); |
1018 #endif // OS_MACOSX | 989 #endif // OS_MACOSX |
1019 | 990 |
1020 // For testing only. | 991 // For testing only. |
1021 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { | 992 if (command_line->HasSwitch(switches::kDisableDomainBlockingFor3DAPIs)) { |
1022 domain_blocking_enabled_ = false; | 993 domain_blocking_enabled_ = false; |
1023 } | 994 } |
1024 } | 995 } |
1025 | 996 |
1026 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { | 997 GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() { |
1027 #if defined(OS_MACOSX) | 998 #if defined(OS_MACOSX) |
1028 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); | 999 CGDisplayRemoveReconfigurationCallback(DisplayReconfigCallback, owner_); |
1029 #endif | 1000 #endif |
1030 } | 1001 } |
1031 | 1002 |
1032 void GpuDataManagerImplPrivate::InitializeImpl( | 1003 void GpuDataManagerImplPrivate::InitializeImpl( |
1033 const std::string& gpu_blacklist_json, | 1004 const std::string& gpu_blacklist_json, |
1034 const std::string& gpu_switching_list_json, | |
1035 const std::string& gpu_driver_bug_list_json, | 1005 const std::string& gpu_driver_bug_list_json, |
1036 const gpu::GPUInfo& gpu_info) { | 1006 const gpu::GPUInfo& gpu_info) { |
1037 std::string browser_version_string = ProcessVersionString( | 1007 std::string browser_version_string = ProcessVersionString( |
1038 GetContentClient()->GetProduct()); | 1008 GetContentClient()->GetProduct()); |
1039 CHECK(!browser_version_string.empty()); | 1009 CHECK(!browser_version_string.empty()); |
1040 | 1010 |
1041 const bool log_gpu_control_list_decisions = | 1011 const bool log_gpu_control_list_decisions = |
1042 CommandLine::ForCurrentProcess()->HasSwitch( | 1012 CommandLine::ForCurrentProcess()->HasSwitch( |
1043 switches::kLogGpuControlListDecisions); | 1013 switches::kLogGpuControlListDecisions); |
1044 | 1014 |
1045 if (!gpu_blacklist_json.empty()) { | 1015 if (!gpu_blacklist_json.empty()) { |
1046 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); | 1016 gpu_blacklist_.reset(gpu::GpuBlacklist::Create()); |
1047 if (log_gpu_control_list_decisions) | 1017 if (log_gpu_control_list_decisions) |
1048 gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); | 1018 gpu_blacklist_->enable_control_list_logging("gpu_blacklist"); |
1049 bool success = gpu_blacklist_->LoadList( | 1019 bool success = gpu_blacklist_->LoadList( |
1050 browser_version_string, gpu_blacklist_json, | 1020 browser_version_string, gpu_blacklist_json, |
1051 gpu::GpuControlList::kCurrentOsOnly); | 1021 gpu::GpuControlList::kCurrentOsOnly); |
1052 DCHECK(success); | 1022 DCHECK(success); |
1053 } | 1023 } |
1054 if (!gpu_switching_list_json.empty()) { | |
1055 gpu_switching_list_.reset(gpu::GpuSwitchingList::Create()); | |
1056 if (log_gpu_control_list_decisions) | |
1057 gpu_switching_list_->enable_control_list_logging("gpu_switching_list"); | |
1058 bool success = gpu_switching_list_->LoadList( | |
1059 browser_version_string, gpu_switching_list_json, | |
1060 gpu::GpuControlList::kCurrentOsOnly); | |
1061 DCHECK(success); | |
1062 } | |
1063 if (!gpu_driver_bug_list_json.empty()) { | 1024 if (!gpu_driver_bug_list_json.empty()) { |
1064 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); | 1025 gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create()); |
1065 if (log_gpu_control_list_decisions) | 1026 if (log_gpu_control_list_decisions) |
1066 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); | 1027 gpu_driver_bug_list_->enable_control_list_logging("gpu_driver_bug_list"); |
1067 bool success = gpu_driver_bug_list_->LoadList( | 1028 bool success = gpu_driver_bug_list_->LoadList( |
1068 browser_version_string, gpu_driver_bug_list_json, | 1029 browser_version_string, gpu_driver_bug_list_json, |
1069 gpu::GpuControlList::kCurrentOsOnly); | 1030 gpu::GpuControlList::kCurrentOsOnly); |
1070 DCHECK(success); | 1031 DCHECK(success); |
1071 } | 1032 } |
1072 | 1033 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 void GpuDataManagerImplPrivate::UpdatePreliminaryBlacklistedFeatures() { | 1075 void GpuDataManagerImplPrivate::UpdatePreliminaryBlacklistedFeatures() { |
1115 preliminary_blacklisted_features_ = blacklisted_features_; | 1076 preliminary_blacklisted_features_ = blacklisted_features_; |
1116 } | 1077 } |
1117 | 1078 |
1118 void GpuDataManagerImplPrivate::UpdateGpuSwitchingManager( | 1079 void GpuDataManagerImplPrivate::UpdateGpuSwitchingManager( |
1119 const gpu::GPUInfo& gpu_info) { | 1080 const gpu::GPUInfo& gpu_info) { |
1120 ui::GpuSwitchingManager::GetInstance()->SetGpuCount( | 1081 ui::GpuSwitchingManager::GetInstance()->SetGpuCount( |
1121 gpu_info.secondary_gpus.size() + 1); | 1082 gpu_info.secondary_gpus.size() + 1); |
1122 | 1083 |
1123 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { | 1084 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { |
1124 switch (gpu_switching_) { | 1085 if (gpu_driver_bugs_.count(gpu::FORCE_DISCRETE_GPU) == 1) |
1125 case gpu::GPU_SWITCHING_OPTION_FORCE_DISCRETE: | 1086 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); |
1126 ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu(); | 1087 else if (gpu_driver_bugs_.count(gpu::FORCE_INTEGRATED_GPU) == 1) |
1127 break; | 1088 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); |
1128 case gpu::GPU_SWITCHING_OPTION_FORCE_INTEGRATED: | |
1129 ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu(); | |
1130 break; | |
1131 case gpu::GPU_SWITCHING_OPTION_AUTOMATIC: | |
1132 case gpu::GPU_SWITCHING_OPTION_UNKNOWN: | |
1133 break; | |
1134 } | |
1135 } | 1089 } |
1136 } | 1090 } |
1137 | 1091 |
1138 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { | 1092 void GpuDataManagerImplPrivate::NotifyGpuInfoUpdate() { |
1139 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); | 1093 observer_list_->Notify(&GpuDataManagerObserver::OnGpuInfoUpdate); |
1140 } | 1094 } |
1141 | 1095 |
1142 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { | 1096 void GpuDataManagerImplPrivate::EnableSwiftShaderIfNecessary() { |
1143 if (!GpuAccessAllowed(NULL) || | 1097 if (!GpuAccessAllowed(NULL) || |
1144 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { | 1098 blacklisted_features_.count(gpu::GPU_FEATURE_TYPE_WEBGL)) { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 | 1210 |
1257 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { | 1211 void GpuDataManagerImplPrivate::OnGpuProcessInitFailure() { |
1258 gpu_process_accessible_ = false; | 1212 gpu_process_accessible_ = false; |
1259 gpu_info_.finalized = true; | 1213 gpu_info_.finalized = true; |
1260 complete_gpu_info_already_requested_ = true; | 1214 complete_gpu_info_already_requested_ = true; |
1261 // Some observers might be waiting. | 1215 // Some observers might be waiting. |
1262 NotifyGpuInfoUpdate(); | 1216 NotifyGpuInfoUpdate(); |
1263 } | 1217 } |
1264 | 1218 |
1265 } // namespace content | 1219 } // namespace content |
OLD | NEW |