| 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 "gpu/config/gpu_control_list.h" | 5 #include "gpu/config/gpu_control_list.h" |
| 6 | 6 |
| 7 #include <stddef.h> | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <utility> | |
| 11 | |
| 12 #include "base/cpu.h" | |
| 13 #include "base/json/json_reader.h" | |
| 14 #include "base/logging.h" | 7 #include "base/logging.h" |
| 15 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 19 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 20 #include "gpu/config/gpu_info.h" | 13 #include "gpu/config/gpu_info.h" |
| 21 #include "gpu/config/gpu_util.h" | |
| 22 #include "third_party/re2/src/re2/re2.h" | 14 #include "third_party/re2/src/re2/re2.h" |
| 23 | 15 |
| 24 namespace gpu { | 16 namespace gpu { |
| 25 namespace { | 17 namespace { |
| 26 | 18 |
| 27 // Break a version string into segments. Return true if each segment is | 19 // Break a version string into segments. Return true if each segment is |
| 28 // a valid number, and not all segment is 0. | 20 // a valid number, and not all segment is 0. |
| 29 bool ProcessVersionString(const std::string& version_string, | 21 bool ProcessVersionString(const std::string& version_string, |
| 30 char splitter, | 22 char splitter, |
| 31 std::vector<std::string>* version) { | 23 std::vector<std::string>* version) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return 0; | 89 return 0; |
| 98 } | 90 } |
| 99 | 91 |
| 100 // A mismatch is identified only if both |input| and |pattern| are not empty. | 92 // A mismatch is identified only if both |input| and |pattern| are not empty. |
| 101 bool StringMismatch(const std::string& input, const std::string& pattern) { | 93 bool StringMismatch(const std::string& input, const std::string& pattern) { |
| 102 if (input.empty() || pattern.empty()) | 94 if (input.empty() || pattern.empty()) |
| 103 return false; | 95 return false; |
| 104 return !RE2::FullMatch(input, pattern); | 96 return !RE2::FullMatch(input, pattern); |
| 105 } | 97 } |
| 106 | 98 |
| 107 const char kMultiGpuStyleStringAMDSwitchable[] = "amd_switchable"; | 99 bool StringMismatch(const std::string& input, const char* pattern) { |
| 108 const char kMultiGpuStyleStringAMDSwitchableDiscrete[] = | 100 if (!pattern) |
| 109 "amd_switchable_discrete"; | 101 return false; |
| 110 const char kMultiGpuStyleStringAMDSwitchableIntegrated[] = | 102 std::string pattern_string(pattern); |
| 111 "amd_switchable_integrated"; | 103 return StringMismatch(input, pattern_string); |
| 112 const char kMultiGpuStyleStringOptimus[] = "optimus"; | 104 } |
| 113 | |
| 114 const char kMultiGpuCategoryStringPrimary[] = "primary"; | |
| 115 const char kMultiGpuCategoryStringSecondary[] = "secondary"; | |
| 116 const char kMultiGpuCategoryStringActive[] = "active"; | |
| 117 const char kMultiGpuCategoryStringAny[] = "any"; | |
| 118 | |
| 119 const char kGLTypeStringGL[] = "gl"; | |
| 120 const char kGLTypeStringGLES[] = "gles"; | |
| 121 const char kGLTypeStringANGLE[] = "angle"; | |
| 122 | |
| 123 const char kVersionStyleStringNumerical[] = "numerical"; | |
| 124 const char kVersionStyleStringLexical[] = "lexical"; | |
| 125 | |
| 126 const char kOp[] = "op"; | |
| 127 | 105 |
| 128 } // namespace | 106 } // namespace |
| 129 | 107 |
| 130 GpuControlList::VersionInfo::VersionInfo( | 108 bool GpuControlList::Version::Contains(const std::string& version_string, |
| 131 const std::string& version_op, | 109 char splitter) const { |
| 132 const std::string& version_style, | 110 if (op == kUnknown) |
| 133 const std::string& version_string, | |
| 134 const std::string& version_string2) | |
| 135 : version_style_(kVersionStyleNumerical) { | |
| 136 op_ = StringToNumericOp(version_op); | |
| 137 if (op_ == kUnknown || op_ == kAny) | |
| 138 return; | |
| 139 version_style_ = StringToVersionStyle(version_style); | |
| 140 if (!ProcessVersionString(version_string, '.', &version_)) { | |
| 141 op_ = kUnknown; | |
| 142 return; | |
| 143 } | |
| 144 if (op_ == kBetween) { | |
| 145 if (!ProcessVersionString(version_string2, '.', &version2_)) | |
| 146 op_ = kUnknown; | |
| 147 } | |
| 148 } | |
| 149 | |
| 150 GpuControlList::VersionInfo::~VersionInfo() { | |
| 151 } | |
| 152 | |
| 153 bool GpuControlList::VersionInfo::Contains( | |
| 154 const std::string& version_string) const { | |
| 155 return Contains(version_string, '.'); | |
| 156 } | |
| 157 | |
| 158 bool GpuControlList::VersionInfo::Contains( | |
| 159 const std::string& version_string, char splitter) const { | |
| 160 if (op_ == kUnknown) | |
| 161 return false; | 111 return false; |
| 162 if (op_ == kAny) | 112 if (op == kAny) |
| 163 return true; | 113 return true; |
| 164 std::vector<std::string> version; | 114 std::vector<std::string> version; |
| 165 if (!ProcessVersionString(version_string, splitter, &version)) | 115 if (!ProcessVersionString(version_string, splitter, &version)) |
| 166 return false; | 116 return false; |
| 167 int relation = Compare(version, version_, version_style_); | 117 std::vector<std::string> ref_version; |
| 168 if (op_ == kEQ) | 118 bool valid = ProcessVersionString(value1, '.', &ref_version); |
| 169 return (relation == 0); | 119 DCHECK(valid); |
| 170 else if (op_ == kLT) | 120 int relation = Version::Compare(version, ref_version, style); |
| 171 return (relation < 0); | 121 switch (op) { |
| 172 else if (op_ == kLE) | 122 case kEQ: |
| 173 return (relation <= 0); | 123 return (relation == 0); |
| 174 else if (op_ == kGT) | 124 case kLT: |
| 175 return (relation > 0); | 125 return (relation < 0); |
| 176 else if (op_ == kGE) | 126 case kLE: |
| 177 return (relation >= 0); | 127 return (relation <= 0); |
| 178 // op_ == kBetween | 128 case kGT: |
| 129 return (relation > 0); |
| 130 case kGE: |
| 131 return (relation >= 0); |
| 132 default: |
| 133 break; |
| 134 } |
| 135 DCHECK_EQ(kBetween, op); |
| 179 if (relation < 0) | 136 if (relation < 0) |
| 180 return false; | 137 return false; |
| 181 return Compare(version, version2_, version_style_) <= 0; | 138 ref_version.clear(); |
| 182 } | 139 valid = ProcessVersionString(value2, '.', &ref_version); |
| 183 | 140 DCHECK(valid); |
| 184 bool GpuControlList::VersionInfo::IsValid() const { | 141 return Compare(version, ref_version, style) <= 0; |
| 185 return (op_ != kUnknown && version_style_ != kVersionStyleUnknown); | |
| 186 } | |
| 187 | |
| 188 bool GpuControlList::VersionInfo::IsLexical() const { | |
| 189 return version_style_ == kVersionStyleLexical; | |
| 190 } | 142 } |
| 191 | 143 |
| 192 // static | 144 // static |
| 193 int GpuControlList::VersionInfo::Compare( | 145 int GpuControlList::Version::Compare( |
| 194 const std::vector<std::string>& version, | 146 const std::vector<std::string>& version, |
| 195 const std::vector<std::string>& version_ref, | 147 const std::vector<std::string>& version_ref, |
| 196 VersionStyle version_style) { | 148 VersionStyle version_style) { |
| 197 DCHECK(version.size() > 0 && version_ref.size() > 0); | 149 DCHECK(version.size() > 0 && version_ref.size() > 0); |
| 198 DCHECK(version_style != kVersionStyleUnknown); | 150 DCHECK(version_style != kVersionStyleUnknown); |
| 199 for (size_t i = 0; i < version_ref.size(); ++i) { | 151 for (size_t i = 0; i < version_ref.size(); ++i) { |
| 200 if (i >= version.size()) | 152 if (i >= version.size()) |
| 201 return 0; | 153 return 0; |
| 202 int ret = 0; | 154 int ret = 0; |
| 203 // We assume both versions are checked by ProcessVersionString(). | 155 // We assume both versions are checked by ProcessVersionString(). |
| 204 if (i > 0 && version_style == kVersionStyleLexical) | 156 if (i > 0 && version_style == kVersionStyleLexical) |
| 205 ret = CompareLexicalNumberStrings(version[i], version_ref[i]); | 157 ret = CompareLexicalNumberStrings(version[i], version_ref[i]); |
| 206 else | 158 else |
| 207 ret = CompareNumericalNumberStrings(version[i], version_ref[i]); | 159 ret = CompareNumericalNumberStrings(version[i], version_ref[i]); |
| 208 if (ret != 0) | 160 if (ret != 0) |
| 209 return ret; | 161 return ret; |
| 210 } | 162 } |
| 211 return 0; | 163 return 0; |
| 212 } | 164 } |
| 213 | 165 |
| 214 // static | 166 bool GpuControlList::More::GLVersionInfoMismatch( |
| 215 GpuControlList::VersionInfo::VersionStyle | 167 const std::string& gl_version_string) const { |
| 216 GpuControlList::VersionInfo::StringToVersionStyle( | 168 if (gl_version_string.empty()) |
| 217 const std::string& version_style) { | 169 return false; |
| 218 if (version_style.empty() || version_style == kVersionStyleStringNumerical) | 170 if (!gl_version.IsSpecified() && gl_type == kGLTypeNone) |
| 219 return kVersionStyleNumerical; | 171 return false; |
| 220 if (version_style == kVersionStyleStringLexical) | 172 std::vector<std::string> segments = base::SplitString( |
| 221 return kVersionStyleLexical; | 173 gl_version_string, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 222 return kVersionStyleUnknown; | 174 std::string number; |
| 223 } | 175 GLType target_gl_type = kGLTypeNone; |
| 176 if (segments.size() > 2 && |
| 177 segments[0] == "OpenGL" && segments[1] == "ES") { |
| 178 bool full_match = RE2::FullMatch(segments[2], "([\\d.]+).*", &number); |
| 179 DCHECK(full_match); |
| 224 | 180 |
| 225 GpuControlList::OsInfo::OsInfo(const std::string& os, | 181 target_gl_type = kGLTypeGLES; |
| 226 const std::string& version_op, | 182 if (segments.size() > 3 && |
| 227 const std::string& version_string, | 183 base::StartsWith(segments[3], "(ANGLE", |
| 228 const std::string& version_string2) { | 184 base::CompareCase::INSENSITIVE_ASCII)) { |
| 229 type_ = StringToOsType(os); | 185 target_gl_type = kGLTypeANGLE; |
| 230 if (type_ != kOsUnknown) { | |
| 231 version_info_.reset(new VersionInfo( | |
| 232 version_op, std::string(), version_string, version_string2)); | |
| 233 } | |
| 234 } | |
| 235 | |
| 236 GpuControlList::OsInfo::~OsInfo() {} | |
| 237 | |
| 238 bool GpuControlList::OsInfo::Contains( | |
| 239 OsType type, const std::string& version) const { | |
| 240 if (!IsValid()) | |
| 241 return false; | |
| 242 if (type_ != type && type_ != kOsAny) | |
| 243 return false; | |
| 244 std::string processed_version; | |
| 245 size_t pos = version.find_first_not_of("0123456789."); | |
| 246 if (pos != std::string::npos) | |
| 247 processed_version = version.substr(0, pos); | |
| 248 else | |
| 249 processed_version = version; | |
| 250 | |
| 251 return version_info_->Contains(processed_version); | |
| 252 } | |
| 253 | |
| 254 bool GpuControlList::OsInfo::IsValid() const { | |
| 255 return type_ != kOsUnknown && version_info_->IsValid(); | |
| 256 } | |
| 257 | |
| 258 GpuControlList::OsType GpuControlList::OsInfo::type() const { | |
| 259 return type_; | |
| 260 } | |
| 261 | |
| 262 GpuControlList::OsType GpuControlList::OsInfo::StringToOsType( | |
| 263 const std::string& os) { | |
| 264 if (os == "win") | |
| 265 return kOsWin; | |
| 266 else if (os == "macosx") | |
| 267 return kOsMacosx; | |
| 268 else if (os == "android") | |
| 269 return kOsAndroid; | |
| 270 else if (os == "linux") | |
| 271 return kOsLinux; | |
| 272 else if (os == "chromeos") | |
| 273 return kOsChromeOS; | |
| 274 else if (os == "any") | |
| 275 return kOsAny; | |
| 276 return kOsUnknown; | |
| 277 } | |
| 278 | |
| 279 GpuControlList::FloatInfo::FloatInfo(const std::string& float_op, | |
| 280 const std::string& float_value, | |
| 281 const std::string& float_value2) | |
| 282 : op_(kUnknown), | |
| 283 value_(0.f), | |
| 284 value2_(0.f) { | |
| 285 op_ = StringToNumericOp(float_op); | |
| 286 if (op_ == kAny) | |
| 287 return; | |
| 288 double dvalue = 0; | |
| 289 if (!base::StringToDouble(float_value, &dvalue)) { | |
| 290 op_ = kUnknown; | |
| 291 return; | |
| 292 } | |
| 293 value_ = static_cast<float>(dvalue); | |
| 294 if (op_ == kBetween) { | |
| 295 if (!base::StringToDouble(float_value2, &dvalue)) { | |
| 296 op_ = kUnknown; | |
| 297 return; | |
| 298 } | 186 } |
| 299 value2_ = static_cast<float>(dvalue); | 187 } else { |
| 300 } | 188 number = segments[0]; |
| 301 } | 189 target_gl_type = kGLTypeGL; |
| 302 | |
| 303 bool GpuControlList::FloatInfo::Contains(float value) const { | |
| 304 if (op_ == kUnknown) | |
| 305 return false; | |
| 306 if (op_ == kAny) | |
| 307 return true; | |
| 308 if (op_ == kEQ) | |
| 309 return (value == value_); | |
| 310 if (op_ == kLT) | |
| 311 return (value < value_); | |
| 312 if (op_ == kLE) | |
| 313 return (value <= value_); | |
| 314 if (op_ == kGT) | |
| 315 return (value > value_); | |
| 316 if (op_ == kGE) | |
| 317 return (value >= value_); | |
| 318 DCHECK(op_ == kBetween); | |
| 319 return ((value_ <= value && value <= value2_) || | |
| 320 (value2_ <= value && value <= value_)); | |
| 321 } | |
| 322 | |
| 323 bool GpuControlList::FloatInfo::IsValid() const { | |
| 324 return op_ != kUnknown; | |
| 325 } | |
| 326 | |
| 327 GpuControlList::IntInfo::IntInfo(const std::string& int_op, | |
| 328 const std::string& int_value, | |
| 329 const std::string& int_value2) | |
| 330 : op_(kUnknown), | |
| 331 value_(0), | |
| 332 value2_(0) { | |
| 333 op_ = StringToNumericOp(int_op); | |
| 334 if (op_ == kAny) | |
| 335 return; | |
| 336 if (!base::StringToInt(int_value, &value_)) { | |
| 337 op_ = kUnknown; | |
| 338 return; | |
| 339 } | |
| 340 if (op_ == kBetween && | |
| 341 !base::StringToInt(int_value2, &value2_)) | |
| 342 op_ = kUnknown; | |
| 343 } | |
| 344 | |
| 345 bool GpuControlList::IntInfo::Contains(int value) const { | |
| 346 if (op_ == kUnknown) | |
| 347 return false; | |
| 348 if (op_ == kAny) | |
| 349 return true; | |
| 350 if (op_ == kEQ) | |
| 351 return (value == value_); | |
| 352 if (op_ == kLT) | |
| 353 return (value < value_); | |
| 354 if (op_ == kLE) | |
| 355 return (value <= value_); | |
| 356 if (op_ == kGT) | |
| 357 return (value > value_); | |
| 358 if (op_ == kGE) | |
| 359 return (value >= value_); | |
| 360 DCHECK(op_ == kBetween); | |
| 361 return ((value_ <= value && value <= value2_) || | |
| 362 (value2_ <= value && value <= value_)); | |
| 363 } | |
| 364 | |
| 365 bool GpuControlList::IntInfo::IsValid() const { | |
| 366 return op_ != kUnknown; | |
| 367 } | |
| 368 | |
| 369 GpuControlList::BoolInfo::BoolInfo(bool value) : value_(value) {} | |
| 370 | |
| 371 bool GpuControlList::BoolInfo::Contains(bool value) const { | |
| 372 return value_ == value; | |
| 373 } | |
| 374 | |
| 375 // static | |
| 376 GpuControlList::ScopedGpuControlListEntry | |
| 377 GpuControlList::GpuControlListEntry::GetEntryFromValue( | |
| 378 const base::DictionaryValue* value, bool top_level, | |
| 379 const FeatureMap& feature_map, | |
| 380 bool supports_feature_type_all) { | |
| 381 DCHECK(value); | |
| 382 ScopedGpuControlListEntry entry(new GpuControlListEntry()); | |
| 383 | |
| 384 size_t dictionary_entry_count = 0; | |
| 385 | |
| 386 if (top_level) { | |
| 387 uint32_t id; | |
| 388 if (!value->GetInteger("id", reinterpret_cast<int*>(&id)) || | |
| 389 !entry->SetId(id)) { | |
| 390 LOG(WARNING) << "Malformed id entry " << entry->id(); | |
| 391 return NULL; | |
| 392 } | |
| 393 dictionary_entry_count++; | |
| 394 | |
| 395 bool disabled; | |
| 396 if (value->GetBoolean("disabled", &disabled)) { | |
| 397 entry->SetDisabled(disabled); | |
| 398 dictionary_entry_count++; | |
| 399 } | |
| 400 } | 190 } |
| 401 | 191 |
| 402 std::string description; | 192 GLType entry_gl_type = gl_type; |
| 403 if (value->GetString("description", &description)) { | 193 if (entry_gl_type == kGLTypeNone && gl_version.IsSpecified()) { |
| 404 entry->description_ = description; | 194 entry_gl_type = GetDefaultGLType(); |
| 405 dictionary_entry_count++; | |
| 406 } else { | |
| 407 entry->description_ = "The GPU is unavailable for an unexplained reason."; | |
| 408 } | 195 } |
| 409 | 196 if (entry_gl_type != kGLTypeNone && entry_gl_type != target_gl_type) { |
| 410 const base::ListValue* cr_bugs; | 197 return true; |
| 411 if (value->GetList("cr_bugs", &cr_bugs)) { | |
| 412 for (size_t i = 0; i < cr_bugs->GetSize(); ++i) { | |
| 413 int bug_id; | |
| 414 if (cr_bugs->GetInteger(i, &bug_id)) { | |
| 415 entry->cr_bugs_.push_back(bug_id); | |
| 416 } else { | |
| 417 LOG(WARNING) << "Malformed cr_bugs entry " << entry->id(); | |
| 418 return NULL; | |
| 419 } | |
| 420 } | |
| 421 dictionary_entry_count++; | |
| 422 } | 198 } |
| 423 | 199 if (gl_version.IsSpecified() && !gl_version.Contains(number)) { |
| 424 const base::ListValue* webkit_bugs; | |
| 425 if (value->GetList("webkit_bugs", &webkit_bugs)) { | |
| 426 for (size_t i = 0; i < webkit_bugs->GetSize(); ++i) { | |
| 427 int bug_id; | |
| 428 if (webkit_bugs->GetInteger(i, &bug_id)) { | |
| 429 entry->webkit_bugs_.push_back(bug_id); | |
| 430 } else { | |
| 431 LOG(WARNING) << "Malformed webkit_bugs entry " << entry->id(); | |
| 432 return NULL; | |
| 433 } | |
| 434 } | |
| 435 dictionary_entry_count++; | |
| 436 } | |
| 437 | |
| 438 const base::ListValue* disabled_extensions; | |
| 439 if (value->GetList("disabled_extensions", &disabled_extensions)) { | |
| 440 for (size_t i = 0; i < disabled_extensions->GetSize(); ++i) { | |
| 441 std::string disabled_extension; | |
| 442 if (disabled_extensions->GetString(i, &disabled_extension)) { | |
| 443 entry->disabled_extensions_.push_back(disabled_extension); | |
| 444 } else { | |
| 445 LOG(WARNING) << "Malformed disabled_extensions entry " << entry->id(); | |
| 446 return NULL; | |
| 447 } | |
| 448 } | |
| 449 dictionary_entry_count++; | |
| 450 } | |
| 451 | |
| 452 const base::DictionaryValue* os_value = NULL; | |
| 453 if (value->GetDictionary("os", &os_value)) { | |
| 454 std::string os_type; | |
| 455 std::string os_version_op = "any"; | |
| 456 std::string os_version_string; | |
| 457 std::string os_version_string2; | |
| 458 os_value->GetString("type", &os_type); | |
| 459 const base::DictionaryValue* os_version_value = NULL; | |
| 460 if (os_value->GetDictionary("version", &os_version_value)) { | |
| 461 os_version_value->GetString(kOp, &os_version_op); | |
| 462 os_version_value->GetString("value", &os_version_string); | |
| 463 os_version_value->GetString("value2", &os_version_string2); | |
| 464 } | |
| 465 if (!entry->SetOsInfo(os_type, os_version_op, os_version_string, | |
| 466 os_version_string2)) { | |
| 467 LOG(WARNING) << "Malformed os entry " << entry->id(); | |
| 468 return NULL; | |
| 469 } | |
| 470 dictionary_entry_count++; | |
| 471 } | |
| 472 | |
| 473 std::string vendor_id; | |
| 474 if (value->GetString("vendor_id", &vendor_id)) { | |
| 475 if (!entry->SetVendorId(vendor_id)) { | |
| 476 LOG(WARNING) << "Malformed vendor_id entry " << entry->id(); | |
| 477 return NULL; | |
| 478 } | |
| 479 dictionary_entry_count++; | |
| 480 } | |
| 481 | |
| 482 const base::ListValue* device_id_list; | |
| 483 if (value->GetList("device_id", &device_id_list)) { | |
| 484 for (size_t i = 0; i < device_id_list->GetSize(); ++i) { | |
| 485 std::string device_id; | |
| 486 if (!device_id_list->GetString(i, &device_id) || | |
| 487 !entry->AddDeviceId(device_id)) { | |
| 488 LOG(WARNING) << "Malformed device_id entry " << entry->id(); | |
| 489 return NULL; | |
| 490 } | |
| 491 } | |
| 492 dictionary_entry_count++; | |
| 493 } | |
| 494 | |
| 495 std::string multi_gpu_style; | |
| 496 if (value->GetString("multi_gpu_style", &multi_gpu_style)) { | |
| 497 if (!entry->SetMultiGpuStyle(multi_gpu_style)) { | |
| 498 LOG(WARNING) << "Malformed multi_gpu_style entry " << entry->id(); | |
| 499 return NULL; | |
| 500 } | |
| 501 dictionary_entry_count++; | |
| 502 } | |
| 503 | |
| 504 std::string multi_gpu_category; | |
| 505 if (value->GetString("multi_gpu_category", &multi_gpu_category)) { | |
| 506 if (!entry->SetMultiGpuCategory(multi_gpu_category)) { | |
| 507 LOG(WARNING) << "Malformed multi_gpu_category entry " << entry->id(); | |
| 508 return NULL; | |
| 509 } | |
| 510 dictionary_entry_count++; | |
| 511 } | |
| 512 | |
| 513 std::string driver_vendor_value; | |
| 514 if (value->GetString("driver_vendor", &driver_vendor_value)) { | |
| 515 if (!entry->SetDriverVendorInfo(driver_vendor_value)) { | |
| 516 LOG(WARNING) << "Malformed driver_vendor entry " << entry->id(); | |
| 517 return NULL; | |
| 518 } | |
| 519 dictionary_entry_count++; | |
| 520 } | |
| 521 | |
| 522 const base::DictionaryValue* driver_version_value = NULL; | |
| 523 if (value->GetDictionary("driver_version", &driver_version_value)) { | |
| 524 std::string driver_version_op = "any"; | |
| 525 std::string driver_version_style; | |
| 526 std::string driver_version_string; | |
| 527 std::string driver_version_string2; | |
| 528 driver_version_value->GetString(kOp, &driver_version_op); | |
| 529 driver_version_value->GetString("style", &driver_version_style); | |
| 530 driver_version_value->GetString("value", &driver_version_string); | |
| 531 driver_version_value->GetString("value2", &driver_version_string2); | |
| 532 if (!entry->SetDriverVersionInfo(driver_version_op, | |
| 533 driver_version_style, | |
| 534 driver_version_string, | |
| 535 driver_version_string2)) { | |
| 536 LOG(WARNING) << "Malformed driver_version entry " << entry->id(); | |
| 537 return NULL; | |
| 538 } | |
| 539 dictionary_entry_count++; | |
| 540 } | |
| 541 | |
| 542 const base::DictionaryValue* driver_date_value = NULL; | |
| 543 if (value->GetDictionary("driver_date", &driver_date_value)) { | |
| 544 std::string driver_date_op = "any"; | |
| 545 std::string driver_date_string; | |
| 546 std::string driver_date_string2; | |
| 547 driver_date_value->GetString(kOp, &driver_date_op); | |
| 548 driver_date_value->GetString("value", &driver_date_string); | |
| 549 driver_date_value->GetString("value2", &driver_date_string2); | |
| 550 if (!entry->SetDriverDateInfo(driver_date_op, driver_date_string, | |
| 551 driver_date_string2)) { | |
| 552 LOG(WARNING) << "Malformed driver_date entry " << entry->id(); | |
| 553 return NULL; | |
| 554 } | |
| 555 dictionary_entry_count++; | |
| 556 } | |
| 557 | |
| 558 std::string gl_type; | |
| 559 if (value->GetString("gl_type", &gl_type)) { | |
| 560 if (!entry->SetGLType(gl_type)) { | |
| 561 LOG(WARNING) << "Malformed gl_type entry " << entry->id(); | |
| 562 return NULL; | |
| 563 } | |
| 564 dictionary_entry_count++; | |
| 565 } | |
| 566 | |
| 567 const base::DictionaryValue* gl_version_value = NULL; | |
| 568 if (value->GetDictionary("gl_version", &gl_version_value)) { | |
| 569 std::string version_op = "any"; | |
| 570 std::string version_string; | |
| 571 std::string version_string2; | |
| 572 gl_version_value->GetString(kOp, &version_op); | |
| 573 gl_version_value->GetString("value", &version_string); | |
| 574 gl_version_value->GetString("value2", &version_string2); | |
| 575 if (!entry->SetGLVersionInfo( | |
| 576 version_op, version_string, version_string2)) { | |
| 577 LOG(WARNING) << "Malformed gl_version entry " << entry->id(); | |
| 578 return NULL; | |
| 579 } | |
| 580 dictionary_entry_count++; | |
| 581 } | |
| 582 | |
| 583 std::string gl_version_string_value; | |
| 584 if (value->GetString("gl_version_string", &gl_version_string_value)) { | |
| 585 if (!entry->SetGLVersionStringInfo(gl_version_string_value)) { | |
| 586 LOG(WARNING) << "Malformed gl_version_string entry " << entry->id(); | |
| 587 return NULL; | |
| 588 } | |
| 589 dictionary_entry_count++; | |
| 590 } | |
| 591 | |
| 592 std::string gl_vendor_value; | |
| 593 if (value->GetString("gl_vendor", &gl_vendor_value)) { | |
| 594 if (!entry->SetGLVendorInfo(gl_vendor_value)) { | |
| 595 LOG(WARNING) << "Malformed gl_vendor entry " << entry->id(); | |
| 596 return NULL; | |
| 597 } | |
| 598 dictionary_entry_count++; | |
| 599 } | |
| 600 | |
| 601 std::string gl_renderer_value; | |
| 602 if (value->GetString("gl_renderer", &gl_renderer_value)) { | |
| 603 if (!entry->SetGLRendererInfo(gl_renderer_value)) { | |
| 604 LOG(WARNING) << "Malformed gl_renderer entry " << entry->id(); | |
| 605 return NULL; | |
| 606 } | |
| 607 dictionary_entry_count++; | |
| 608 } | |
| 609 | |
| 610 std::string gl_extensions_value; | |
| 611 if (value->GetString("gl_extensions", &gl_extensions_value)) { | |
| 612 if (!entry->SetGLExtensionsInfo(gl_extensions_value)) { | |
| 613 LOG(WARNING) << "Malformed gl_extensions entry " << entry->id(); | |
| 614 return NULL; | |
| 615 } | |
| 616 dictionary_entry_count++; | |
| 617 } | |
| 618 | |
| 619 const base::DictionaryValue* gl_reset_notification_strategy_value = NULL; | |
| 620 if (value->GetDictionary("gl_reset_notification_strategy", | |
| 621 &gl_reset_notification_strategy_value)) { | |
| 622 std::string op; | |
| 623 std::string int_value; | |
| 624 std::string int_value2; | |
| 625 gl_reset_notification_strategy_value->GetString(kOp, &op); | |
| 626 gl_reset_notification_strategy_value->GetString("value", &int_value); | |
| 627 gl_reset_notification_strategy_value->GetString("value2", &int_value2); | |
| 628 if (!entry->SetGLResetNotificationStrategyInfo( | |
| 629 op, int_value, int_value2)) { | |
| 630 LOG(WARNING) << "Malformed gl_reset_notification_strategy entry " | |
| 631 << entry->id(); | |
| 632 return NULL; | |
| 633 } | |
| 634 dictionary_entry_count++; | |
| 635 } | |
| 636 | |
| 637 std::string cpu_brand_value; | |
| 638 if (value->GetString("cpu_info", &cpu_brand_value)) { | |
| 639 if (!entry->SetCpuBrand(cpu_brand_value)) { | |
| 640 LOG(WARNING) << "Malformed cpu_brand entry " << entry->id(); | |
| 641 return NULL; | |
| 642 } | |
| 643 dictionary_entry_count++; | |
| 644 } | |
| 645 | |
| 646 const base::DictionaryValue* perf_graphics_value = NULL; | |
| 647 if (value->GetDictionary("perf_graphics", &perf_graphics_value)) { | |
| 648 std::string op; | |
| 649 std::string float_value; | |
| 650 std::string float_value2; | |
| 651 perf_graphics_value->GetString(kOp, &op); | |
| 652 perf_graphics_value->GetString("value", &float_value); | |
| 653 perf_graphics_value->GetString("value2", &float_value2); | |
| 654 if (!entry->SetPerfGraphicsInfo(op, float_value, float_value2)) { | |
| 655 LOG(WARNING) << "Malformed perf_graphics entry " << entry->id(); | |
| 656 return NULL; | |
| 657 } | |
| 658 dictionary_entry_count++; | |
| 659 } | |
| 660 | |
| 661 const base::DictionaryValue* perf_gaming_value = NULL; | |
| 662 if (value->GetDictionary("perf_gaming", &perf_gaming_value)) { | |
| 663 std::string op; | |
| 664 std::string float_value; | |
| 665 std::string float_value2; | |
| 666 perf_gaming_value->GetString(kOp, &op); | |
| 667 perf_gaming_value->GetString("value", &float_value); | |
| 668 perf_gaming_value->GetString("value2", &float_value2); | |
| 669 if (!entry->SetPerfGamingInfo(op, float_value, float_value2)) { | |
| 670 LOG(WARNING) << "Malformed perf_gaming entry " << entry->id(); | |
| 671 return NULL; | |
| 672 } | |
| 673 dictionary_entry_count++; | |
| 674 } | |
| 675 | |
| 676 const base::DictionaryValue* perf_overall_value = NULL; | |
| 677 if (value->GetDictionary("perf_overall", &perf_overall_value)) { | |
| 678 std::string op; | |
| 679 std::string float_value; | |
| 680 std::string float_value2; | |
| 681 perf_overall_value->GetString(kOp, &op); | |
| 682 perf_overall_value->GetString("value", &float_value); | |
| 683 perf_overall_value->GetString("value2", &float_value2); | |
| 684 if (!entry->SetPerfOverallInfo(op, float_value, float_value2)) { | |
| 685 LOG(WARNING) << "Malformed perf_overall entry " << entry->id(); | |
| 686 return NULL; | |
| 687 } | |
| 688 dictionary_entry_count++; | |
| 689 } | |
| 690 | |
| 691 const base::ListValue* machine_model_name_list; | |
| 692 if (value->GetList("machine_model_name", &machine_model_name_list)) { | |
| 693 for (size_t i = 0; i < machine_model_name_list->GetSize(); ++i) { | |
| 694 std::string model_name; | |
| 695 if (!machine_model_name_list->GetString(i, &model_name) || | |
| 696 !entry->AddMachineModelName(model_name)) { | |
| 697 LOG(WARNING) << "Malformed machine_model_name entry " << entry->id(); | |
| 698 return NULL; | |
| 699 } | |
| 700 } | |
| 701 dictionary_entry_count++; | |
| 702 } | |
| 703 | |
| 704 const base::DictionaryValue* machine_model_version_value = NULL; | |
| 705 if (value->GetDictionary( | |
| 706 "machine_model_version", &machine_model_version_value)) { | |
| 707 std::string version_op = "any"; | |
| 708 std::string version_string; | |
| 709 std::string version_string2; | |
| 710 machine_model_version_value->GetString(kOp, &version_op); | |
| 711 machine_model_version_value->GetString("value", &version_string); | |
| 712 machine_model_version_value->GetString("value2", &version_string2); | |
| 713 if (!entry->SetMachineModelVersionInfo( | |
| 714 version_op, version_string, version_string2)) { | |
| 715 LOG(WARNING) << "Malformed machine_model_version entry " << entry->id(); | |
| 716 return NULL; | |
| 717 } | |
| 718 dictionary_entry_count++; | |
| 719 } | |
| 720 | |
| 721 const base::DictionaryValue* gpu_count_value = NULL; | |
| 722 if (value->GetDictionary("gpu_count", &gpu_count_value)) { | |
| 723 std::string op; | |
| 724 std::string int_value; | |
| 725 std::string int_value2; | |
| 726 gpu_count_value->GetString(kOp, &op); | |
| 727 gpu_count_value->GetString("value", &int_value); | |
| 728 gpu_count_value->GetString("value2", &int_value2); | |
| 729 if (!entry->SetGpuCountInfo(op, int_value, int_value2)) { | |
| 730 LOG(WARNING) << "Malformed gpu_count entry " << entry->id(); | |
| 731 return NULL; | |
| 732 } | |
| 733 dictionary_entry_count++; | |
| 734 } | |
| 735 | |
| 736 bool direct_rendering; | |
| 737 if (value->GetBoolean("direct_rendering", &direct_rendering)) { | |
| 738 entry->SetDirectRenderingInfo(direct_rendering); | |
| 739 dictionary_entry_count++; | |
| 740 } | |
| 741 | |
| 742 bool in_process_gpu; | |
| 743 if (value->GetBoolean("in_process_gpu", &in_process_gpu)) { | |
| 744 entry->SetInProcessGPUInfo(in_process_gpu); | |
| 745 dictionary_entry_count++; | |
| 746 } | |
| 747 | |
| 748 const base::DictionaryValue* pixel_shader_version_value = NULL; | |
| 749 if (value->GetDictionary("pixel_shader_version", | |
| 750 &pixel_shader_version_value)) { | |
| 751 std::string pixel_shader_version_op = "any"; | |
| 752 std::string pixel_shader_version_string; | |
| 753 std::string pixel_shader_version_string2; | |
| 754 pixel_shader_version_value->GetString(kOp, &pixel_shader_version_op); | |
| 755 pixel_shader_version_value->GetString("value", | |
| 756 &pixel_shader_version_string); | |
| 757 pixel_shader_version_value->GetString("value2", | |
| 758 &pixel_shader_version_string2); | |
| 759 if (!entry->SetPixelShaderVersionInfo(pixel_shader_version_op, | |
| 760 pixel_shader_version_string, | |
| 761 pixel_shader_version_string2)) { | |
| 762 LOG(WARNING) << "Malformed pixel shader version entry " << entry->id(); | |
| 763 return NULL; | |
| 764 } | |
| 765 dictionary_entry_count++; | |
| 766 } | |
| 767 | |
| 768 if (top_level) { | |
| 769 const base::ListValue* feature_value = NULL; | |
| 770 if (value->GetList("features", &feature_value)) { | |
| 771 std::vector<std::string> feature_list; | |
| 772 std::vector<std::string> feature_exception_list; | |
| 773 for (size_t i = 0; i < feature_value->GetSize(); ++i) { | |
| 774 std::string feature; | |
| 775 const base::DictionaryValue* features_info_value = NULL; | |
| 776 if (feature_value->GetString(i, &feature)) { | |
| 777 feature_list.push_back(feature); | |
| 778 } else if (feature_value->GetDictionary(i, &features_info_value)) { | |
| 779 const base::ListValue* exception_list_value = NULL; | |
| 780 if (features_info_value->size() > 1) { | |
| 781 LOG(WARNING) << "Malformed feature entry " << entry->id(); | |
| 782 return NULL; | |
| 783 } | |
| 784 if (features_info_value->GetList("exceptions", | |
| 785 &exception_list_value)) { | |
| 786 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { | |
| 787 std::string exception_feature; | |
| 788 if (exception_list_value->GetString(i, &exception_feature)) { | |
| 789 feature_exception_list.push_back(exception_feature); | |
| 790 } else { | |
| 791 LOG(WARNING) << "Malformed feature entry " << entry->id(); | |
| 792 return NULL; | |
| 793 } | |
| 794 } | |
| 795 } else { | |
| 796 LOG(WARNING) << "Malformed feature entry " << entry->id(); | |
| 797 return NULL; | |
| 798 } | |
| 799 } else { | |
| 800 LOG(WARNING) << "Malformed feature entry " << entry->id(); | |
| 801 return NULL; | |
| 802 } | |
| 803 } | |
| 804 if (!entry->SetFeatures(feature_list, feature_exception_list, feature_map, | |
| 805 supports_feature_type_all)) { | |
| 806 LOG(WARNING) << "Malformed feature entry " << entry->id(); | |
| 807 return NULL; | |
| 808 } | |
| 809 dictionary_entry_count++; | |
| 810 } | |
| 811 } | |
| 812 | |
| 813 if (top_level) { | |
| 814 const base::ListValue* exception_list_value = NULL; | |
| 815 if (value->GetList("exceptions", &exception_list_value)) { | |
| 816 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { | |
| 817 const base::DictionaryValue* exception_value = NULL; | |
| 818 if (!exception_list_value->GetDictionary(i, &exception_value)) { | |
| 819 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); | |
| 820 return NULL; | |
| 821 } | |
| 822 ScopedGpuControlListEntry exception(GetEntryFromValue( | |
| 823 exception_value, false, feature_map, supports_feature_type_all)); | |
| 824 if (exception.get() == NULL) { | |
| 825 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); | |
| 826 return NULL; | |
| 827 } | |
| 828 // Exception should inherit vendor_id from parent, otherwise if only | |
| 829 // device_ids are specified in Exception, the info will be incomplete. | |
| 830 if (exception->vendor_id_ == 0 && entry->vendor_id_ != 0) | |
| 831 exception->vendor_id_ = entry->vendor_id_; | |
| 832 entry->AddException(exception); | |
| 833 } | |
| 834 dictionary_entry_count++; | |
| 835 } | |
| 836 } | |
| 837 | |
| 838 if (value->size() != dictionary_entry_count) { | |
| 839 LOG(WARNING) << "Entry with unknown fields " << entry->id(); | |
| 840 return NULL; | |
| 841 } | |
| 842 | |
| 843 // If GL_VERSION is specified, but no info about whether it's GL or GLES, | |
| 844 // we use the default for the platform. See GLType enum declaration. | |
| 845 if (entry->gl_version_info_.get() != NULL && entry->gl_type_ == kGLTypeNone) | |
| 846 entry->gl_type_ = GetDefaultGLType(); | |
| 847 | |
| 848 return entry; | |
| 849 } | |
| 850 | |
| 851 GpuControlList::GpuControlListEntry::GpuControlListEntry() | |
| 852 : id_(0), | |
| 853 disabled_(false), | |
| 854 vendor_id_(0), | |
| 855 multi_gpu_style_(kMultiGpuStyleNone), | |
| 856 multi_gpu_category_(kMultiGpuCategoryActive), | |
| 857 gl_type_(kGLTypeNone) { | |
| 858 } | |
| 859 | |
| 860 GpuControlList::GpuControlListEntry::~GpuControlListEntry() { } | |
| 861 | |
| 862 bool GpuControlList::GpuControlListEntry::SetId(uint32_t id) { | |
| 863 if (id != 0) { | |
| 864 id_ = id; | |
| 865 return true; | 200 return true; |
| 866 } | 201 } |
| 867 return false; | 202 return false; |
| 868 } | 203 } |
| 869 | 204 |
| 870 void GpuControlList::GpuControlListEntry::SetDisabled(bool disabled) { | |
| 871 disabled_ = disabled; | |
| 872 } | |
| 873 | |
| 874 bool GpuControlList::GpuControlListEntry::SetOsInfo( | |
| 875 const std::string& os, | |
| 876 const std::string& version_op, | |
| 877 const std::string& version_string, | |
| 878 const std::string& version_string2) { | |
| 879 os_info_.reset(new OsInfo(os, version_op, version_string, version_string2)); | |
| 880 return os_info_->IsValid(); | |
| 881 } | |
| 882 | |
| 883 bool GpuControlList::GpuControlListEntry::SetVendorId( | |
| 884 const std::string& vendor_id_string) { | |
| 885 vendor_id_ = 0; | |
| 886 return base::HexStringToUInt(vendor_id_string, &vendor_id_) && | |
| 887 vendor_id_ != 0; | |
| 888 } | |
| 889 | |
| 890 bool GpuControlList::GpuControlListEntry::AddDeviceId( | |
| 891 const std::string& device_id_string) { | |
| 892 uint32_t device_id = 0; | |
| 893 if (base::HexStringToUInt(device_id_string, &device_id) && device_id != 0) { | |
| 894 device_id_list_.push_back(device_id); | |
| 895 return true; | |
| 896 } | |
| 897 return false; | |
| 898 } | |
| 899 | |
| 900 bool GpuControlList::GpuControlListEntry::SetMultiGpuStyle( | |
| 901 const std::string& multi_gpu_style_string) { | |
| 902 MultiGpuStyle style = StringToMultiGpuStyle(multi_gpu_style_string); | |
| 903 if (style == kMultiGpuStyleNone) | |
| 904 return false; | |
| 905 multi_gpu_style_ = style; | |
| 906 return true; | |
| 907 } | |
| 908 | |
| 909 bool GpuControlList::GpuControlListEntry::SetMultiGpuCategory( | |
| 910 const std::string& multi_gpu_category_string) { | |
| 911 MultiGpuCategory category = | |
| 912 StringToMultiGpuCategory(multi_gpu_category_string); | |
| 913 if (category == kMultiGpuCategoryNone) | |
| 914 return false; | |
| 915 multi_gpu_category_ = category; | |
| 916 return true; | |
| 917 } | |
| 918 | |
| 919 bool GpuControlList::GpuControlListEntry::SetGLType( | |
| 920 const std::string& gl_type_string) { | |
| 921 GLType gl_type = StringToGLType(gl_type_string); | |
| 922 if (gl_type == kGLTypeNone) | |
| 923 return false; | |
| 924 gl_type_ = gl_type; | |
| 925 return true; | |
| 926 } | |
| 927 | |
| 928 bool GpuControlList::GpuControlListEntry::SetDriverVendorInfo( | |
| 929 const std::string& vendor_value) { | |
| 930 driver_vendor_info_ = vendor_value; | |
| 931 return !driver_vendor_info_.empty(); | |
| 932 } | |
| 933 | |
| 934 bool GpuControlList::GpuControlListEntry::SetDriverVersionInfo( | |
| 935 const std::string& version_op, | |
| 936 const std::string& version_style, | |
| 937 const std::string& version_string, | |
| 938 const std::string& version_string2) { | |
| 939 driver_version_info_.reset(new VersionInfo( | |
| 940 version_op, version_style, version_string, version_string2)); | |
| 941 return driver_version_info_->IsValid(); | |
| 942 } | |
| 943 | |
| 944 bool GpuControlList::GpuControlListEntry::SetDriverDateInfo( | |
| 945 const std::string& date_op, | |
| 946 const std::string& date_string, | |
| 947 const std::string& date_string2) { | |
| 948 driver_date_info_.reset( | |
| 949 new VersionInfo(date_op, std::string(), date_string, date_string2)); | |
| 950 return driver_date_info_->IsValid(); | |
| 951 } | |
| 952 | |
| 953 bool GpuControlList::GpuControlListEntry::SetGLVersionInfo( | |
| 954 const std::string& version_op, | |
| 955 const std::string& version_string, | |
| 956 const std::string& version_string2) { | |
| 957 gl_version_info_.reset(new VersionInfo( | |
| 958 version_op, std::string(), version_string, version_string2)); | |
| 959 return gl_version_info_->IsValid(); | |
| 960 } | |
| 961 | |
| 962 bool GpuControlList::GpuControlListEntry::SetGLVersionStringInfo( | |
| 963 const std::string& version_string_value) { | |
| 964 gl_version_string_info_ = version_string_value; | |
| 965 return !gl_version_string_info_.empty(); | |
| 966 } | |
| 967 | |
| 968 bool GpuControlList::GpuControlListEntry::SetGLVendorInfo( | |
| 969 const std::string& vendor_value) { | |
| 970 gl_vendor_info_ = vendor_value; | |
| 971 return !gl_vendor_info_.empty(); | |
| 972 } | |
| 973 | |
| 974 bool GpuControlList::GpuControlListEntry::SetGLRendererInfo( | |
| 975 const std::string& renderer_value) { | |
| 976 gl_renderer_info_ = renderer_value; | |
| 977 return !gl_renderer_info_.empty(); | |
| 978 } | |
| 979 | |
| 980 bool GpuControlList::GpuControlListEntry::SetGLExtensionsInfo( | |
| 981 const std::string& extensions_value) { | |
| 982 gl_extensions_info_ = extensions_value; | |
| 983 return !gl_extensions_info_.empty(); | |
| 984 } | |
| 985 | |
| 986 bool GpuControlList::GpuControlListEntry::SetGLResetNotificationStrategyInfo( | |
| 987 const std::string& op, | |
| 988 const std::string& int_string, | |
| 989 const std::string& int_string2) { | |
| 990 gl_reset_notification_strategy_info_.reset( | |
| 991 new IntInfo(op, int_string, int_string2)); | |
| 992 return gl_reset_notification_strategy_info_->IsValid(); | |
| 993 } | |
| 994 | |
| 995 bool GpuControlList::GpuControlListEntry::SetCpuBrand( | |
| 996 const std::string& cpu_value) { | |
| 997 cpu_brand_ = cpu_value; | |
| 998 return !cpu_brand_.empty(); | |
| 999 } | |
| 1000 | |
| 1001 bool GpuControlList::GpuControlListEntry::SetPerfGraphicsInfo( | |
| 1002 const std::string& op, | |
| 1003 const std::string& float_string, | |
| 1004 const std::string& float_string2) { | |
| 1005 perf_graphics_info_.reset(new FloatInfo(op, float_string, float_string2)); | |
| 1006 return perf_graphics_info_->IsValid(); | |
| 1007 } | |
| 1008 | |
| 1009 bool GpuControlList::GpuControlListEntry::SetPerfGamingInfo( | |
| 1010 const std::string& op, | |
| 1011 const std::string& float_string, | |
| 1012 const std::string& float_string2) { | |
| 1013 perf_gaming_info_.reset(new FloatInfo(op, float_string, float_string2)); | |
| 1014 return perf_gaming_info_->IsValid(); | |
| 1015 } | |
| 1016 | |
| 1017 bool GpuControlList::GpuControlListEntry::SetPerfOverallInfo( | |
| 1018 const std::string& op, | |
| 1019 const std::string& float_string, | |
| 1020 const std::string& float_string2) { | |
| 1021 perf_overall_info_.reset(new FloatInfo(op, float_string, float_string2)); | |
| 1022 return perf_overall_info_->IsValid(); | |
| 1023 } | |
| 1024 | |
| 1025 bool GpuControlList::GpuControlListEntry::AddMachineModelName( | |
| 1026 const std::string& model_name) { | |
| 1027 if (model_name.empty()) | |
| 1028 return false; | |
| 1029 machine_model_name_list_.push_back(model_name); | |
| 1030 return true; | |
| 1031 } | |
| 1032 | |
| 1033 bool GpuControlList::GpuControlListEntry::SetMachineModelVersionInfo( | |
| 1034 const std::string& version_op, | |
| 1035 const std::string& version_string, | |
| 1036 const std::string& version_string2) { | |
| 1037 machine_model_version_info_.reset(new VersionInfo( | |
| 1038 version_op, std::string(), version_string, version_string2)); | |
| 1039 return machine_model_version_info_->IsValid(); | |
| 1040 } | |
| 1041 | |
| 1042 bool GpuControlList::GpuControlListEntry::SetGpuCountInfo( | |
| 1043 const std::string& op, | |
| 1044 const std::string& int_string, | |
| 1045 const std::string& int_string2) { | |
| 1046 gpu_count_info_.reset(new IntInfo(op, int_string, int_string2)); | |
| 1047 return gpu_count_info_->IsValid(); | |
| 1048 } | |
| 1049 | |
| 1050 void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) { | |
| 1051 direct_rendering_info_.reset(new BoolInfo(value)); | |
| 1052 } | |
| 1053 | |
| 1054 void GpuControlList::GpuControlListEntry::SetInProcessGPUInfo(bool value) { | |
| 1055 in_process_gpu_info_.reset(new BoolInfo(value)); | |
| 1056 } | |
| 1057 | |
| 1058 bool GpuControlList::GpuControlListEntry::SetFeatures( | |
| 1059 const std::vector<std::string>& feature_strings, | |
| 1060 const std::vector<std::string>& exception_strings, | |
| 1061 const FeatureMap& feature_map, | |
| 1062 bool supports_feature_type_all) { | |
| 1063 size_t size = feature_strings.size(); | |
| 1064 if (size == 0) | |
| 1065 return false; | |
| 1066 features_.clear(); | |
| 1067 for (size_t i = 0; i < size; ++i) { | |
| 1068 int feature = 0; | |
| 1069 if (supports_feature_type_all && feature_strings[i] == "all") { | |
| 1070 for (FeatureMap::const_iterator iter = feature_map.begin(); | |
| 1071 iter != feature_map.end(); ++iter) { | |
| 1072 if (std::find(exception_strings.begin(), exception_strings.end(), | |
| 1073 iter->first) == exception_strings.end()) | |
| 1074 features_.insert(iter->second); | |
| 1075 } | |
| 1076 continue; | |
| 1077 } | |
| 1078 if (!StringToFeature(feature_strings[i], &feature, feature_map)) { | |
| 1079 features_.clear(); | |
| 1080 return false; | |
| 1081 } | |
| 1082 if (std::find(exception_strings.begin(), exception_strings.end(), | |
| 1083 feature_strings[i]) == exception_strings.end()) | |
| 1084 features_.insert(feature); | |
| 1085 } | |
| 1086 return true; | |
| 1087 } | |
| 1088 | |
| 1089 bool GpuControlList::GpuControlListEntry::SetPixelShaderVersionInfo( | |
| 1090 const std::string& version_op, | |
| 1091 const std::string& version_string, | |
| 1092 const std::string& version_string2) { | |
| 1093 pixel_shader_version_info_.reset(new VersionInfo( | |
| 1094 version_op, std::string(), version_string, version_string2)); | |
| 1095 return pixel_shader_version_info_->IsValid(); | |
| 1096 } | |
| 1097 | |
| 1098 void GpuControlList::GpuControlListEntry::AddException( | |
| 1099 ScopedGpuControlListEntry exception) { | |
| 1100 exceptions_.push_back(exception); | |
| 1101 } | |
| 1102 | |
| 1103 bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( | |
| 1104 const std::string& gl_version) const { | |
| 1105 if (gl_version.empty()) | |
| 1106 return false; | |
| 1107 | |
| 1108 if (gl_version_info_.get() == NULL && gl_type_ == kGLTypeNone) | |
| 1109 return false; | |
| 1110 | |
| 1111 std::vector<std::string> segments = base::SplitString( | |
| 1112 gl_version, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | |
| 1113 std::string number; | |
| 1114 GLType gl_type = kGLTypeNone; | |
| 1115 if (segments.size() > 2 && | |
| 1116 segments[0] == "OpenGL" && segments[1] == "ES") { | |
| 1117 bool full_match = RE2::FullMatch(segments[2], "([\\d.]+).*", &number); | |
| 1118 DCHECK(full_match); | |
| 1119 | |
| 1120 gl_type = kGLTypeGLES; | |
| 1121 if (segments.size() > 3 && | |
| 1122 base::StartsWith(segments[3], "(ANGLE", | |
| 1123 base::CompareCase::INSENSITIVE_ASCII)) { | |
| 1124 gl_type = kGLTypeANGLE; | |
| 1125 } | |
| 1126 } else { | |
| 1127 number = segments[0]; | |
| 1128 gl_type = kGLTypeGL; | |
| 1129 } | |
| 1130 | |
| 1131 if (gl_type_ != kGLTypeNone && gl_type_ != gl_type) | |
| 1132 return true; | |
| 1133 if (gl_version_info_.get() != NULL && !gl_version_info_->Contains(number)) | |
| 1134 return true; | |
| 1135 return false; | |
| 1136 } | |
| 1137 | |
| 1138 // static | 205 // static |
| 1139 GpuControlList::GpuControlListEntry::MultiGpuStyle | 206 GpuControlList::GLType GpuControlList::More::GetDefaultGLType() { |
| 1140 GpuControlList::GpuControlListEntry::StringToMultiGpuStyle( | |
| 1141 const std::string& style) { | |
| 1142 if (style == kMultiGpuStyleStringOptimus) | |
| 1143 return kMultiGpuStyleOptimus; | |
| 1144 if (style == kMultiGpuStyleStringAMDSwitchable) | |
| 1145 return kMultiGpuStyleAMDSwitchable; | |
| 1146 if (style == kMultiGpuStyleStringAMDSwitchableIntegrated) | |
| 1147 return kMultiGpuStyleAMDSwitchableIntegrated; | |
| 1148 if (style == kMultiGpuStyleStringAMDSwitchableDiscrete) | |
| 1149 return kMultiGpuStyleAMDSwitchableDiscrete; | |
| 1150 return kMultiGpuStyleNone; | |
| 1151 } | |
| 1152 | |
| 1153 // static | |
| 1154 GpuControlList::GpuControlListEntry::MultiGpuCategory | |
| 1155 GpuControlList::GpuControlListEntry::StringToMultiGpuCategory( | |
| 1156 const std::string& category) { | |
| 1157 if (category == kMultiGpuCategoryStringPrimary) | |
| 1158 return kMultiGpuCategoryPrimary; | |
| 1159 if (category == kMultiGpuCategoryStringSecondary) | |
| 1160 return kMultiGpuCategorySecondary; | |
| 1161 if (category == kMultiGpuCategoryStringActive) | |
| 1162 return kMultiGpuCategoryActive; | |
| 1163 if (category == kMultiGpuCategoryStringAny) | |
| 1164 return kMultiGpuCategoryAny; | |
| 1165 return kMultiGpuCategoryNone; | |
| 1166 } | |
| 1167 | |
| 1168 // static | |
| 1169 GpuControlList::GpuControlListEntry::GLType | |
| 1170 GpuControlList::GpuControlListEntry::StringToGLType( | |
| 1171 const std::string& gl_type) { | |
| 1172 if (gl_type == kGLTypeStringGL) | |
| 1173 return kGLTypeGL; | |
| 1174 if (gl_type == kGLTypeStringGLES) | |
| 1175 return kGLTypeGLES; | |
| 1176 if (gl_type == kGLTypeStringANGLE) | |
| 1177 return kGLTypeANGLE; | |
| 1178 return kGLTypeNone; | |
| 1179 } | |
| 1180 | |
| 1181 // static | |
| 1182 GpuControlList::GpuControlListEntry::GLType | |
| 1183 GpuControlList::GpuControlListEntry::GetDefaultGLType() { | |
| 1184 #if defined(OS_CHROMEOS) | 207 #if defined(OS_CHROMEOS) |
| 1185 return kGLTypeGL; | 208 return kGLTypeGL; |
| 1186 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 209 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
| 1187 return kGLTypeGL; | 210 return kGLTypeGL; |
| 1188 #elif defined(OS_MACOSX) | 211 #elif defined(OS_MACOSX) |
| 1189 return kGLTypeGL; | 212 return kGLTypeGL; |
| 1190 #elif defined(OS_WIN) | 213 #elif defined(OS_WIN) |
| 1191 return kGLTypeANGLE; | 214 return kGLTypeANGLE; |
| 1192 #elif defined(OS_ANDROID) | 215 #elif defined(OS_ANDROID) |
| 1193 return kGLTypeGLES; | 216 return kGLTypeGLES; |
| 1194 #else | 217 #else |
| 1195 return kGLTypeNone; | 218 return kGLTypeNone; |
| 1196 #endif | 219 #endif |
| 1197 } | 220 } |
| 1198 | 221 |
| 1199 void GpuControlList::GpuControlListEntry::LogControlListMatch( | 222 void GpuControlList::Entry::LogControlListMatch( |
| 1200 const std::string& control_list_logging_name) const { | 223 const std::string& control_list_logging_name) const { |
| 1201 static const char kControlListMatchMessage[] = | 224 static const char kControlListMatchMessage[] = |
| 1202 "Control list match for rule #%u in %s."; | 225 "Control list match for rule #%u in %s."; |
| 1203 VLOG(1) << base::StringPrintf(kControlListMatchMessage, id_, | 226 VLOG(1) << base::StringPrintf(kControlListMatchMessage, id, |
| 1204 control_list_logging_name.c_str()); | 227 control_list_logging_name.c_str()); |
| 1205 } | 228 } |
| 1206 | 229 |
| 1207 bool GpuControlList::GpuControlListEntry::Contains( | 230 bool GpuControlList::DriverInfo::Contains(const GPUInfo& gpu_info) const { |
| 1208 OsType os_type, const std::string& os_version, | 231 if (StringMismatch(gpu_info.driver_vendor, driver_vendor)) { |
| 1209 const GPUInfo& gpu_info) const { | |
| 1210 DCHECK(os_type != kOsAny); | |
| 1211 if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) | |
| 1212 return false; | 232 return false; |
| 1213 if (vendor_id_ != 0) { | 233 } |
| 234 if (driver_version.IsSpecified() && !gpu_info.driver_version.empty() && |
| 235 !driver_version.Contains(gpu_info.driver_version)) { |
| 236 return false; |
| 237 } |
| 238 if (driver_date.IsSpecified() && !gpu_info.driver_date.empty() && |
| 239 !driver_date.Contains(gpu_info.driver_date, '-')) { |
| 240 return false; |
| 241 } |
| 242 return true; |
| 243 } |
| 244 |
| 245 bool GpuControlList::GLStrings::Contains(const GPUInfo& gpu_info) const { |
| 246 if (StringMismatch(gpu_info.gl_version, gl_version)) |
| 247 return false; |
| 248 if (StringMismatch(gpu_info.gl_vendor, gl_vendor)) |
| 249 return false; |
| 250 if (StringMismatch(gpu_info.gl_renderer, gl_renderer)) |
| 251 return false; |
| 252 if (StringMismatch(gpu_info.gl_extensions, gl_extensions)) |
| 253 return false; |
| 254 return true; |
| 255 } |
| 256 |
| 257 bool GpuControlList::MachineModelInfo::Contains(const GPUInfo& gpu_info) const { |
| 258 if (machine_model_name_size > 0) { |
| 259 if (gpu_info.machine_model_name.empty()) |
| 260 return false; |
| 261 bool found_match = false; |
| 262 for (size_t ii = 0; ii < machine_model_name_size; ++ii) { |
| 263 if (RE2::FullMatch(gpu_info.machine_model_name, |
| 264 machine_model_names[ii])) { |
| 265 found_match = true; |
| 266 break; |
| 267 } |
| 268 } |
| 269 if (!found_match) |
| 270 return false; |
| 271 } |
| 272 if (machine_model_version.IsSpecified() && |
| 273 (gpu_info.machine_model_version.empty() || |
| 274 !machine_model_version.Contains(gpu_info.machine_model_version))) { |
| 275 return false; |
| 276 } |
| 277 return true; |
| 278 } |
| 279 |
| 280 bool GpuControlList::More::Contains(const GPUInfo& gpu_info) const { |
| 281 if (GLVersionInfoMismatch(gpu_info.gl_version)) { |
| 282 return false; |
| 283 } |
| 284 if (gl_reset_notification_strategy != 0 && |
| 285 gl_reset_notification_strategy != |
| 286 gpu_info.gl_reset_notification_strategy) { |
| 287 return false; |
| 288 } |
| 289 if (gpu_count.IsSpecified()) { |
| 290 size_t count = gpu_info.secondary_gpus.size() + 1; |
| 291 if (!gpu_count.Contains(std::to_string(count))) { |
| 292 return false; |
| 293 } |
| 294 } |
| 295 if (!direct_rendering && gpu_info.direct_rendering) { |
| 296 return false; |
| 297 } |
| 298 if (in_process_gpu && !gpu_info.in_process_gpu) { |
| 299 return false; |
| 300 } |
| 301 if (pixel_shader_version.IsSpecified() && |
| 302 !pixel_shader_version.Contains(gpu_info.pixel_shader_version)) { |
| 303 return false; |
| 304 } |
| 305 return true; |
| 306 } |
| 307 |
| 308 bool GpuControlList::Conditions::Contains(OsType target_os_type, |
| 309 const std::string& target_os_version, |
| 310 const GPUInfo& gpu_info) const { |
| 311 DCHECK(target_os_type != kOsAny); |
| 312 if (os_type != kOsAny) { |
| 313 if (os_type != target_os_type) |
| 314 return false; |
| 315 if (os_version.IsSpecified() && !os_version.Contains(target_os_version)) |
| 316 return false; |
| 317 } |
| 318 if (vendor_id != 0) { |
| 1214 std::vector<GPUInfo::GPUDevice> candidates; | 319 std::vector<GPUInfo::GPUDevice> candidates; |
| 1215 switch (multi_gpu_category_) { | 320 switch (multi_gpu_category) { |
| 1216 case kMultiGpuCategoryPrimary: | 321 case kMultiGpuCategoryPrimary: |
| 1217 candidates.push_back(gpu_info.gpu); | 322 candidates.push_back(gpu_info.gpu); |
| 1218 break; | 323 break; |
| 1219 case kMultiGpuCategorySecondary: | 324 case kMultiGpuCategorySecondary: |
| 1220 candidates = gpu_info.secondary_gpus; | 325 candidates = gpu_info.secondary_gpus; |
| 1221 break; | 326 break; |
| 1222 case kMultiGpuCategoryAny: | 327 case kMultiGpuCategoryAny: |
| 1223 candidates = gpu_info.secondary_gpus; | 328 candidates = gpu_info.secondary_gpus; |
| 1224 candidates.push_back(gpu_info.gpu); | 329 candidates.push_back(gpu_info.gpu); |
| 1225 break; | 330 break; |
| 1226 case kMultiGpuCategoryActive: | 331 case kMultiGpuCategoryActive: |
| 332 case kMultiGpuCategoryNone: |
| 333 // If gpu category is not specified, default to the active gpu. |
| 1227 if (gpu_info.gpu.active || gpu_info.secondary_gpus.empty()) | 334 if (gpu_info.gpu.active || gpu_info.secondary_gpus.empty()) |
| 1228 candidates.push_back(gpu_info.gpu); | 335 candidates.push_back(gpu_info.gpu); |
| 1229 for (size_t ii = 0; ii < gpu_info.secondary_gpus.size(); ++ii) { | 336 for (size_t ii = 0; ii < gpu_info.secondary_gpus.size(); ++ii) { |
| 1230 if (gpu_info.secondary_gpus[ii].active) | 337 if (gpu_info.secondary_gpus[ii].active) |
| 1231 candidates.push_back(gpu_info.secondary_gpus[ii]); | 338 candidates.push_back(gpu_info.secondary_gpus[ii]); |
| 1232 } | 339 } |
| 1233 if (candidates.empty()) | 340 if (candidates.empty()) |
| 1234 candidates.push_back(gpu_info.gpu); | 341 candidates.push_back(gpu_info.gpu); |
| 1235 default: | |
| 1236 break; | |
| 1237 } | 342 } |
| 1238 | 343 |
| 1239 GPUInfo::GPUDevice gpu; | 344 GPUInfo::GPUDevice gpu; |
| 1240 gpu.vendor_id = vendor_id_; | 345 gpu.vendor_id = vendor_id; |
| 1241 bool found = false; | 346 bool found = false; |
| 1242 if (device_id_list_.empty()) { | 347 if (device_id_size == 0) { |
| 1243 for (size_t ii = 0; ii < candidates.size(); ++ii) { | 348 for (size_t ii = 0; ii < candidates.size(); ++ii) { |
| 1244 if (gpu.vendor_id == candidates[ii].vendor_id) { | 349 if (gpu.vendor_id == candidates[ii].vendor_id) { |
| 1245 found = true; | 350 found = true; |
| 1246 break; | 351 break; |
| 1247 } | 352 } |
| 1248 } | 353 } |
| 1249 } else { | 354 } else { |
| 1250 for (size_t ii = 0; ii < device_id_list_.size(); ++ii) { | 355 for (size_t ii = 0; ii < device_id_size; ++ii) { |
| 1251 gpu.device_id = device_id_list_[ii]; | 356 gpu.device_id = device_ids[ii]; |
| 1252 for (size_t jj = 0; jj < candidates.size(); ++jj) { | 357 for (size_t jj = 0; jj < candidates.size(); ++jj) { |
| 1253 if (gpu.vendor_id == candidates[jj].vendor_id && | 358 if (gpu.vendor_id == candidates[jj].vendor_id && |
| 1254 gpu.device_id == candidates[jj].device_id) { | 359 gpu.device_id == candidates[jj].device_id) { |
| 1255 found = true; | 360 found = true; |
| 1256 break; | 361 break; |
| 1257 } | 362 } |
| 1258 } | 363 } |
| 1259 } | 364 } |
| 1260 } | 365 } |
| 1261 if (!found) | 366 if (!found) |
| 1262 return false; | 367 return false; |
| 1263 } | 368 } |
| 1264 switch (multi_gpu_style_) { | 369 switch (multi_gpu_style) { |
| 1265 case kMultiGpuStyleOptimus: | 370 case kMultiGpuStyleOptimus: |
| 1266 if (!gpu_info.optimus) | 371 if (!gpu_info.optimus) |
| 1267 return false; | 372 return false; |
| 1268 break; | 373 break; |
| 1269 case kMultiGpuStyleAMDSwitchable: | 374 case kMultiGpuStyleAMDSwitchable: |
| 1270 if (!gpu_info.amd_switchable) | 375 if (!gpu_info.amd_switchable) |
| 1271 return false; | 376 return false; |
| 1272 break; | 377 break; |
| 1273 case kMultiGpuStyleAMDSwitchableDiscrete: | 378 case kMultiGpuStyleAMDSwitchableDiscrete: |
| 1274 if (!gpu_info.amd_switchable) | 379 if (!gpu_info.amd_switchable) |
| 1275 return false; | 380 return false; |
| 1276 // The discrete GPU is always the primary GPU. | 381 // The discrete GPU is always the primary GPU. |
| 1277 // This is guaranteed by GpuInfoCollector. | 382 // This is guaranteed by GpuInfoCollector. |
| 1278 if (!gpu_info.gpu.active) | 383 if (!gpu_info.gpu.active) |
| 1279 return false; | 384 return false; |
| 1280 break; | 385 break; |
| 1281 case kMultiGpuStyleAMDSwitchableIntegrated: | 386 case kMultiGpuStyleAMDSwitchableIntegrated: |
| 1282 if (!gpu_info.amd_switchable) | 387 if (!gpu_info.amd_switchable) |
| 1283 return false; | 388 return false; |
| 1284 // Assume the integrated GPU is the first in the secondary GPU list. | 389 // Assume the integrated GPU is the first in the secondary GPU list. |
| 1285 if (gpu_info.secondary_gpus.size() == 0 || | 390 if (gpu_info.secondary_gpus.size() == 0 || |
| 1286 !gpu_info.secondary_gpus[0].active) | 391 !gpu_info.secondary_gpus[0].active) |
| 1287 return false; | 392 return false; |
| 1288 break; | 393 break; |
| 1289 case kMultiGpuStyleNone: | 394 case kMultiGpuStyleNone: |
| 1290 break; | 395 break; |
| 1291 } | 396 } |
| 1292 if (StringMismatch(gpu_info.driver_vendor, driver_vendor_info_)) | 397 if (driver_info && !driver_info->Contains(gpu_info)) { |
| 1293 return false; | 398 return false; |
| 1294 if (driver_version_info_.get() != NULL && !gpu_info.driver_version.empty()) { | |
| 1295 if (!driver_version_info_->Contains(gpu_info.driver_version)) | |
| 1296 return false; | |
| 1297 } | 399 } |
| 1298 if (driver_date_info_.get() != NULL && !gpu_info.driver_date.empty()) { | 400 if (gl_strings && !gl_strings->Contains(gpu_info)) { |
| 1299 if (!driver_date_info_->Contains(gpu_info.driver_date, '-')) | 401 return false; |
| 1300 return false; | |
| 1301 } | 402 } |
| 1302 if (GLVersionInfoMismatch(gpu_info.gl_version)) | 403 if (machine_model_info && !machine_model_info->Contains(gpu_info)) { |
| 1303 return false; | 404 return false; |
| 1304 if (StringMismatch(gpu_info.gl_version, gl_version_string_info_)) | 405 } |
| 406 if (more && !more->Contains(gpu_info)) { |
| 1305 return false; | 407 return false; |
| 1306 if (StringMismatch(gpu_info.gl_vendor, gl_vendor_info_)) | |
| 1307 return false; | |
| 1308 if (StringMismatch(gpu_info.gl_renderer, gl_renderer_info_)) | |
| 1309 return false; | |
| 1310 if (StringMismatch(gpu_info.gl_extensions, gl_extensions_info_)) | |
| 1311 return false; | |
| 1312 if (gl_reset_notification_strategy_info_.get() != NULL && | |
| 1313 !gl_reset_notification_strategy_info_->Contains( | |
| 1314 gpu_info.gl_reset_notification_strategy)) | |
| 1315 return false; | |
| 1316 if (!machine_model_name_list_.empty()) { | |
| 1317 if (gpu_info.machine_model_name.empty()) | |
| 1318 return false; | |
| 1319 bool found_match = false; | |
| 1320 for (size_t ii = 0; ii < machine_model_name_list_.size(); ++ii) { | |
| 1321 if (RE2::FullMatch(gpu_info.machine_model_name, | |
| 1322 machine_model_name_list_[ii])) { | |
| 1323 found_match = true; | |
| 1324 break; | |
| 1325 } | |
| 1326 } | |
| 1327 if (!found_match) | |
| 1328 return false; | |
| 1329 } | |
| 1330 if (machine_model_version_info_.get() != NULL && | |
| 1331 (gpu_info.machine_model_version.empty() || | |
| 1332 !machine_model_version_info_->Contains(gpu_info.machine_model_version))) | |
| 1333 return false; | |
| 1334 if (gpu_count_info_.get() != NULL && | |
| 1335 !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) | |
| 1336 return false; | |
| 1337 if (direct_rendering_info_.get() != NULL && | |
| 1338 !direct_rendering_info_->Contains(gpu_info.direct_rendering)) | |
| 1339 return false; | |
| 1340 if (in_process_gpu_info_.get() != NULL && | |
| 1341 !in_process_gpu_info_->Contains(gpu_info.in_process_gpu)) | |
| 1342 return false; | |
| 1343 if (!cpu_brand_.empty()) { | |
| 1344 base::CPU cpu_info; | |
| 1345 if (StringMismatch(cpu_info.cpu_brand(), cpu_brand_)) | |
| 1346 return false; | |
| 1347 } | |
| 1348 if (pixel_shader_version_info_.get() != NULL) { | |
| 1349 if (!pixel_shader_version_info_->Contains(gpu_info.pixel_shader_version)) | |
| 1350 return false; | |
| 1351 } | |
| 1352 | |
| 1353 for (size_t i = 0; i < exceptions_.size(); ++i) { | |
| 1354 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && | |
| 1355 !exceptions_[i]->NeedsMoreInfo(gpu_info, true)) | |
| 1356 return false; | |
| 1357 } | 408 } |
| 1358 return true; | 409 return true; |
| 1359 } | 410 } |
| 1360 | 411 |
| 1361 bool GpuControlList::GpuControlListEntry::NeedsMoreInfo( | 412 bool GpuControlList::Entry::Contains(OsType target_os_type, |
| 1362 const GPUInfo& gpu_info, | 413 const std::string& target_os_version, |
| 1363 bool consider_exceptions) const { | 414 const GPUInfo& gpu_info) const { |
| 415 if (!conditions.Contains(target_os_type, target_os_version, gpu_info)) { |
| 416 return false; |
| 417 } |
| 418 for (size_t ii = 0; ii < exception_size; ++ii) { |
| 419 if (exceptions[ii].Contains(target_os_type, target_os_version, gpu_info) && |
| 420 !exceptions[ii].NeedsMoreInfo(gpu_info)) { |
| 421 return false; |
| 422 } |
| 423 } |
| 424 return true; |
| 425 } |
| 426 |
| 427 bool GpuControlList::Conditions::NeedsMoreInfo(const GPUInfo& gpu_info) const { |
| 1364 // We only check for missing info that might be collected with a gl context. | 428 // We only check for missing info that might be collected with a gl context. |
| 1365 // If certain info is missing due to some error, say, we fail to collect | 429 // If certain info is missing due to some error, say, we fail to collect |
| 1366 // vendor_id/device_id, then even if we launch GPU process and create a gl | 430 // vendor_id/device_id, then even if we launch GPU process and create a gl |
| 1367 // context, we won't gather such missing info, so we still return false. | 431 // context, we won't gather such missing info, so we still return false. |
| 1368 if (!driver_vendor_info_.empty() && gpu_info.driver_vendor.empty()) | 432 if (driver_info) { |
| 1369 return true; | 433 if (driver_info->driver_vendor && gpu_info.driver_vendor.empty()) { |
| 1370 if (driver_version_info_.get() && gpu_info.driver_version.empty()) | 434 return true; |
| 1371 return true; | 435 } |
| 1372 if ((gl_version_info_.get() || !gl_version_string_info_.empty()) && | 436 if (driver_info->driver_version.IsSpecified() && |
| 437 gpu_info.driver_version.empty()) { |
| 438 return true; |
| 439 } |
| 440 } |
| 441 if (((more && more->gl_version.IsSpecified()) || |
| 442 (gl_strings && gl_strings->gl_version)) && |
| 1373 gpu_info.gl_version.empty()) { | 443 gpu_info.gl_version.empty()) { |
| 1374 return true; | 444 return true; |
| 1375 } | 445 } |
| 1376 if (!gl_vendor_info_.empty() && gpu_info.gl_vendor.empty()) | 446 if (gl_strings && gl_strings->gl_vendor && gpu_info.gl_vendor.empty()) |
| 1377 return true; | 447 return true; |
| 1378 if (!gl_renderer_info_.empty() && gpu_info.gl_renderer.empty()) | 448 if (gl_strings && gl_strings->gl_renderer && gpu_info.gl_renderer.empty()) |
| 1379 return true; | 449 return true; |
| 1380 if (pixel_shader_version_info_.get() != NULL && | 450 if (more && more->pixel_shader_version.IsSpecified() && |
| 1381 gpu_info.pixel_shader_version.empty()) | 451 gpu_info.pixel_shader_version.empty()) { |
| 1382 return true; | |
| 1383 | |
| 1384 if (consider_exceptions) { | |
| 1385 for (size_t i = 0; i < exceptions_.size(); ++i) { | |
| 1386 if (exceptions_[i]->NeedsMoreInfo(gpu_info, consider_exceptions)) | |
| 1387 return true; | |
| 1388 } | |
| 1389 } | |
| 1390 | |
| 1391 return false; | |
| 1392 } | |
| 1393 | |
| 1394 GpuControlList::OsType GpuControlList::GpuControlListEntry::GetOsType() const { | |
| 1395 if (os_info_.get() == NULL) | |
| 1396 return kOsAny; | |
| 1397 return os_info_->type(); | |
| 1398 } | |
| 1399 | |
| 1400 uint32_t GpuControlList::GpuControlListEntry::id() const { | |
| 1401 return id_; | |
| 1402 } | |
| 1403 | |
| 1404 bool GpuControlList::GpuControlListEntry::disabled() const { | |
| 1405 return disabled_; | |
| 1406 } | |
| 1407 | |
| 1408 const std::set<int>& GpuControlList::GpuControlListEntry::features() const { | |
| 1409 return features_; | |
| 1410 } | |
| 1411 | |
| 1412 void GpuControlList::GpuControlListEntry::GetFeatureNames( | |
| 1413 base::ListValue* feature_names, | |
| 1414 const FeatureMap& feature_map, | |
| 1415 bool supports_feature_type_all) const { | |
| 1416 DCHECK(feature_names); | |
| 1417 if (supports_feature_type_all && features_.size() == feature_map.size()) { | |
| 1418 feature_names->AppendString("all"); | |
| 1419 return; | |
| 1420 } | |
| 1421 for (FeatureMap::const_iterator iter = feature_map.begin(); | |
| 1422 iter != feature_map.end(); ++iter) { | |
| 1423 if (features_.count(iter->second) > 0) | |
| 1424 feature_names->AppendString(iter->first); | |
| 1425 } | |
| 1426 } | |
| 1427 | |
| 1428 // static | |
| 1429 bool GpuControlList::GpuControlListEntry::StringToFeature( | |
| 1430 const std::string& feature_name, int* feature_id, | |
| 1431 const FeatureMap& feature_map) { | |
| 1432 FeatureMap::const_iterator iter = feature_map.find(feature_name); | |
| 1433 if (iter != feature_map.end()) { | |
| 1434 *feature_id = iter->second; | |
| 1435 return true; | 452 return true; |
| 1436 } | 453 } |
| 1437 return false; | 454 return false; |
| 1438 } | 455 } |
| 1439 | 456 |
| 1440 GpuControlList::GpuControlList() | 457 bool GpuControlList::Entry::NeedsMoreInfo(const GPUInfo& gpu_info, |
| 1441 : max_entry_id_(0), | 458 bool consider_exceptions) const { |
| 459 if (conditions.NeedsMoreInfo(gpu_info)) |
| 460 return true; |
| 461 if (consider_exceptions) { |
| 462 for (size_t ii = 0; ii < exception_size; ++ii) { |
| 463 if (exceptions[ii].NeedsMoreInfo(gpu_info)) |
| 464 return true; |
| 465 } |
| 466 } |
| 467 return false; |
| 468 } |
| 469 |
| 470 void GpuControlList::Entry::GetFeatureNames( |
| 471 base::ListValue* feature_names, |
| 472 const FeatureMap& feature_map) const { |
| 473 DCHECK(feature_names); |
| 474 for (size_t ii = 0; ii < feature_size; ++ii) { |
| 475 auto iter = feature_map.find(features[ii]); |
| 476 DCHECK(iter != feature_map.end()); |
| 477 feature_names->AppendString(iter->second); |
| 478 } |
| 479 } |
| 480 |
| 481 GpuControlList::GpuControlList(const GpuControlListData& data) |
| 482 : version_(data.version), |
| 483 entry_count_(data.entry_count), |
| 484 entries_(data.entries), |
| 485 max_entry_id_(0), |
| 1442 needs_more_info_(false), | 486 needs_more_info_(false), |
| 1443 supports_feature_type_all_(false), | |
| 1444 control_list_logging_enabled_(false) { | 487 control_list_logging_enabled_(false) { |
| 488 DCHECK_LT(0u, entry_count_); |
| 489 // Assume the newly last added entry has the largest ID. |
| 490 max_entry_id_ = entries_[entry_count_ - 1].id; |
| 1445 } | 491 } |
| 1446 | 492 |
| 1447 GpuControlList::~GpuControlList() { | 493 GpuControlList::~GpuControlList() { |
| 1448 Clear(); | |
| 1449 } | 494 } |
| 1450 | 495 |
| 1451 bool GpuControlList::LoadList( | 496 std::set<int> GpuControlList::MakeDecision(GpuControlList::OsType os, |
| 1452 const std::string& json_context, | 497 const std::string& os_version, |
| 1453 GpuControlList::OsFilter os_filter) { | 498 const GPUInfo& gpu_info) { |
| 1454 std::unique_ptr<base::DictionaryValue> root = | |
| 1455 base::DictionaryValue::From(base::JSONReader::Read(json_context)); | |
| 1456 if (!root) | |
| 1457 return false; | |
| 1458 return LoadList(*root, os_filter); | |
| 1459 } | |
| 1460 | |
| 1461 bool GpuControlList::LoadList(const base::DictionaryValue& parsed_json, | |
| 1462 GpuControlList::OsFilter os_filter) { | |
| 1463 std::vector<ScopedGpuControlListEntry> entries; | |
| 1464 | |
| 1465 parsed_json.GetString("version", &version_); | |
| 1466 std::vector<std::string> pieces; | |
| 1467 if (!ProcessVersionString(version_, '.', &pieces)) | |
| 1468 return false; | |
| 1469 | |
| 1470 const base::ListValue* list = NULL; | |
| 1471 if (!parsed_json.GetList("entries", &list)) | |
| 1472 return false; | |
| 1473 | |
| 1474 uint32_t max_entry_id = 0; | |
| 1475 for (size_t i = 0; i < list->GetSize(); ++i) { | |
| 1476 const base::DictionaryValue* list_item = NULL; | |
| 1477 bool valid = list->GetDictionary(i, &list_item); | |
| 1478 if (!valid || list_item == NULL) | |
| 1479 return false; | |
| 1480 ScopedGpuControlListEntry entry(GpuControlListEntry::GetEntryFromValue( | |
| 1481 list_item, true, feature_map_, supports_feature_type_all_)); | |
| 1482 if (entry.get() == NULL) | |
| 1483 return false; | |
| 1484 if (entry->id() > max_entry_id) | |
| 1485 max_entry_id = entry->id(); | |
| 1486 entries.push_back(entry); | |
| 1487 } | |
| 1488 | |
| 1489 Clear(); | |
| 1490 OsType my_os = GetOsType(); | |
| 1491 for (size_t i = 0; i < entries.size(); ++i) { | |
| 1492 OsType entry_os = entries[i]->GetOsType(); | |
| 1493 if (os_filter == GpuControlList::kAllOs || | |
| 1494 entry_os == kOsAny || entry_os == my_os) | |
| 1495 entries_.push_back(entries[i]); | |
| 1496 } | |
| 1497 max_entry_id_ = max_entry_id; | |
| 1498 return true; | |
| 1499 } | |
| 1500 | |
| 1501 std::set<int> GpuControlList::MakeDecision( | |
| 1502 GpuControlList::OsType os, | |
| 1503 std::string os_version, | |
| 1504 const GPUInfo& gpu_info) { | |
| 1505 active_entries_.clear(); | 499 active_entries_.clear(); |
| 1506 std::set<int> features; | 500 std::set<int> features; |
| 1507 | 501 |
| 1508 needs_more_info_ = false; | 502 needs_more_info_ = false; |
| 1509 // Has all features permanently in the list without any possibility of | 503 // Has all features permanently in the list without any possibility of |
| 1510 // removal in the future (subset of "features" set). | 504 // removal in the future (subset of "features" set). |
| 1511 std::set<int> permanent_features; | 505 std::set<int> permanent_features; |
| 1512 // Has all features absent from "features" set that could potentially be | 506 // Has all features absent from "features" set that could potentially be |
| 1513 // included later with more information. | 507 // included later with more information. |
| 1514 std::set<int> potential_features; | 508 std::set<int> potential_features; |
| 1515 | 509 |
| 1516 if (os == kOsAny) | 510 if (os == kOsAny) |
| 1517 os = GetOsType(); | 511 os = GetOsType(); |
| 1518 if (os_version.empty()) | 512 std::string processed_os_version = os_version; |
| 1519 os_version = base::SysInfo::OperatingSystemVersion(); | 513 if (processed_os_version.empty()) |
| 514 processed_os_version = base::SysInfo::OperatingSystemVersion(); |
| 515 // Get rid of the non numbers because later processing expects a valid |
| 516 // version string in the format of "a.b.c". |
| 517 size_t pos = processed_os_version.find_first_not_of("0123456789."); |
| 518 if (pos != std::string::npos) |
| 519 processed_os_version = processed_os_version.substr(0, pos); |
| 1520 | 520 |
| 1521 for (size_t i = 0; i < entries_.size(); ++i) { | 521 for (size_t ii = 0; ii < entry_count_; ++ii) { |
| 1522 ScopedGpuControlListEntry entry = entries_[i]; | 522 const Entry& entry = entries_[ii]; |
| 1523 if (entry->Contains(os, os_version, gpu_info)) { | 523 DCHECK_NE(0u, entry.id); |
| 1524 bool needs_more_info_main = entry->NeedsMoreInfo(gpu_info, false); | 524 if (entry.Contains(os, processed_os_version, gpu_info)) { |
| 1525 bool needs_more_info_exception = entry->NeedsMoreInfo(gpu_info, true); | 525 bool needs_more_info_main = entry.NeedsMoreInfo(gpu_info, false); |
| 526 bool needs_more_info_exception = entry.NeedsMoreInfo(gpu_info, true); |
| 1526 | 527 |
| 1527 if (!entry->disabled()) { | 528 if (control_list_logging_enabled_) |
| 1528 if (control_list_logging_enabled_) | 529 entry.LogControlListMatch(control_list_logging_name_); |
| 1529 entry->LogControlListMatch(control_list_logging_name_); | 530 // Only look at main entry info when deciding what to add to "features" |
| 1530 // Only look at main entry info when deciding what to add to "features" | 531 // set. If we don't have enough info for an exception, it's safer if we |
| 1531 // set. If we don't have enough info for an exception, it's safer if we | 532 // just ignore the exception and assume the exception doesn't apply. |
| 1532 // just ignore the exception and assume the exception doesn't apply. | 533 for (size_t jj = 0; jj < entry.feature_size; ++jj) { |
| 1533 for (std::set<int>::const_iterator iter = entry->features().begin(); | 534 int feature = entry.features[jj]; |
| 1534 iter != entry->features().end(); ++iter) { | 535 if (needs_more_info_main) { |
| 1535 if (needs_more_info_main) { | 536 if (!features.count(feature)) |
| 1536 if (!features.count(*iter)) | 537 potential_features.insert(feature); |
| 1537 potential_features.insert(*iter); | 538 } else { |
| 1538 } else { | 539 features.insert(feature); |
| 1539 features.insert(*iter); | 540 potential_features.erase(feature); |
| 1540 potential_features.erase(*iter); | 541 if (!needs_more_info_exception) |
| 1541 if (!needs_more_info_exception) | 542 permanent_features.insert(feature); |
| 1542 permanent_features.insert(*iter); | |
| 1543 } | |
| 1544 } | 543 } |
| 1545 } | 544 } |
| 1546 | 545 |
| 1547 if (!needs_more_info_main) | 546 if (!needs_more_info_main) |
| 1548 active_entries_.push_back(entry); | 547 active_entries_.push_back(ii); |
| 1549 } | 548 } |
| 1550 } | 549 } |
| 1551 | 550 |
| 1552 needs_more_info_ = permanent_features.size() < features.size() || | 551 needs_more_info_ = permanent_features.size() < features.size() || |
| 1553 !potential_features.empty(); | 552 !potential_features.empty(); |
| 1554 return features; | 553 return features; |
| 1555 } | 554 } |
| 1556 | 555 |
| 1557 void GpuControlList::GetDecisionEntries(std::vector<uint32_t>* entry_ids, | 556 void GpuControlList::GetDecisionEntries( |
| 1558 bool disabled) const { | 557 std::vector<uint32_t>* entry_ids) const { |
| 1559 DCHECK(entry_ids); | 558 DCHECK(entry_ids); |
| 1560 entry_ids->clear(); | 559 entry_ids->clear(); |
| 1561 for (size_t i = 0; i < active_entries_.size(); ++i) { | 560 for (auto index : active_entries_) { |
| 1562 if (disabled == active_entries_[i]->disabled()) | 561 DCHECK_LT(index, entry_count_); |
| 1563 entry_ids->push_back(active_entries_[i]->id()); | 562 entry_ids->push_back(entries_[index].id); |
| 1564 } | 563 } |
| 1565 } | 564 } |
| 1566 | 565 |
| 1567 std::vector<std::string> GpuControlList::GetDisabledExtensions() { | 566 std::vector<std::string> GpuControlList::GetDisabledExtensions() { |
| 1568 std::set<std::string> disabled_extensions; | 567 std::set<std::string> disabled_extensions; |
| 1569 for (size_t i = 0; i < active_entries_.size(); ++i) { | 568 for (auto index : active_entries_) { |
| 1570 GpuControlListEntry* entry = active_entries_[i].get(); | 569 DCHECK_LT(index, entry_count_); |
| 1571 | 570 const Entry& entry = entries_[index]; |
| 1572 if (entry->disabled()) | 571 for (size_t ii = 0; ii < entry.disabled_extension_size; ++ii) { |
| 1573 continue; | 572 disabled_extensions.insert(entry.disabled_extensions[ii]); |
| 1574 | 573 } |
| 1575 disabled_extensions.insert(entry->disabled_extensions().begin(), | |
| 1576 entry->disabled_extensions().end()); | |
| 1577 } | 574 } |
| 1578 return std::vector<std::string>(disabled_extensions.begin(), | 575 return std::vector<std::string>(disabled_extensions.begin(), |
| 1579 disabled_extensions.end()); | 576 disabled_extensions.end()); |
| 1580 } | 577 } |
| 1581 | 578 |
| 1582 void GpuControlList::GetReasons(base::ListValue* problem_list, | 579 void GpuControlList::GetReasons(base::ListValue* problem_list, |
| 1583 const std::string& tag) const { | 580 const std::string& tag) const { |
| 1584 DCHECK(problem_list); | 581 DCHECK(problem_list); |
| 1585 for (size_t i = 0; i < active_entries_.size(); ++i) { | 582 for (auto index : active_entries_) { |
| 1586 GpuControlListEntry* entry = active_entries_[i].get(); | 583 const Entry& entry = entries_[index]; |
| 1587 if (entry->disabled()) | |
| 1588 continue; | |
| 1589 std::unique_ptr<base::DictionaryValue> problem(new base::DictionaryValue()); | 584 std::unique_ptr<base::DictionaryValue> problem(new base::DictionaryValue()); |
| 1590 | 585 |
| 1591 problem->SetString("description", entry->description()); | 586 problem->SetString("description", entry.description); |
| 1592 | 587 |
| 1593 base::ListValue* cr_bugs = new base::ListValue(); | 588 base::ListValue* cr_bugs = new base::ListValue(); |
| 1594 for (size_t j = 0; j < entry->cr_bugs().size(); ++j) | 589 for (size_t jj = 0; jj < entry.cr_bug_size; ++jj) |
| 1595 cr_bugs->AppendInteger(entry->cr_bugs()[j]); | 590 cr_bugs->AppendInteger(entry.cr_bugs[jj]); |
| 1596 problem->Set("crBugs", cr_bugs); | 591 problem->Set("crBugs", cr_bugs); |
| 1597 | 592 |
| 1598 base::ListValue* webkit_bugs = new base::ListValue(); | |
| 1599 for (size_t j = 0; j < entry->webkit_bugs().size(); ++j) { | |
| 1600 webkit_bugs->AppendInteger(entry->webkit_bugs()[j]); | |
| 1601 } | |
| 1602 problem->Set("webkitBugs", webkit_bugs); | |
| 1603 | |
| 1604 base::ListValue* features = new base::ListValue(); | 593 base::ListValue* features = new base::ListValue(); |
| 1605 entry->GetFeatureNames(features, feature_map_, supports_feature_type_all_); | 594 entry.GetFeatureNames(features, feature_map_); |
| 1606 problem->Set("affectedGpuSettings", features); | 595 problem->Set("affectedGpuSettings", features); |
| 1607 | 596 |
| 1608 DCHECK(tag == "workarounds" || tag == "disabledFeatures"); | 597 DCHECK(tag == "workarounds" || tag == "disabledFeatures"); |
| 1609 problem->SetString("tag", tag); | 598 problem->SetString("tag", tag); |
| 1610 | 599 |
| 1611 problem_list->Append(std::move(problem)); | 600 problem_list->Append(std::move(problem)); |
| 1612 } | 601 } |
| 1613 } | 602 } |
| 1614 | 603 |
| 1615 size_t GpuControlList::num_entries() const { | 604 size_t GpuControlList::num_entries() const { |
| 1616 return entries_.size(); | 605 return entry_count_; |
| 1617 } | |
| 1618 | |
| 1619 bool GpuControlList::has_duplicated_entry_id() const { | |
| 1620 std::set<int> ids; | |
| 1621 for (size_t i = 0; i < entries_.size(); ++i) { | |
| 1622 if (ids.count(entries_[i]->id()) == 0) | |
| 1623 ids.insert(entries_[i]->id()); | |
| 1624 else | |
| 1625 return true; | |
| 1626 } | |
| 1627 return false; | |
| 1628 } | 606 } |
| 1629 | 607 |
| 1630 uint32_t GpuControlList::max_entry_id() const { | 608 uint32_t GpuControlList::max_entry_id() const { |
| 1631 return max_entry_id_; | 609 return max_entry_id_; |
| 1632 } | 610 } |
| 1633 | 611 |
| 1634 std::string GpuControlList::version() const { | 612 std::string GpuControlList::version() const { |
| 1635 return version_; | 613 return version_; |
| 1636 } | 614 } |
| 1637 | 615 |
| 616 // static |
| 1638 GpuControlList::OsType GpuControlList::GetOsType() { | 617 GpuControlList::OsType GpuControlList::GetOsType() { |
| 1639 #if defined(OS_CHROMEOS) | 618 #if defined(OS_CHROMEOS) |
| 1640 return kOsChromeOS; | 619 return kOsChromeOS; |
| 1641 #elif defined(OS_WIN) | 620 #elif defined(OS_WIN) |
| 1642 return kOsWin; | 621 return kOsWin; |
| 1643 #elif defined(OS_ANDROID) | 622 #elif defined(OS_ANDROID) |
| 1644 return kOsAndroid; | 623 return kOsAndroid; |
| 1645 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 624 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
| 1646 return kOsLinux; | 625 return kOsLinux; |
| 1647 #elif defined(OS_MACOSX) | 626 #elif defined(OS_MACOSX) |
| 1648 return kOsMacosx; | 627 return kOsMacosx; |
| 1649 #else | 628 #else |
| 1650 return kOsUnknown; | 629 return kOsAny; |
| 1651 #endif | 630 #endif |
| 1652 } | 631 } |
| 1653 | 632 |
| 1654 void GpuControlList::Clear() { | |
| 1655 entries_.clear(); | |
| 1656 active_entries_.clear(); | |
| 1657 max_entry_id_ = 0; | |
| 1658 } | |
| 1659 | |
| 1660 // static | |
| 1661 GpuControlList::NumericOp GpuControlList::StringToNumericOp( | |
| 1662 const std::string& op) { | |
| 1663 if (op == "=") | |
| 1664 return kEQ; | |
| 1665 if (op == "<") | |
| 1666 return kLT; | |
| 1667 if (op == "<=") | |
| 1668 return kLE; | |
| 1669 if (op == ">") | |
| 1670 return kGT; | |
| 1671 if (op == ">=") | |
| 1672 return kGE; | |
| 1673 if (op == "any") | |
| 1674 return kAny; | |
| 1675 if (op == "between") | |
| 1676 return kBetween; | |
| 1677 return kUnknown; | |
| 1678 } | |
| 1679 | |
| 1680 void GpuControlList::AddSupportedFeature( | 633 void GpuControlList::AddSupportedFeature( |
| 1681 const std::string& feature_name, int feature_id) { | 634 const std::string& feature_name, int feature_id) { |
| 1682 feature_map_[feature_name] = feature_id; | 635 feature_map_[feature_id] = feature_name; |
| 1683 } | |
| 1684 | |
| 1685 void GpuControlList::set_supports_feature_type_all(bool supported) { | |
| 1686 supports_feature_type_all_ = supported; | |
| 1687 } | 636 } |
| 1688 | 637 |
| 1689 } // namespace gpu | 638 } // namespace gpu |
| 1690 | |
| OLD | NEW |