From 8d0854c2bd7cf371883726cacb3f8c8549a11eac Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 15:51:47 +0100 Subject: [PATCH] eglfs: allow forcing an explicit connector index on DRM/KMS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a QT_QPA_EGLFS_KMS_CONNECTOR_INDEX environment variable that applies both to the GBM and EGLDevice backends. Instead of specifying all uninteresting outputs as "off" in the config file in QT_QPA_EGLFS_KMS_CONFIG, this variable provides a shortcut to force one single connector and ignore all others in embedded systems with a fixed connector configuration. The index must be between 0 and DRM connector count - 1. Task-number: QTBUG-57386 Change-Id: I3f9562f48bf6b2ffaf9a0cc232e09a7e0c15645b Reviewed-by: Pasi Petäjäjärvi --- .../eglfs_kms_support/qeglfskmsdevice.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index f6b58d1ba6..b3c1fbb1bd 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -399,7 +399,20 @@ void QEglFSKmsDevice::createScreens() QVector screens; + int wantedConnectorIndex = -1; + bool ok; + int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_CONNECTOR_INDEX", &ok); + if (ok) { + if (idx >= 0 && idx < resources->count_connectors) + wantedConnectorIndex = idx; + else + qWarning("Invalid connector index %d", idx); + } + for (int i = 0; i < resources->count_connectors; i++) { + if (wantedConnectorIndex >= 0 && i != wantedConnectorIndex) + continue; + drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]); if (!connector) continue;