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

Unified Diff: content/browser/gpu/gpu_data_manager_impl_private.cc

Issue 57633007: Merge gpu_switching_list into gpu_driver_bug_list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final final Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_data_manager_impl_private.cc
diff --git a/content/browser/gpu/gpu_data_manager_impl_private.cc b/content/browser/gpu/gpu_data_manager_impl_private.cc
index 315ba666c41b48a396ddf5e0a52d792261b8d534..8ce3104caa521368e8b67a5e7b86fecbd640121f 100644
--- a/content/browser/gpu/gpu_data_manager_impl_private.cc
+++ b/content/browser/gpu/gpu_data_manager_impl_private.cc
@@ -294,6 +294,21 @@ void ApplyAndroidWorkarounds(const gpu::GPUInfo& gpu_info,
}
#endif // OS_ANDROID
+// Overwrite force gpu workaround if a commandline switch exists.
+void AdjustGpuSwitchingOption(std::set<int>* workarounds) {
+ DCHECK(workarounds);
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ std::string option = command_line.GetSwitchValueASCII(
+ switches::kGpuSwitching);
+ if (option == switches::kGpuSwitchingOptionNameForceDiscrete) {
+ workarounds->erase(gpu::FORCE_INTEGRATED_GPU);
+ workarounds->insert(gpu::FORCE_DISCRETE_GPU);
+ } else if (option == switches::kGpuSwitchingOptionNameForceIntegrated) {
+ workarounds->erase(gpu::FORCE_DISCRETE_GPU);
+ workarounds->insert(gpu::FORCE_INTEGRATED_GPU);
+ }
+}
+
// Block all domains' use of 3D APIs for this many milliseconds if
// approaching a threshold where system stability might be compromised.
const int64 kBlockAllDomainsMs = 10000;
@@ -318,7 +333,7 @@ void GpuDataManagerImplPrivate::InitializeForTesting(
// Prevent all further initialization.
finalized_ = true;
- InitializeImpl(gpu_blacklist_json, std::string(), std::string(), gpu_info);
+ InitializeImpl(gpu_blacklist_json, std::string(), gpu_info);
}
bool GpuDataManagerImplPrivate::IsFeatureBlacklisted(int feature) const {
@@ -565,18 +580,15 @@ void GpuDataManagerImplPrivate::Initialize() {
#endif
std::string gpu_blacklist_string;
- std::string gpu_switching_list_string;
std::string gpu_driver_bug_list_string;
if (!command_line->HasSwitch(switches::kIgnoreGpuBlacklist) &&
!command_line->HasSwitch(switches::kUseGpuInTests)) {
gpu_blacklist_string = gpu::kSoftwareRenderingListJson;
- gpu_switching_list_string = gpu::kGpuSwitchingListJson;
}
if (!command_line->HasSwitch(switches::kDisableGpuDriverBugWorkarounds)) {
gpu_driver_bug_list_string = gpu::kGpuDriverBugListJson;
}
InitializeImpl(gpu_blacklist_string,
- gpu_switching_list_string,
gpu_driver_bug_list_string,
gpu_info);
}
@@ -600,22 +612,11 @@ void GpuDataManagerImplPrivate::UpdateGpuInfo(const gpu::GPUInfo& gpu_info) {
UpdateBlacklistedFeatures(features);
}
- if (gpu_switching_list_) {
- std::set<int> option = gpu_switching_list_->MakeDecision(
- gpu::GpuControlList::kOsAny, std::string(), gpu_info_);
- if (option.size() == 1) {
- // Blacklist decision should not overwrite commandline switch from users.
- CommandLine* command_line = CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(switches::kGpuSwitching)) {
- gpu_switching_ = static_cast<gpu::GpuSwitchingOption>(
- *(option.begin()));
- }
- }
- }
if (gpu_driver_bug_list_) {
gpu_driver_bugs_ = gpu_driver_bug_list_->MakeDecision(
gpu::GpuControlList::kOsAny, std::string(), gpu_info_);
}
+ AdjustGpuSwitchingOption(&gpu_driver_bugs_);
// We have to update GpuFeatureType before notify all the observers.
NotifyGpuInfoUpdate();
@@ -698,24 +699,10 @@ void GpuDataManagerImplPrivate::AppendGpuCommandLine(
} else if (!use_gl.empty()) {
command_line->AppendSwitchASCII(switches::kUseGL, use_gl);
}
- if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) {
+ if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "true");
- switch (gpu_switching_) {
- case gpu::GPU_SWITCHING_OPTION_FORCE_DISCRETE:
- command_line->AppendSwitchASCII(switches::kGpuSwitching,
- switches::kGpuSwitchingOptionNameForceDiscrete);
- break;
- case gpu::GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
- command_line->AppendSwitchASCII(switches::kGpuSwitching,
- switches::kGpuSwitchingOptionNameForceIntegrated);
- break;
- case gpu::GPU_SWITCHING_OPTION_AUTOMATIC:
- case gpu::GPU_SWITCHING_OPTION_UNKNOWN:
- break;
- }
- } else {
+ else
command_line->AppendSwitchASCII(switches::kSupportsDualGpus, "false");
- }
if (!swiftshader_path.empty()) {
command_line->AppendSwitchPath(switches::kSwiftShaderPath,
@@ -835,13 +822,6 @@ void GpuDataManagerImplPrivate::UpdateRendererWebPrefs(
#endif
}
-gpu::GpuSwitchingOption
-GpuDataManagerImplPrivate::GetGpuSwitchingOption() const {
- if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus())
- return gpu::GPU_SWITCHING_OPTION_UNKNOWN;
- return gpu_switching_;
-}
-
void GpuDataManagerImplPrivate::DisableHardwareAcceleration() {
card_blacklisted_ = true;
@@ -977,7 +957,6 @@ GpuDataManagerImplPrivate* GpuDataManagerImplPrivate::Create(
GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(
GpuDataManagerImpl* owner)
: complete_gpu_info_already_requested_(false),
- gpu_switching_(gpu::GPU_SWITCHING_OPTION_AUTOMATIC),
observer_list_(new GpuDataManagerObserverList),
use_swiftshader_(false),
card_blacklisted_(false),
@@ -1003,14 +982,6 @@ GpuDataManagerImplPrivate::GpuDataManagerImplPrivate(
#if defined(USE_AURA) && !defined(OS_CHROMEOS)
use_software_compositor_ = true;
#endif
- if (command_line->HasSwitch(switches::kGpuSwitching)) {
- std::string option_string = command_line->GetSwitchValueASCII(
- switches::kGpuSwitching);
- gpu::GpuSwitchingOption option =
- gpu::StringToGpuSwitchingOption(option_string);
- if (option != gpu::GPU_SWITCHING_OPTION_UNKNOWN)
- gpu_switching_ = option;
- }
#if defined(OS_MACOSX)
CGGetActiveDisplayList (0, NULL, &display_count_);
@@ -1031,7 +1002,6 @@ GpuDataManagerImplPrivate::~GpuDataManagerImplPrivate() {
void GpuDataManagerImplPrivate::InitializeImpl(
const std::string& gpu_blacklist_json,
- const std::string& gpu_switching_list_json,
const std::string& gpu_driver_bug_list_json,
const gpu::GPUInfo& gpu_info) {
std::string browser_version_string = ProcessVersionString(
@@ -1051,15 +1021,6 @@ void GpuDataManagerImplPrivate::InitializeImpl(
gpu::GpuControlList::kCurrentOsOnly);
DCHECK(success);
}
- if (!gpu_switching_list_json.empty()) {
- gpu_switching_list_.reset(gpu::GpuSwitchingList::Create());
- if (log_gpu_control_list_decisions)
- gpu_switching_list_->enable_control_list_logging("gpu_switching_list");
- bool success = gpu_switching_list_->LoadList(
- browser_version_string, gpu_switching_list_json,
- gpu::GpuControlList::kCurrentOsOnly);
- DCHECK(success);
- }
if (!gpu_driver_bug_list_json.empty()) {
gpu_driver_bug_list_.reset(gpu::GpuDriverBugList::Create());
if (log_gpu_control_list_decisions)
@@ -1121,17 +1082,10 @@ void GpuDataManagerImplPrivate::UpdateGpuSwitchingManager(
gpu_info.secondary_gpus.size() + 1);
if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) {
- switch (gpu_switching_) {
- case gpu::GPU_SWITCHING_OPTION_FORCE_DISCRETE:
- ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu();
- break;
- case gpu::GPU_SWITCHING_OPTION_FORCE_INTEGRATED:
- ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
- break;
- case gpu::GPU_SWITCHING_OPTION_AUTOMATIC:
- case gpu::GPU_SWITCHING_OPTION_UNKNOWN:
- break;
- }
+ if (gpu_driver_bugs_.count(gpu::FORCE_DISCRETE_GPU) == 1)
+ ui::GpuSwitchingManager::GetInstance()->ForceUseOfDiscreteGpu();
+ else if (gpu_driver_bugs_.count(gpu::FORCE_INTEGRATED_GPU) == 1)
+ ui::GpuSwitchingManager::GetInstance()->ForceUseOfIntegratedGpu();
}
}
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.h ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698