Commit 97f45b7b by Ian Elliott Committed by Commit Bot

Add Android-specific version struct to GetSystemInfo results.

Bug: angleproject:2749 Change-Id: Ie8fdb67918ea1c1054527fe1e0c1be4054fe9cb3 Reviewed-on: https://chromium-review.googlesource.com/1154189Reviewed-by: 's avatarIan Elliott <ianelliott@google.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Ian Elliott <ianelliott@google.com>
parent 8acb1b61
...@@ -19,6 +19,14 @@ namespace angle ...@@ -19,6 +19,14 @@ namespace angle
using VendorID = uint32_t; using VendorID = uint32_t;
using DeviceID = uint32_t; using DeviceID = uint32_t;
struct VersionInfo
{
uint32_t major = 0;
uint32_t minor = 0;
uint32_t subMinor = 0;
uint32_t patch = 0;
};
struct GPUDeviceInfo struct GPUDeviceInfo
{ {
GPUDeviceInfo(); GPUDeviceInfo();
...@@ -32,6 +40,9 @@ struct GPUDeviceInfo ...@@ -32,6 +40,9 @@ struct GPUDeviceInfo
std::string driverVendor; std::string driverVendor;
std::string driverVersion; std::string driverVersion;
std::string driverDate; std::string driverDate;
// Only available on Android
VersionInfo detailedDriverVersion;
}; };
struct SystemInfo struct SystemInfo
......
...@@ -135,13 +135,15 @@ bool GetSystemInfo(SystemInfo *info) ...@@ -135,13 +135,15 @@ bool GetSystemInfo(SystemInfo *info)
return false; return false;
} }
std::vector<VkPhysicalDevice> physicalDevices(physicalDeviceCount); std::vector<VkPhysicalDevice> physicalDevices(physicalDeviceCount);
info->gpus.resize(physicalDeviceCount);
if (pfnEnumeratePhysicalDevices(instance, &physicalDeviceCount, physicalDevices.data()) != if (pfnEnumeratePhysicalDevices(instance, &physicalDeviceCount, physicalDevices.data()) !=
VK_SUCCESS) VK_SUCCESS)
{ {
return false; return false;
} }
// If we get to here, we will likely provide a valid answer (unless an unknown vendorID):
info->gpus.resize(physicalDeviceCount);
for (uint32_t i = 0; i < physicalDeviceCount; i++) for (uint32_t i = 0; i < physicalDeviceCount; i++)
{ {
VkPhysicalDeviceProperties properties; VkPhysicalDeviceProperties properties;
...@@ -159,18 +161,22 @@ bool GetSystemInfo(SystemInfo *info) ...@@ -159,18 +161,22 @@ bool GetSystemInfo(SystemInfo *info)
case kVendorID_AMD: case kVendorID_AMD:
gpu.driverVendor = "Advanced Micro Devices, Inc"; gpu.driverVendor = "Advanced Micro Devices, Inc";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
case kVendorID_ARM: case kVendorID_ARM:
gpu.driverVendor = "Arm Holdings"; gpu.driverVendor = "Arm Holdings";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
case kVendorID_ImgTec: case kVendorID_ImgTec:
gpu.driverVendor = "Imagination Technologies Limited"; gpu.driverVendor = "Imagination Technologies Limited";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
case kVendorID_Intel: case kVendorID_Intel:
gpu.driverVendor = "Intel Corporation"; gpu.driverVendor = "Intel Corporation";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
case kVendorID_Nvidia: case kVendorID_Nvidia:
gpu.driverVendor = "NVIDIA Corporation"; gpu.driverVendor = "NVIDIA Corporation";
...@@ -178,6 +184,10 @@ bool GetSystemInfo(SystemInfo *info) ...@@ -178,6 +184,10 @@ bool GetSystemInfo(SystemInfo *info)
(properties.driverVersion >> 14) & 0XFF, (properties.driverVersion >> 14) & 0XFF,
(properties.driverVersion >> 6) & 0XFF, (properties.driverVersion >> 6) & 0XFF,
properties.driverVersion & 0x3F); properties.driverVersion & 0x3F);
gpu.detailedDriverVersion.major = properties.driverVersion >> 22;
gpu.detailedDriverVersion.minor = (properties.driverVersion >> 14) & 0xFF;
gpu.detailedDriverVersion.subMinor = (properties.driverVersion >> 6) & 0xFF;
gpu.detailedDriverVersion.patch = properties.driverVersion & 0x3F;
break; break;
case kVendorID_Qualcomm: case kVendorID_Qualcomm:
gpu.driverVendor = "Qualcomm Technologies, Inc"; gpu.driverVendor = "Qualcomm Technologies, Inc";
...@@ -186,23 +196,30 @@ bool GetSystemInfo(SystemInfo *info) ...@@ -186,23 +196,30 @@ bool GetSystemInfo(SystemInfo *info)
gpu.driverVersion = FormatString("%d.%d.%d", properties.driverVersion >> 22, gpu.driverVersion = FormatString("%d.%d.%d", properties.driverVersion >> 22,
(properties.driverVersion >> 12) & 0X3FF, (properties.driverVersion >> 12) & 0X3FF,
properties.driverVersion & 0xFFF); properties.driverVersion & 0xFFF);
gpu.detailedDriverVersion.major = properties.driverVersion >> 22;
gpu.detailedDriverVersion.minor = (properties.driverVersion >> 12) & 0x3FF;
gpu.detailedDriverVersion.subMinor = properties.driverVersion & 0xFFF;
} }
else else
{ {
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
} }
break; break;
case kVendorID_Vivante: case kVendorID_Vivante:
gpu.driverVendor = "Vivante"; gpu.driverVendor = "Vivante";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
case kVendorID_VeriSilicon: case kVendorID_VeriSilicon:
gpu.driverVendor = "VeriSilicon"; gpu.driverVendor = "VeriSilicon";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
case kVendorID_Kazan: case kVendorID_Kazan:
gpu.driverVendor = "Kazan Software"; gpu.driverVendor = "Kazan Software";
gpu.driverVersion = FormatString("0x%x", properties.driverVersion); gpu.driverVersion = FormatString("0x%x", properties.driverVersion);
gpu.detailedDriverVersion.major = properties.driverVersion;
break; break;
default: default:
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment