Commit 868a41e9 by Drew Davenport Committed by Commit Bot

Query revision id for GPU devices

Add revisionID to GpuDeviceInfo and populate it through libpci. Bug: b/170372516 Change-Id: I0953ba5dfc7d973c7b7216d942952a3ffd908bcb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2703734Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 33907625
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
namespace angle namespace angle
{ {
using VendorID = uint32_t; using VendorID = uint32_t;
using DeviceID = uint32_t; using DeviceID = uint32_t;
using RevisionID = uint32_t;
struct VersionInfo struct VersionInfo
{ {
...@@ -34,8 +35,9 @@ struct GPUDeviceInfo ...@@ -34,8 +35,9 @@ struct GPUDeviceInfo
GPUDeviceInfo(const GPUDeviceInfo &other); GPUDeviceInfo(const GPUDeviceInfo &other);
VendorID vendorId = 0; VendorID vendorId = 0;
DeviceID deviceId = 0; DeviceID deviceId = 0;
RevisionID revisionId = 0;
std::string driverVendor; std::string driverVendor;
std::string driverVersion; std::string driverVersion;
......
...@@ -56,7 +56,9 @@ struct LibPCI : private angle::NonCopyable ...@@ -56,7 +56,9 @@ struct LibPCI : private angle::NonCopyable
(FillInfo = reinterpret_cast<decltype(FillInfo)>(dlsym(mHandle, "pci_fill_info"))) != (FillInfo = reinterpret_cast<decltype(FillInfo)>(dlsym(mHandle, "pci_fill_info"))) !=
nullptr && nullptr &&
(LookupName = reinterpret_cast<decltype(LookupName)>( (LookupName = reinterpret_cast<decltype(LookupName)>(
dlsym(mHandle, "pci_lookup_name"))) != nullptr; dlsym(mHandle, "pci_lookup_name"))) != nullptr &&
(PCIReadByte = reinterpret_cast<decltype(PCIReadByte)>(
dlsym(mHandle, "pci_read_byte"))) != nullptr;
} }
bool IsValid() const { return mValid; } bool IsValid() const { return mValid; }
...@@ -75,6 +77,7 @@ struct LibPCI : private angle::NonCopyable ...@@ -75,6 +77,7 @@ struct LibPCI : private angle::NonCopyable
decltype(&::pci_scan_bus) ScanBus = nullptr; decltype(&::pci_scan_bus) ScanBus = nullptr;
decltype(&::pci_fill_info) FillInfo = nullptr; decltype(&::pci_fill_info) FillInfo = nullptr;
decltype(&::pci_lookup_name) LookupName = nullptr; decltype(&::pci_lookup_name) LookupName = nullptr;
decltype(&::pci_read_byte) PCIReadByte = nullptr;
private: private:
void *mHandle = nullptr; void *mHandle = nullptr;
...@@ -119,8 +122,9 @@ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices) ...@@ -119,8 +122,9 @@ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices)
} }
GPUDeviceInfo info; GPUDeviceInfo info;
info.vendorId = device->vendor_id; info.vendorId = device->vendor_id;
info.deviceId = device->device_id; info.deviceId = device->device_id;
info.revisionId = pci.PCIReadByte(device, PCI_REVISION_ID);
devices->push_back(info); devices->push_back(info);
} }
......
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