backends/drm: Make drm backend not touch output configuration if all outputs are disabled

This behavior was added in order to fix a crash reported in bug report
442990. However, the analysis was not 100% correct, kwin failed to
create a placeholder because the relevant check was incorrect. The drm
backend was checking the list of all connected outputs rather than the
list with enabled outputs to decide whether to create a placeholder output.

As a safety measure the proposed behavior makes sense, however the drm
backend is not the right layer to implement it. If the last enabled
output is disconnected, kscreen should view it as a new output
setup and re-enable outputs in order to ask user what desired output
configuration should be.
This commit is contained in:
Vlad Zahorodnii 2022-07-07 12:03:56 +03:00
parent 694c32cf2c
commit 7d00766629

View file

@ -533,18 +533,6 @@ void DrmBackend::enableOutput(DrmAbstractOutput *output, bool enable)
m_placeholderFilter.reset();
}
} else {
if (m_enabledOutputs.count() == 1 && m_outputs.count() > 1 && !kwinApp()->isTerminating()) {
auto outputs = m_outputs;
outputs.removeOne(output);
if (!readOutputsConfiguration(outputs)) {
// config is invalid or failed to apply -> Try to enable an output anyways
OutputConfiguration cfg;
cfg.changeSet(outputs.constFirst())->enabled = true;
if (!applyOutputChanges(cfg)) {
qCCritical(KWIN_DRM) << "Could not enable any outputs!";
}
}
}
if (m_enabledOutputs.count() == 1 && !kwinApp()->isTerminating()) {
qCDebug(KWIN_DRM) << "adding placeholder output";
m_placeHolderOutput = primaryGpu()->createVirtualOutput({}, m_enabledOutputs.constFirst()->pixelSize(), 1, DrmVirtualOutput::Type::Placeholder);