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

Side by Side Diff: gpu/config/gpu_control_list.cc

Issue 194303002: Blacklist GLX indirect rendering (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « gpu/config/gpu_control_list.h ('k') | gpu/config/gpu_control_list_format.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gpu/config/gpu_control_list.h" 5 #include "gpu/config/gpu_control_list.h"
6 6
7 #include "base/cpu.h" 7 #include "base/cpu.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 return (value >= value_); 407 return (value >= value_);
408 DCHECK(op_ == kBetween); 408 DCHECK(op_ == kBetween);
409 return ((value_ <= value && value <= value2_) || 409 return ((value_ <= value && value <= value2_) ||
410 (value2_ <= value && value <= value_)); 410 (value2_ <= value && value <= value_));
411 } 411 }
412 412
413 bool GpuControlList::IntInfo::IsValid() const { 413 bool GpuControlList::IntInfo::IsValid() const {
414 return op_ != kUnknown; 414 return op_ != kUnknown;
415 } 415 }
416 416
417 GpuControlList::BoolInfo::BoolInfo(bool value) : value_(value) {}
418
419 bool GpuControlList::BoolInfo::Contains(bool value) const {
420 return value_ == value;
421 }
422
417 // static 423 // static
418 GpuControlList::ScopedGpuControlListEntry 424 GpuControlList::ScopedGpuControlListEntry
419 GpuControlList::GpuControlListEntry::GetEntryFromValue( 425 GpuControlList::GpuControlListEntry::GetEntryFromValue(
420 const base::DictionaryValue* value, bool top_level, 426 const base::DictionaryValue* value, bool top_level,
421 const FeatureMap& feature_map, 427 const FeatureMap& feature_map,
422 bool supports_feature_type_all) { 428 bool supports_feature_type_all) {
423 DCHECK(value); 429 DCHECK(value);
424 ScopedGpuControlListEntry entry(new GpuControlListEntry()); 430 ScopedGpuControlListEntry entry(new GpuControlListEntry());
425 431
426 size_t dictionary_entry_count = 0; 432 size_t dictionary_entry_count = 0;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 gpu_count_value->GetString(kOp, &op); 743 gpu_count_value->GetString(kOp, &op);
738 gpu_count_value->GetString("value", &int_value); 744 gpu_count_value->GetString("value", &int_value);
739 gpu_count_value->GetString("value2", &int_value2); 745 gpu_count_value->GetString("value2", &int_value2);
740 if (!entry->SetGpuCountInfo(op, int_value, int_value2)) { 746 if (!entry->SetGpuCountInfo(op, int_value, int_value2)) {
741 LOG(WARNING) << "Malformed gpu_count entry " << entry->id(); 747 LOG(WARNING) << "Malformed gpu_count entry " << entry->id();
742 return NULL; 748 return NULL;
743 } 749 }
744 dictionary_entry_count++; 750 dictionary_entry_count++;
745 } 751 }
746 752
753 bool direct_rendering;
754 if (value->GetBoolean("direct_rendering", &direct_rendering)) {
755 entry->SetDirectRenderingInfo(direct_rendering);
756 dictionary_entry_count++;
757 }
758
747 if (top_level) { 759 if (top_level) {
748 const base::ListValue* feature_value = NULL; 760 const base::ListValue* feature_value = NULL;
749 if (value->GetList("features", &feature_value)) { 761 if (value->GetList("features", &feature_value)) {
750 std::vector<std::string> feature_list; 762 std::vector<std::string> feature_list;
751 for (size_t i = 0; i < feature_value->GetSize(); ++i) { 763 for (size_t i = 0; i < feature_value->GetSize(); ++i) {
752 std::string feature; 764 std::string feature;
753 if (feature_value->GetString(i, &feature)) { 765 if (feature_value->GetString(i, &feature)) {
754 feature_list.push_back(feature); 766 feature_list.push_back(feature);
755 } else { 767 } else {
756 LOG(WARNING) << "Malformed feature entry " << entry->id(); 768 LOG(WARNING) << "Malformed feature entry " << entry->id();
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 } 975 }
964 976
965 bool GpuControlList::GpuControlListEntry::SetGpuCountInfo( 977 bool GpuControlList::GpuControlListEntry::SetGpuCountInfo(
966 const std::string& op, 978 const std::string& op,
967 const std::string& int_string, 979 const std::string& int_string,
968 const std::string& int_string2) { 980 const std::string& int_string2) {
969 gpu_count_info_.reset(new IntInfo(op, int_string, int_string2)); 981 gpu_count_info_.reset(new IntInfo(op, int_string, int_string2));
970 return gpu_count_info_->IsValid(); 982 return gpu_count_info_->IsValid();
971 } 983 }
972 984
985 void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) {
986 direct_rendering_info_.reset(new BoolInfo(value));
987 }
988
973 bool GpuControlList::GpuControlListEntry::SetFeatures( 989 bool GpuControlList::GpuControlListEntry::SetFeatures(
974 const std::vector<std::string>& feature_strings, 990 const std::vector<std::string>& feature_strings,
975 const FeatureMap& feature_map, 991 const FeatureMap& feature_map,
976 bool supports_feature_type_all) { 992 bool supports_feature_type_all) {
977 size_t size = feature_strings.size(); 993 size_t size = feature_strings.size();
978 if (size == 0) 994 if (size == 0)
979 return false; 995 return false;
980 features_.clear(); 996 features_.clear();
981 for (size_t i = 0; i < size; ++i) { 997 for (size_t i = 0; i < size; ++i) {
982 int feature = 0; 998 int feature = 0;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (machine_model_info_.get() != NULL) { 1128 if (machine_model_info_.get() != NULL) {
1113 std::vector<std::string> name_version; 1129 std::vector<std::string> name_version;
1114 base::SplitString(gpu_info.machine_model, ' ', &name_version); 1130 base::SplitString(gpu_info.machine_model, ' ', &name_version);
1115 if (name_version.size() == 2 && 1131 if (name_version.size() == 2 &&
1116 !machine_model_info_->Contains(name_version[0], name_version[1])) 1132 !machine_model_info_->Contains(name_version[0], name_version[1]))
1117 return false; 1133 return false;
1118 } 1134 }
1119 if (gpu_count_info_.get() != NULL && 1135 if (gpu_count_info_.get() != NULL &&
1120 !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) 1136 !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1))
1121 return false; 1137 return false;
1138 if (direct_rendering_info_.get() != NULL &&
1139 !direct_rendering_info_->Contains(gpu_info.direct_rendering))
1140 return false;
1122 if (cpu_brand_.get() != NULL) { 1141 if (cpu_brand_.get() != NULL) {
1123 base::CPU cpu_info; 1142 base::CPU cpu_info;
1124 if (!cpu_brand_->Contains(cpu_info.cpu_brand())) 1143 if (!cpu_brand_->Contains(cpu_info.cpu_brand()))
1125 return false; 1144 return false;
1126 } 1145 }
1127 1146
1128 for (size_t i = 0; i < exceptions_.size(); ++i) { 1147 for (size_t i = 0; i < exceptions_.size(); ++i) {
1129 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && 1148 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) &&
1130 !exceptions_[i]->NeedsMoreInfo(gpu_info)) 1149 !exceptions_[i]->NeedsMoreInfo(gpu_info))
1131 return false; 1150 return false;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 const std::string& feature_name, int feature_id) { 1426 const std::string& feature_name, int feature_id) {
1408 feature_map_[feature_name] = feature_id; 1427 feature_map_[feature_name] = feature_id;
1409 } 1428 }
1410 1429
1411 void GpuControlList::set_supports_feature_type_all(bool supported) { 1430 void GpuControlList::set_supports_feature_type_all(bool supported) {
1412 supports_feature_type_all_ = supported; 1431 supports_feature_type_all_ = supported;
1413 } 1432 }
1414 1433
1415 } // namespace gpu 1434 } // namespace gpu
1416 1435
OLDNEW
« no previous file with comments | « gpu/config/gpu_control_list.h ('k') | gpu/config/gpu_control_list_format.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698