platforms/drm: fix dpms tracking

DrmGpu::updateOutputs is now changing the state of some drm properties
without changing the fitting output state (namely RenderLoop inhibition)
which can lead to rendering being inhibited indefinitely in some cases
This commit is contained in:
Xaver Hugl 2021-09-26 23:20:42 +02:00 committed by Aleix Pol Gonzalez
parent 0f6aa1c4a8
commit 7bca5d737d
8 changed files with 7 additions and 18 deletions

View file

@ -32,7 +32,6 @@ public:
virtual bool present(const QSharedPointer<DrmBuffer> &buffer, QRegion damagedRegion) = 0;
virtual bool needsSoftwareTransformation() const = 0;
virtual bool isDpmsEnabled() const = 0;
virtual QSize sourceSize() const = 0;
virtual bool isFormatSupported(uint32_t drmFormat) const = 0;
virtual QVector<uint64_t> supportedModifiers(uint32_t drmFormat) const = 0;

View file

@ -119,7 +119,7 @@ void DrmBackend::checkOutputsAreOn()
return;
}
for (auto it = m_enabledOutputs.constBegin(), end = m_enabledOutputs.constEnd(); it != end; it++) {
if (!(*it)->isDpmsEnabled()) {
if ((*it)->dpmsMode() != AbstractWaylandOutput::DpmsMode::On) {
// dpms still disabled, need to keep the filter
return;
}

View file

@ -320,6 +320,9 @@ bool DrmGpu::updateOutputs()
} else if (m_outputs.contains(output)) {
// try setting hardware rotation
output->updateTransform(output->transform());
if (output->dpmsMode() != AbstractWaylandOutput::DpmsMode::On) {
pipeline->setActive(false);
}
} else {
qCDebug(KWIN_DRM).nospace() << "New output on GPU " << m_devNode << ": " << pipeline->connector()->modelName();
if (!output->initCursor(m_cursorSize)) {

View file

@ -256,7 +256,8 @@ void DrmOutput::setDrmDpmsMode(DpmsMode mode)
return;
}
bool active = mode == DpmsMode::On;
if (active == m_pipeline->isActive()) {
bool isActive = dpmsMode() == DpmsMode::On;
if (active == isActive) {
setDpmsModeInternal(mode);
return;
}
@ -433,11 +434,6 @@ DrmPipeline *DrmOutput::pipeline() const
return m_pipeline;
}
bool DrmOutput::isDpmsEnabled() const
{
return m_pipeline->isActive();
}
QSize DrmOutput::sourceSize() const
{
return m_pipeline->sourceSize();

View file

@ -48,7 +48,6 @@ public:
bool present(const QSharedPointer<DrmBuffer> &buffer, QRegion damagedRegion) override;
void pageFlipped();
bool isDpmsEnabled() const override;
DrmConnector *connector() const;
DrmPipeline *pipeline() const;

View file

@ -58,7 +58,6 @@ public:
bool setRgbRange(AbstractWaylandOutput::RgbRange rgbRange);
DrmPlane::Transformations transformation() const;
bool isActive() const;
bool isCursorVisible() const;
QPoint cursorPos() const;
@ -91,6 +90,7 @@ private:
bool atomicCommit();
bool presentLegacy();
bool checkTestBuffer();
bool isActive() const;
bool setPendingTransformation(const DrmPlane::Transformations &transformation);

View file

@ -74,12 +74,6 @@ void DrmVirtualOutput::updateMode(const QSize &size, uint32_t refreshRate)
void DrmVirtualOutput::setDpmsMode(DpmsMode mode)
{
setDpmsModeInternal(mode);
m_dpmsEnabled = mode == DpmsMode::On;
}
bool DrmVirtualOutput::isDpmsEnabled() const
{
return m_dpmsEnabled;
}
void DrmVirtualOutput::updateEnablement(bool enable)

View file

@ -29,7 +29,6 @@ public:
bool present(const QSharedPointer<DrmBuffer> &buffer, QRegion damagedRegion) override;
QSize sourceSize() const override;
bool isDpmsEnabled() const override;
bool isFormatSupported(uint32_t drmFormat) const override;
QVector<uint64_t> supportedModifiers(uint32_t drmFormat) const override;
@ -55,7 +54,6 @@ private:
QSharedPointer<DrmBuffer> m_currentBuffer;
bool m_pageFlipPending = true;
int m_modeIndex = 0;
bool m_dpmsEnabled = true;
int m_identifier;
SoftwareVsyncMonitor *m_vsyncMonitor;