egldevice: allow DRM device path to be overridden

The backend-provided DRM device might not be the right one,
so allow kms config to override it.

Pick-to: 6.9 6.8
Task-number: QTBUG-131887
Change-Id: Ied744ae7015eae64f4556f1528e0dbe8ae69d206
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
This commit is contained in:
Samuli Piippo 2024-12-09 11:12:02 +02:00
parent 11d6200d8a
commit c3bbbb22b8

View File

@ -225,11 +225,18 @@ QKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice()
if (Q_UNLIKELY(!query_egl_device()))
qFatal("Could not set up EGL device!");
const char *deviceName = m_funcs->query_device_string(m_egl_device, EGL_DRM_DEVICE_FILE_EXT);
if (Q_UNLIKELY(!deviceName))
qFatal("Failed to query device name from EGLDevice");
QString path = screenConfig()->devicePath();
if (!path.isEmpty()) {
qCDebug(qLcEglfsKmsDebug) << "EGLDevice: Using DRM device" << path
<< "specified in config file";
} else {
path = QLatin1StringView(
m_funcs->query_device_string(m_egl_device, EGL_DRM_DEVICE_FILE_EXT));
if (Q_UNLIKELY(path.isEmpty()))
qFatal("Failed to query device name from EGLDevice");
}
return new QEglFSKmsEglDevice(this, screenConfig(), QLatin1StringView(deviceName));
return new QEglFSKmsEglDevice(this, screenConfig(), path);
}
bool QEglFSKmsEglDeviceIntegration::query_egl_device()