10 #include <unordered_map>
12 #include "flutter/fml/build_config.h"
110 auto paren_pos = version.find(
"Adreno (TM) ");
111 if (paren_pos == std::string::npos) {
114 auto version_string = version.substr(paren_pos + 12);
119 return result->second;
124 auto dash_pos = version.find(
"Mali-");
125 if (dash_pos == std::string::npos) {
128 auto version_string_with_trailing = version.substr(dash_pos + 5);
130 auto more_dash_pos = version_string_with_trailing.find(
"-");
131 if (more_dash_pos != std::string::npos) {
132 version_string_with_trailing =
133 version_string_with_trailing.substr(0, more_dash_pos);
136 const auto& result =
kMaliVersions.find(version_string_with_trailing);
140 return result->second;
172 case VK_VENDOR_ID_MESA:
191 return "ImgTec PowerVR";
213 return "Integrated GPU";
215 return "Discrete GPU";
217 return "Virtual GPU";
226 case vk::PhysicalDeviceType::eOther:
228 case vk::PhysicalDeviceType::eIntegratedGpu:
230 case vk::PhysicalDeviceType::eDiscreteGpu:
232 case vk::PhysicalDeviceType::eVirtualGpu:
234 case vk::PhysicalDeviceType::eCpu:
242 auto props = device.getProperties();
243 api_version_ =
Version{VK_API_VERSION_MAJOR(props.apiVersion),
244 VK_API_VERSION_MINOR(props.apiVersion),
245 VK_API_VERSION_PATCH(props.apiVersion)};
248 FML_LOG(WARNING) <<
"Unknown GPU Driver Vendor: " << props.vendorID
249 <<
". This is not an error.";
252 if (props.deviceName.data() !=
nullptr) {
253 driver_name_ = props.deviceName.data();
287 std::vector<std::pair<std::string, std::string>> items;
288 items.emplace_back(
"Name", driver_name_);
289 items.emplace_back(
"API Version", api_version_.
ToString());
292 items.emplace_back(
"Is Emulator", std::to_string(
IsEmulator()));
296 for (
const auto& item : items) {
302 std::stringstream stream;
306 stream <<
"--- Driver Information ------------------------------------------";
310 for (
const auto& item : items) {
311 stream <<
"| " << std::setw(
static_cast<int>(
padding)) << item.first
312 << std::setw(0) <<
": " << item.second << std::endl;
315 stream <<
"-----------------------------------------------------------------";
317 FML_LOG(IMPORTANT) << stream.str();
324 driver_name_.find(
"SwiftShader") != std::string::npos) {
327 #endif // FML_OS_ANDROID
332 if (adreno_gpu_.has_value()) {