prevent the primaryGpu is a usb device in multi-gpu scenes
if usb device is the primaryGpu, the device unplug kwin_wayland exit ` } else if (device->action() == QStringLiteral("remove")) { DrmGpu *gpu = findGpu(device->devNum()); if (gpu) { if (primaryGpu() == gpu) { qCCritical(KWIN_DRM) << "Primary gpu has been removed! Quitting..."; QCoreApplication::exit(1); return; } else { gpu->setRemoved(); updateOutputs(); } }`
This commit is contained in:
parent
6df5b0297d
commit
1502fa9ab1
2 changed files with 16 additions and 0 deletions
|
@ -126,6 +126,15 @@ std::vector<UdevDevice::Ptr> Udev::listGPUs()
|
||||||
enumerate.scan();
|
enumerate.scan();
|
||||||
auto vect = enumerate.find();
|
auto vect = enumerate.find();
|
||||||
std::sort(vect.begin(), vect.end(), [](const UdevDevice::Ptr &device1, const UdevDevice::Ptr &device2) {
|
std::sort(vect.begin(), vect.end(), [](const UdevDevice::Ptr &device1, const UdevDevice::Ptr &device2) {
|
||||||
|
// prevent usb devices from becoming the primaryGpu
|
||||||
|
if (device1->isHotpluggable()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (device2->isHotpluggable()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// if set as boot GPU, prefer 1
|
// if set as boot GPU, prefer 1
|
||||||
if (device1->isBootVga()) {
|
if (device1->isBootVga()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -231,6 +240,12 @@ QString UdevDevice::action() const
|
||||||
return QString::fromLocal8Bit(udev_device_get_action(m_device));
|
return QString::fromLocal8Bit(udev_device_get_action(m_device));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UdevDevice::isHotpluggable() const
|
||||||
|
{
|
||||||
|
QString devPath = QString::fromUtf8(udev_device_get_devpath(m_device));
|
||||||
|
return devPath.toLower().contains("usb");
|
||||||
|
}
|
||||||
|
|
||||||
UdevMonitor::UdevMonitor(Udev *udev)
|
UdevMonitor::UdevMonitor(Udev *udev)
|
||||||
: m_monitor(udev_monitor_new_from_netlink(*udev, "udev"))
|
: m_monitor(udev_monitor_new_from_netlink(*udev, "udev"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@ public:
|
||||||
QMap<QByteArray, QByteArray> properties() const;
|
QMap<QByteArray, QByteArray> properties() const;
|
||||||
bool isBootVga() const;
|
bool isBootVga() const;
|
||||||
QString seat() const;
|
QString seat() const;
|
||||||
|
bool isHotpluggable() const;
|
||||||
|
|
||||||
operator udev_device *() const
|
operator udev_device *() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue