backends/drm: ensure pipeline mode is always in the connector mode list

The current mode of an output not being in its mode list can lead to crashes
This commit is contained in:
Xaver Hugl 2022-08-30 22:45:51 +02:00
parent a9d51ab2f3
commit e195d42916

View file

@ -321,10 +321,16 @@ bool DrmConnector::updateProperties()
m_modes.clear();
m_modes.append(m_driverModes);
m_modes.append(generateCommonModes());
if (!m_pipeline->mode()) {
if (m_pipeline->mode()) {
if (const auto mode = findMode(*m_pipeline->mode()->nativeMode())) {
m_pipeline->setMode(mode);
} else {
m_pipeline->setMode(m_modes.constFirst());
}
} else {
m_pipeline->setMode(m_modes.constFirst());
m_pipeline->applyPendingChanges();
}
m_pipeline->applyPendingChanges();
if (m_pipeline->output()) {
m_pipeline->output()->updateModes();
}