platforms/drm: Properly detect if there are no DRM devices

If no primary gpu can be found, we need to quit.
This commit is contained in:
Vlad Zahorodnii 2021-04-28 23:20:49 +03:00
parent 9f030ecd40
commit c4c46a089f

View file

@ -192,16 +192,17 @@ bool DrmBackend::initialize()
{
connect(session(), &Session::activeChanged, this, &DrmBackend::activate);
connect(session(), &Session::awoke, this, &DrmBackend::turnOutputsOn);
std::vector<UdevDevice::Ptr> devices = m_udev->listGPUs();
if (devices.size() == 0) {
qCWarning(KWIN_DRM) << "Did not find a GPU";
return false;
}
std::vector<UdevDevice::Ptr> devices = m_udev->listGPUs();
for (unsigned int gpu_index = 0; gpu_index < devices.size(); gpu_index++) {
addGpu(std::move(devices.at(gpu_index)));
}
if (m_gpus.isEmpty()) {
qCWarning(KWIN_DRM) << "No suitable DRM devices have been found";
return false;
}
initCursor();
if (!updateOutputs())
return false;