Drop check for if parent subsystem is PCI
This check is completely wrong for mobile GPUs where GPU are internal and are not attached through PCI subsystem, P: /devices/platform/display-engine/drm/card1 N: dri/card1 L: 0 S: dri/by-path/platform-display-engine-card E: DEVPATH=/devices/platform/display-engine/drm/card1 E: DEVNAME=/dev/dri/card1 E: DEVTYPE=drm_minor E: MAJOR=226 E: MINOR=1 E: SUBSYSTEM=drm E: USEC_INITIALIZED=4239383 E: ID_PATH=platform-display-engine E: ID_PATH_TAG=platform-display-engine E: ID_FOR_SEAT=drm-platform-display-engine E: DEVLINKS=/dev/dri/by-path/platform-display-engine-card E: TAGS=:master-of-seat:seat:uaccess: For example, on A64 platform, the KMS capable card is card1 which is not attached with PCI.
This commit is contained in:
parent
0ef272bc21
commit
c586a2551e
1 changed files with 25 additions and 16 deletions
41
udev.cpp
41
udev.cpp
|
@ -114,8 +114,7 @@ std::vector<UdevDevice::Ptr> UdevEnumerate::find()
|
|||
if (deviceSeat != LogindIntegration::self()->seat()) {
|
||||
continue;
|
||||
}
|
||||
if (device->getParentWithSubsystemDevType("pci"))
|
||||
vect.push_back(std::move(device));
|
||||
vect.push_back(std::move(device));
|
||||
}
|
||||
return vect;
|
||||
}
|
||||
|
@ -140,17 +139,22 @@ std::vector<UdevDevice::Ptr> Udev::listGPUs()
|
|||
std::sort(vect.begin(), vect.end(), [](const UdevDevice::Ptr &device1, const UdevDevice::Ptr &device2) {
|
||||
auto pci1 = device1->getParentWithSubsystemDevType("pci");
|
||||
auto pci2 = device2->getParentWithSubsystemDevType("pci");
|
||||
const char *systAttrValue;
|
||||
// if set as boot GPU, prefer 1
|
||||
const char *systAttrValue = udev_device_get_sysattr_value(pci1, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return true;
|
||||
if (pci1) {
|
||||
systAttrValue = udev_device_get_sysattr_value(pci1, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// if set as boot GPU, prefer 2
|
||||
systAttrValue = udev_device_get_sysattr_value(pci2, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return false;
|
||||
if (pci2) {
|
||||
systAttrValue = udev_device_get_sysattr_value(pci2, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return udev_device_get_sysnum(pci1) > udev_device_get_sysnum(pci2);
|
||||
return true;
|
||||
});
|
||||
return vect;
|
||||
#endif
|
||||
|
@ -171,17 +175,22 @@ std::vector<UdevDevice::Ptr> Udev::listFramebuffers()
|
|||
std::sort(vect.begin(), vect.end(), [](const UdevDevice::Ptr &device1, const UdevDevice::Ptr &device2) {
|
||||
auto pci1 = device1->getParentWithSubsystemDevType("pci");
|
||||
auto pci2 = device2->getParentWithSubsystemDevType("pci");
|
||||
const char *systAttrValue;
|
||||
// if set as boot GPU, prefer 1
|
||||
const char *systAttrValue = udev_device_get_sysattr_value(pci1, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return true;
|
||||
if (pci1) {
|
||||
systAttrValue = udev_device_get_sysattr_value(pci1, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// if set as boot GPU, prefer 2
|
||||
systAttrValue = udev_device_get_sysattr_value(pci2, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return false;
|
||||
if (pci2) {
|
||||
systAttrValue = udev_device_get_sysattr_value(pci2, "boot_vga");
|
||||
if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return udev_device_get_sysnum(pci1) > udev_device_get_sysnum(pci2);
|
||||
return true;
|
||||
});
|
||||
return vect;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue