summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-09-07 17:44:59 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2017-09-19 09:21:46 +0000
commit92730445675d4cd71bf5589bd9add8da121de6d4 (patch)
treeb37e907d73fa81f732e6d1fc3c7b04b20a2c8f70 /src
parentd6c828c65a5ff4b768491e9cc0a115c70ec38a44 (diff)
kms: Fix crtc allocation logic
The intention of choosing a different CRTC for each connector is fine, but the code is flawed: the bitmask thas marks used crtc must be based on the crtc index, not the id. In practice the fix makes a difference only when multiple connectors are in use and there are crtc ids above 31. Task-number: QTBUG-63058 Change-Id: I74e01add72df9c6e0b8fbddab978c102573a282c Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp8
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice_p.h1
2 files changed, 6 insertions, 3 deletions
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index 494640b858..e1f2459bc0 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -75,7 +75,7 @@ int QKmsDevice::crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr co
for (int j = 0; j < resources->count_crtcs; j++) {
bool isPossible = possibleCrtcs & (1 << j);
- bool isAvailable = !(m_crtc_allocator & 1 << resources->crtcs[j]);
+ bool isAvailable = !(m_crtc_allocator & (1 << j));
if (isPossible && isAvailable)
return j;
@@ -245,7 +245,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
QList<drmModeModeInfo> modes;
modes.reserve(connector->count_modes);
- qCDebug(qLcKmsDebug) << connectorName << "mode count:" << connector->count_modes;
+ qCDebug(qLcKmsDebug) << connectorName << "mode count:" << connector->count_modes
+ << "crtc index:" << crtc << "crtc id:" << crtc_id;
for (int i = 0; i < connector->count_modes; i++) {
const drmModeModeInfo &mode = connector->modes[i];
qCDebug(qLcKmsDebug) << "mode" << i << mode.hdisplay << "x" << mode.vdisplay
@@ -366,6 +367,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
QKmsOutput output;
output.name = QString::fromUtf8(connectorName);
output.connector_id = connector->connector_id;
+ output.crtc_index = crtc;
output.crtc_id = crtc_id;
output.physical_size = physSize;
output.preferred_mode = preferred >= 0 ? preferred : selected_mode;
@@ -402,7 +404,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
}
}
- m_crtc_allocator |= (1 << output.crtc_id);
+ m_crtc_allocator |= (1 << output.crtc_index);
vinfo->output = output;
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
index b253cced3c..872104e49d 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h
+++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
@@ -103,6 +103,7 @@ struct QKmsOutput
{
QString name;
uint32_t connector_id = 0;
+ uint32_t crtc_index = 0;
uint32_t crtc_id = 0;
QSizeF physical_size;
int preferred_mode = -1; // index of preferred mode in list below