platforms/drm: prevent having zero outputs at any time
Instead of updating all outputs first, create the placeholder output before the last output gets removed.
This commit is contained in:
parent
2696030b00
commit
dbf4a59527
2 changed files with 11 additions and 5 deletions
|
@ -334,10 +334,21 @@ void DrmBackend::addOutput(DrmAbstractOutput *o)
|
|||
m_enabledOutputs.append(o);
|
||||
Q_EMIT outputAdded(o);
|
||||
Q_EMIT outputEnabled(o);
|
||||
if (m_placeHolderOutput) {
|
||||
qCDebug(KWIN_DRM) << "removing placeholder output";
|
||||
primaryGpu()->removeVirtualOutput(m_placeHolderOutput);
|
||||
m_placeHolderOutput = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void DrmBackend::removeOutput(DrmAbstractOutput *o)
|
||||
{
|
||||
if (m_outputs.count() == 1 && !kwinApp()->isTerminating()) {
|
||||
qCDebug(KWIN_DRM) << "adding placeholder output";
|
||||
m_placeHolderOutput = primaryGpu()->createVirtualOutput();
|
||||
// placeholder doesn't actually need to render anything
|
||||
m_placeHolderOutput->renderLoop()->inhibit();
|
||||
}
|
||||
if (m_enabledOutputs.removeOne(o)) {
|
||||
Q_EMIT outputDisabled(o);
|
||||
}
|
||||
|
@ -366,10 +377,6 @@ void DrmBackend::updateOutputs()
|
|||
m_placeHolderOutput = primaryGpu()->createVirtualOutput();
|
||||
// placeholder doesn't actually need to render anything
|
||||
m_placeHolderOutput->renderLoop()->inhibit();
|
||||
} else if (m_placeHolderOutput && m_outputs.count() > 1) {
|
||||
qCDebug(KWIN_DRM) << "removing placeholder output";
|
||||
primaryGpu()->removeVirtualOutput(m_placeHolderOutput);
|
||||
m_placeHolderOutput = nullptr;
|
||||
}
|
||||
|
||||
std::sort(m_outputs.begin(), m_outputs.end(), [] (DrmAbstractOutput *a, DrmAbstractOutput *b) {
|
||||
|
|
|
@ -38,7 +38,6 @@ class KWIN_EXPORT DrmOutput : public DrmAbstractOutput
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
///deletes the output, calling this whilst a page flip is pending will result in an error
|
||||
~DrmOutput() override;
|
||||
|
||||
bool initCursor(const QSize &cursorSize) override;
|
||||
|
|
Loading…
Reference in a new issue