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