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 <louai.al-khanji@theqtcompany.com>
This commit is contained in:
Laszlo Agocs 2016-01-29 16:03:14 +01:00
parent f83816ec4f
commit 16d0d1c942

View File

@ -301,9 +301,14 @@ void QEglFSKmsEglDeviceIntegration::waitForVSync(QPlatformSurface *) const
if (currentMode)
drmModeFreeCrtc(currentMode);
if (alreadySet) {
// 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");
int ret = drmModeSetCrtc(m_dri_fd, m_drm_crtc,