eglfs: allow forcing an explicit connector index on DRM/KMS

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 <pasi.petajajarvi@qt.io>
This commit is contained in:
Laszlo Agocs 2016-12-01 15:51:47 +01:00
parent 09d481987b
commit 8d0854c2bd

View File

@ -399,7 +399,20 @@ void QEglFSKmsDevice::createScreens()
QVector<OrderedScreen> screens; QVector<OrderedScreen> 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++) { for (int i = 0; i < resources->count_connectors; i++) {
if (wantedConnectorIndex >= 0 && i != wantedConnectorIndex)
continue;
drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]); drmModeConnectorPtr connector = drmModeGetConnector(m_dri_fd, resources->connectors[i]);
if (!connector) if (!connector)
continue; continue;