Bug 1717857 - Detect more multi-GPU cases via PCI in GfxInfo,r=aosmond

This improves handling of:
 - multiple GPUs of the same vendor
 - multiple GPUs with the same device ID
 - using mesa software drivers despite a GPU being detected via PCI

Differential Revision: https://phabricator.services.mozilla.com/D118604
This commit is contained in:
Robert Mader 2021-06-23 21:25:23 +00:00
Родитель 5929313fb7
Коммит 482c419e44
1 изменённых файлов: 20 добавлений и 6 удалений

Просмотреть файл

@ -313,6 +313,14 @@ void GfxInfo::GetData() {
if (!mesaDevice.IsEmpty()) {
mDeviceId = mesaDevice;
}
if (!mIsAccelerated && mVendorId.IsEmpty()) {
mVendorId.Assign(glVendor.get());
}
if (!mIsAccelerated && mDeviceId.IsEmpty()) {
mDeviceId.Assign(glRenderer.get());
}
} else if (glVendor.EqualsLiteral("NVIDIA Corporation")) {
CopyUTF16toUTF8(GfxDriverInfo::GetDeviceVendor(DeviceVendor::NVIDIA),
mVendorId);
@ -394,13 +402,19 @@ void GfxInfo::GetData() {
// If we still don't have a vendor ID, we can try the PCI vendor list.
if (mVendorId.IsEmpty()) {
if (pciVendors.Length() == 1) {
mVendorId = pciVendors[0];
} else if (pciVendors.IsEmpty()) {
if (pciVendors.IsEmpty()) {
gfxCriticalNote << "No GPUs detected via PCI";
} else {
gfxCriticalNote
<< "More than 1 GPU detected via PCI, cannot deduce vendor";
for (size_t i = 0; i < pciVendors.Length(); ++i) {
if (mVendorId.IsEmpty()) {
mVendorId = pciVendors[i];
} else if (mVendorId != pciVendors[i]) {
gfxCriticalNote << "More than 1 GPU vendor detected via PCI, cannot "
"deduce vendor";
mVendorId.Truncate();
break;
}
}
}
}
@ -411,7 +425,7 @@ void GfxInfo::GetData() {
if (mVendorId.Equals(pciVendors[i])) {
if (mDeviceId.IsEmpty()) {
mDeviceId = pciDevices[i];
} else {
} else if (mDeviceId != pciDevices[i]) {
gfxCriticalNote << "More than 1 GPU from same vendor detected via "
"PCI, cannot deduce device";
mDeviceId.Truncate();