| 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> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 entry->SetDirectRenderingInfo(direct_rendering); | 738 entry->SetDirectRenderingInfo(direct_rendering); |
| 739 dictionary_entry_count++; | 739 dictionary_entry_count++; |
| 740 } | 740 } |
| 741 | 741 |
| 742 bool in_process_gpu; | 742 bool in_process_gpu; |
| 743 if (value->GetBoolean("in_process_gpu", &in_process_gpu)) { | 743 if (value->GetBoolean("in_process_gpu", &in_process_gpu)) { |
| 744 entry->SetInProcessGPUInfo(in_process_gpu); | 744 entry->SetInProcessGPUInfo(in_process_gpu); |
| 745 dictionary_entry_count++; | 745 dictionary_entry_count++; |
| 746 } | 746 } |
| 747 | 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 |
| 748 if (top_level) { | 768 if (top_level) { |
| 749 const base::ListValue* feature_value = NULL; | 769 const base::ListValue* feature_value = NULL; |
| 750 if (value->GetList("features", &feature_value)) { | 770 if (value->GetList("features", &feature_value)) { |
| 751 std::vector<std::string> feature_list; | 771 std::vector<std::string> feature_list; |
| 752 std::vector<std::string> feature_exception_list; | 772 std::vector<std::string> feature_exception_list; |
| 753 for (size_t i = 0; i < feature_value->GetSize(); ++i) { | 773 for (size_t i = 0; i < feature_value->GetSize(); ++i) { |
| 754 std::string feature; | 774 std::string feature; |
| 755 const base::DictionaryValue* features_info_value = NULL; | 775 const base::DictionaryValue* features_info_value = NULL; |
| 756 if (feature_value->GetString(i, &feature)) { | 776 if (feature_value->GetString(i, &feature)) { |
| 757 feature_list.push_back(feature); | 777 feature_list.push_back(feature); |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 features_.clear(); | 1079 features_.clear(); |
| 1060 return false; | 1080 return false; |
| 1061 } | 1081 } |
| 1062 if (std::find(exception_strings.begin(), exception_strings.end(), | 1082 if (std::find(exception_strings.begin(), exception_strings.end(), |
| 1063 feature_strings[i]) == exception_strings.end()) | 1083 feature_strings[i]) == exception_strings.end()) |
| 1064 features_.insert(feature); | 1084 features_.insert(feature); |
| 1065 } | 1085 } |
| 1066 return true; | 1086 return true; |
| 1067 } | 1087 } |
| 1068 | 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 |
| 1069 void GpuControlList::GpuControlListEntry::AddException( | 1098 void GpuControlList::GpuControlListEntry::AddException( |
| 1070 ScopedGpuControlListEntry exception) { | 1099 ScopedGpuControlListEntry exception) { |
| 1071 exceptions_.push_back(exception); | 1100 exceptions_.push_back(exception); |
| 1072 } | 1101 } |
| 1073 | 1102 |
| 1074 bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( | 1103 bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( |
| 1075 const std::string& gl_version) const { | 1104 const std::string& gl_version) const { |
| 1076 if (gl_version.empty()) | 1105 if (gl_version.empty()) |
| 1077 return false; | 1106 return false; |
| 1078 | 1107 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 !direct_rendering_info_->Contains(gpu_info.direct_rendering)) | 1338 !direct_rendering_info_->Contains(gpu_info.direct_rendering)) |
| 1310 return false; | 1339 return false; |
| 1311 if (in_process_gpu_info_.get() != NULL && | 1340 if (in_process_gpu_info_.get() != NULL && |
| 1312 !in_process_gpu_info_->Contains(gpu_info.in_process_gpu)) | 1341 !in_process_gpu_info_->Contains(gpu_info.in_process_gpu)) |
| 1313 return false; | 1342 return false; |
| 1314 if (!cpu_brand_.empty()) { | 1343 if (!cpu_brand_.empty()) { |
| 1315 base::CPU cpu_info; | 1344 base::CPU cpu_info; |
| 1316 if (StringMismatch(cpu_info.cpu_brand(), cpu_brand_)) | 1345 if (StringMismatch(cpu_info.cpu_brand(), cpu_brand_)) |
| 1317 return false; | 1346 return false; |
| 1318 } | 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 } |
| 1319 | 1352 |
| 1320 for (size_t i = 0; i < exceptions_.size(); ++i) { | 1353 for (size_t i = 0; i < exceptions_.size(); ++i) { |
| 1321 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && | 1354 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && |
| 1322 !exceptions_[i]->NeedsMoreInfo(gpu_info, true)) | 1355 !exceptions_[i]->NeedsMoreInfo(gpu_info, true)) |
| 1323 return false; | 1356 return false; |
| 1324 } | 1357 } |
| 1325 return true; | 1358 return true; |
| 1326 } | 1359 } |
| 1327 | 1360 |
| 1328 bool GpuControlList::GpuControlListEntry::NeedsMoreInfo( | 1361 bool GpuControlList::GpuControlListEntry::NeedsMoreInfo( |
| 1329 const GPUInfo& gpu_info, | 1362 const GPUInfo& gpu_info, |
| 1330 bool consider_exceptions) const { | 1363 bool consider_exceptions) const { |
| 1331 // We only check for missing info that might be collected with a gl context. | 1364 // We only check for missing info that might be collected with a gl context. |
| 1332 // If certain info is missing due to some error, say, we fail to collect | 1365 // If certain info is missing due to some error, say, we fail to collect |
| 1333 // vendor_id/device_id, then even if we launch GPU process and create a gl | 1366 // vendor_id/device_id, then even if we launch GPU process and create a gl |
| 1334 // context, we won't gather such missing info, so we still return false. | 1367 // context, we won't gather such missing info, so we still return false. |
| 1335 if (!driver_vendor_info_.empty() && gpu_info.driver_vendor.empty()) | 1368 if (!driver_vendor_info_.empty() && gpu_info.driver_vendor.empty()) |
| 1336 return true; | 1369 return true; |
| 1337 if (driver_version_info_.get() && gpu_info.driver_version.empty()) | 1370 if (driver_version_info_.get() && gpu_info.driver_version.empty()) |
| 1338 return true; | 1371 return true; |
| 1339 if ((gl_version_info_.get() || !gl_version_string_info_.empty()) && | 1372 if ((gl_version_info_.get() || !gl_version_string_info_.empty()) && |
| 1340 gpu_info.gl_version.empty()) { | 1373 gpu_info.gl_version.empty()) { |
| 1341 return true; | 1374 return true; |
| 1342 } | 1375 } |
| 1343 if (!gl_vendor_info_.empty() && gpu_info.gl_vendor.empty()) | 1376 if (!gl_vendor_info_.empty() && gpu_info.gl_vendor.empty()) |
| 1344 return true; | 1377 return true; |
| 1345 if (!gl_renderer_info_.empty() && gpu_info.gl_renderer.empty()) | 1378 if (!gl_renderer_info_.empty() && gpu_info.gl_renderer.empty()) |
| 1346 return true; | 1379 return true; |
| 1380 if (pixel_shader_version_info_.get() != NULL && |
| 1381 gpu_info.pixel_shader_version.empty()) |
| 1382 return true; |
| 1347 | 1383 |
| 1348 if (consider_exceptions) { | 1384 if (consider_exceptions) { |
| 1349 for (size_t i = 0; i < exceptions_.size(); ++i) { | 1385 for (size_t i = 0; i < exceptions_.size(); ++i) { |
| 1350 if (exceptions_[i]->NeedsMoreInfo(gpu_info, consider_exceptions)) | 1386 if (exceptions_[i]->NeedsMoreInfo(gpu_info, consider_exceptions)) |
| 1351 return true; | 1387 return true; |
| 1352 } | 1388 } |
| 1353 } | 1389 } |
| 1354 | 1390 |
| 1355 return false; | 1391 return false; |
| 1356 } | 1392 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 const std::string& feature_name, int feature_id) { | 1681 const std::string& feature_name, int feature_id) { |
| 1646 feature_map_[feature_name] = feature_id; | 1682 feature_map_[feature_name] = feature_id; |
| 1647 } | 1683 } |
| 1648 | 1684 |
| 1649 void GpuControlList::set_supports_feature_type_all(bool supported) { | 1685 void GpuControlList::set_supports_feature_type_all(bool supported) { |
| 1650 supports_feature_type_all_ = supported; | 1686 supports_feature_type_all_ = supported; |
| 1651 } | 1687 } |
| 1652 | 1688 |
| 1653 } // namespace gpu | 1689 } // namespace gpu |
| 1654 | 1690 |
| OLD | NEW |