From ec593a23644910a19ec2284aa753678228f19937 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 23 Mar 2023 22:26:37 +0100 Subject: [PATCH] backends/drm: consider color property changes as failed when the output is off The atomic test it does will succeed even when it shouldn't, which can make enabling the output again fail --- src/backends/drm/drm_output.cpp | 6 ++++++ src/colors/colordevice.cpp | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/src/backends/drm/drm_output.cpp b/src/backends/drm/drm_output.cpp index 2d0383dfdc..1c2f0be885 100644 --- a/src/backends/drm/drm_output.cpp +++ b/src/backends/drm/drm_output.cpp @@ -472,6 +472,9 @@ DrmOutputLayer *DrmOutput::cursorLayer() const bool DrmOutput::setGammaRamp(const std::shared_ptr &transformation) { + if (!m_pipeline->active()) { + return false; + } m_pipeline->setGammaRamp(transformation); m_pipeline->setCTM(QMatrix3x3()); if (DrmPipeline::commitPipelines({m_pipeline}, DrmPipeline::CommitMode::Test) == DrmPipeline::Error::None) { @@ -486,6 +489,9 @@ bool DrmOutput::setGammaRamp(const std::shared_ptr &transfo bool DrmOutput::setCTM(const QMatrix3x3 &ctm) { + if (!m_pipeline->active()) { + return false; + } m_pipeline->setCTM(ctm); if (DrmPipeline::commitPipelines({m_pipeline}, DrmPipeline::CommitMode::Test) == DrmPipeline::Error::None) { m_pipeline->applyPendingChanges(); diff --git a/src/colors/colordevice.cpp b/src/colors/colordevice.cpp index d50c226268..13ceb0b50a 100644 --- a/src/colors/colordevice.cpp +++ b/src/colors/colordevice.cpp @@ -245,6 +245,11 @@ ColorDevice::ColorDevice(Output *output, QObject *parent) d->updateTimer = new QTimer(this); d->updateTimer->setSingleShot(true); connect(d->updateTimer, &QTimer::timeout, this, &ColorDevice::update); + connect(output, &Output::dpmsModeChanged, this, [this, output]() { + if (output->dpmsMode() == Output::DpmsMode::On) { + update(); + } + }); d->output = output; scheduleUpdate();