platforms/drm: do not try to use the GPU card node

On some devices, the GPU nodes are also added as /dev/dri/cardX, they
are not useful for KMS purposes and does not have display resources.
If we encounter such cards, then skip them.
This commit is contained in:
Bhushan Shah 2020-10-13 22:39:29 +05:30
parent c586a2551e
commit d9d1c976cd

View file

@ -250,6 +250,17 @@ void DrmBackend::openDrm()
qCWarning(KWIN_DRM) << "failed to open drm device at" << devNode;
return;
}
// try to make a simple drm get resource call, if it fails it is not useful for us
drmModeRes *resources = drmModeGetResources(fd);
if (!resources) {
qCDebug(KWIN_DRM) << "Skipping KMS incapable drm device node at" << devNode;
drmModeFreeResources(resources);
LogindIntegration::self()->releaseDevice(fd);
continue;
}
drmModeFreeResources(resources);
m_active = true;
QSocketNotifier *notifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
connect(notifier, &QSocketNotifier::activated, this,