summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/kmsconvenience/qkmsdevice.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-11-07 17:03:34 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-11-11 16:39:25 +0100
commit32d8f5310bffdeae30a500e2c0d6bbb59d795f0c (patch)
tree03bce9fc53dddcdc44a3b18f22b1c83e97a6dc20 /src/platformsupport/kmsconvenience/qkmsdevice.cpp
parente927d834071d1ba06a652b685866bc6377da4490 (diff)
eglfs: kms: Allow overriding plane ids per crtc
With atomic enabled (QT_QPA_EGLFS_KMS_ATOMIC=1) the plane chosen for a crtc becomes important. The current logic is pretty broken when there are multiple planes available with many of them marked as being supported by multiple CRTCs. Choosing the same plane for multiple crtcs results in failing the atomic commit. This happens with a RPi4 with two screens connected, for example. (because there are 2*3 planes: one primary, one overlay, one cursor for each screen, but Qt is trying to use the same primary plane with both CRTCs) The issue does not surface in special environments where there is one (dedicated) plane per crtc exposed by drm, but becomes apparent on a PC or on the RPi where the setup described above is the common case. As a temporary solution allow doing the following: export QT_QPA_EGLFS_KMS_PLANES_FOR_CRTCS="49,28:78,57" This would then force using plane id 28 for crtc id 49, and plane id 57 for crtc id 78. (the ids can be discovered either from the eglfs debug logs, or by checking /sys/kernel/debug/dri/<N>/state) This is to be complemented with a fix for picking a unique primary plane for all CRTCs but that's going to be a separate patch. Allowing a manual override is important regardless since it helps troubleshooting. Task-number: QTBUG-74953 Change-Id: Ie03f80dac31813f2c4489235d435769dd3d3883e Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/platformsupport/kmsconvenience/qkmsdevice.cpp')
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 6121faf362..263c02682d 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -490,8 +490,30 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
}
}
- if (output.eglfs_plane)
- qCDebug(qLcKmsDebug, "Output eglfs plane is: %d", output.eglfs_plane->id);
+ // A more useful version: allows specifying "crtc_id,plane_id:crtc_id,plane_id:..."
+ // in order to allow overriding the plane used for a given crtc.
+ if (qEnvironmentVariableIsSet("QT_QPA_EGLFS_KMS_PLANES_FOR_CRTCS")) {
+ const QString val = qEnvironmentVariable("QT_QPA_EGLFS_KMS_PLANES_FOR_CRTCS");
+ qCDebug(qLcKmsDebug, "crtc_id:plane_id override list: %s", qPrintable(val));
+ const QStringList crtcPlanePairs = val.split(QLatin1Char(':'));
+ for (const QString &crtcPlanePair : crtcPlanePairs) {
+ const QStringList values = crtcPlanePair.split(QLatin1Char(','));
+ if (values.count() == 2 && uint(values[0].toInt()) == output.crtc_id) {
+ uint planeId = values[1].toInt();
+ for (const QKmsPlane &kmsplane : qAsConst(m_planes)) {
+ if (kmsplane.id == planeId) {
+ output.eglfs_plane = (QKmsPlane*)&kmsplane;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if (output.eglfs_plane) {
+ qCDebug(qLcKmsDebug, "Chose plane %u for output %s (crtc id %u) (may not be applicable)",
+ output.eglfs_plane->id, connectorName.constData(), output.crtc_id);
+ }
m_crtc_allocator |= (1 << output.crtc_index);