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

Unified Diff: chrome/browser/gpu_blacklist.cc

Issue 10832044: Enhance GPU blacklist so we can also blacklist GPUs other than the primary one. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gpu_blacklist.h ('k') | chrome/browser/gpu_blacklist_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gpu_blacklist.cc
===================================================================
--- chrome/browser/gpu_blacklist.cc (revision 148446)
+++ chrome/browser/gpu_blacklist.cc (working copy)
@@ -70,6 +70,10 @@
const char kMultiGpuStyleStringAMDSwitchable[] = "amd_switchable";
const char kMultiGpuStyleStringOptimus[] = "optimus";
+const char kMultiGpuCategoryStringPrimary[] = "primary";
+const char kMultiGpuCategoryStringSecondary[] = "secondary";
+const char kMultiGpuCategoryStringAny[] = "any";
+
const char kVersionStyleStringNumerical[] = "numerical";
const char kVersionStyleStringLexical[] = "lexical";
@@ -404,6 +408,15 @@
dictionary_entry_count++;
}
+ std::string multi_gpu_category;
+ if (value->GetString("multi_gpu_category", &multi_gpu_category)) {
+ if (!entry->SetMultiGpuCategory(multi_gpu_category)) {
+ LOG(WARNING) << "Malformed multi_gpu_category entry " << entry->id();
+ return NULL;
+ }
+ dictionary_entry_count++;
+ }
+
DictionaryValue* driver_vendor_value = NULL;
if (value->GetDictionary("driver_vendor", &driver_vendor_value)) {
std::string vendor_op;
@@ -590,6 +603,7 @@
disabled_(false),
vendor_id_(0),
multi_gpu_style_(kMultiGpuStyleNone),
+ multi_gpu_category_(kMultiGpuCategoryPrimary),
feature_type_(content::GPU_FEATURE_TYPE_UNKNOWN),
contains_unknown_fields_(false),
contains_unknown_features_(false) {
@@ -643,6 +657,16 @@
return true;
}
+bool GpuBlacklist::GpuBlacklistEntry::SetMultiGpuCategory(
+ const std::string& multi_gpu_category_string) {
+ MultiGpuCategory category =
+ StringToMultiGpuCategory(multi_gpu_category_string);
+ if (category == kMultiGpuCategoryNone)
+ return false;
+ multi_gpu_category_ = category;
+ return true;
+}
+
bool GpuBlacklist::GpuBlacklistEntry::SetDriverVendorInfo(
const std::string& vendor_op,
const std::string& vendor_value) {
@@ -758,21 +782,49 @@
return kMultiGpuStyleNone;
}
+// static
+GpuBlacklist::GpuBlacklistEntry::MultiGpuCategory
+GpuBlacklist::GpuBlacklistEntry::StringToMultiGpuCategory(
+ const std::string& category) {
+ if (category == kMultiGpuCategoryStringPrimary)
+ return kMultiGpuCategoryPrimary;
+ if (category == kMultiGpuCategoryStringSecondary)
+ return kMultiGpuCategorySecondary;
+ if (category == kMultiGpuCategoryStringAny)
+ return kMultiGpuCategoryAny;
+ return kMultiGpuCategoryNone;
+}
+
bool GpuBlacklist::GpuBlacklistEntry::Contains(
OsType os_type, const Version& os_version,
const content::GPUInfo& gpu_info) const {
DCHECK(os_type != kOsAny);
if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version))
return false;
- if (vendor_id_ != 0 && vendor_id_ != gpu_info.gpu.vendor_id)
+ if (vendor_id_ != 0 && vendor_id_ != gpu_info.gpu.vendor_id &&
+ multi_gpu_category_ == kMultiGpuCategoryPrimary)
Ken Russell (switch to Gerrit) 2012/07/27 01:32:52 This logic and that below is getting really diffic
return false;
if (device_id_list_.size() > 0) {
bool found = false;
for (size_t i = 0; i < device_id_list_.size(); ++i) {
- if (device_id_list_[i] == gpu_info.gpu.device_id) {
+ if ((multi_gpu_category_ == kMultiGpuCategoryPrimary ||
+ multi_gpu_category_ == kMultiGpuCategoryAny) &&
+ device_id_list_[i] == gpu_info.gpu.device_id) {
found = true;
break;
}
+ if (multi_gpu_category_ == kMultiGpuCategorySecondary ||
+ multi_gpu_category_ == kMultiGpuCategoryAny) {
+ for (size_t j = 0; j < gpu_info.secondary_gpus.size(); ++j) {
+ if (vendor_id_ == gpu_info.secondary_gpus[j].vendor_id &&
+ device_id_list_[i] == gpu_info.secondary_gpus[j].device_id) {
+ found = true;
+ break;
+ }
+ }
+ if (found)
+ break;
+ }
}
if (!found)
return false;
« no previous file with comments | « chrome/browser/gpu_blacklist.h ('k') | chrome/browser/gpu_blacklist_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698