backends/drm: fix enabled+inactive check

When dpms disabled outputs get set active, they require a modeset. If after
that they are set inactive again without resetting the pipelines first,
they no longer require a modeset but still have the pending properties that
would enable a crtc - but without a framebuffer set.

To prevent this, first test the current setup as it is, and only then see
if the pipelines would work if enabled again.
This commit is contained in:
Xaver Hugl 2022-06-22 10:22:30 +02:00
parent 9dbd0c4b36
commit 6d9d4c190a

View file

@ -432,22 +432,22 @@ bool DrmGpu::testPendingConfiguration()
bool DrmGpu::testPipelines()
{
// pipelines that are enabled but not active need to be activated for the test
QVector<DrmPipeline *> inactivePipelines;
for (const auto &pipeline : qAsConst(m_pipelines)) {
if (!pipeline->active()) {
pipeline->setActive(true);
inactivePipelines << pipeline;
}
}
std::copy_if(m_pipelines.constBegin(), m_pipelines.constEnd(), std::back_inserter(inactivePipelines), [](const auto pipeline) {
return pipeline->enabled() && !pipeline->active();
});
const auto unused = unusedObjects();
bool test = DrmPipeline::commitPipelines(m_pipelines, DrmPipeline::CommitMode::Test, unused);
// disable inactive pipelines again
for (const auto &pipeline : qAsConst(inactivePipelines)) {
pipeline->setActive(false);
}
if (!inactivePipelines.isEmpty() && test) {
// ensure that pipelines that are set as enabled but currently inactive
// still work when they need to be set active again
for (const auto pipeline : qAsConst(inactivePipelines)) {
pipeline->setActive(true);
}
test = DrmPipeline::commitPipelines(m_pipelines, DrmPipeline::CommitMode::Test, unused);
for (const auto pipeline : qAsConst(inactivePipelines)) {
pipeline->setActive(false);
}
}
return test;
}