From 16d0d1c942bcab1e5d24278f26b9df856b2a96d4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 29 Jan 2016 16:03:14 +0100 Subject: [PATCH] egldevice: Add a way to force mode setting Normally setting the mode again and again on each application startup is not desirable as it takes time and considerably affects the application startup experience. However, in some cases (like shutting down the X server) the output gets powered down and there seems to be no way to detect this. Here setting the mode again becomes necessary. Until there is a better solution, add an environment variable QT_QPA_EGLFS_ALWAYS_SET_MODE which, upon a non-zero value, leads to always calling drmModeSetCrtc. The issue is not specific to Qt, the same is visible with the NV examples as they try to minimize redundant mode set calls in the same manner. Change-Id: If2b5e3fda74e077a747dd03cee65c936560a5026 Reviewed-by: Louai Al-Khanji --- .../qeglfskmsegldeviceintegration.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index f7450708ab..5c7b9fe96d 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -301,8 +301,13 @@ void QEglFSKmsEglDeviceIntegration::waitForVSync(QPlatformSurface *) const if (currentMode) drmModeFreeCrtc(currentMode); if (alreadySet) { - qCDebug(qLcEglfsKmsDebug, "Mode already set"); - return; + // Maybe detecting the DPMS mode could help here, but there are no properties + // exposed on the connector apparently. So rely on an env var for now. + static bool alwaysDoSet = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ALWAYS_SET_MODE"); + if (!alwaysDoSet) { + qCDebug(qLcEglfsKmsDebug, "Mode already set"); + return; + } } qCDebug(qLcEglfsKmsDebug, "Setting mode");