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
This commit is contained in:
Xaver Hugl 2023-03-23 22:26:37 +01:00
parent fd6d94a0be
commit ec593a2364
2 changed files with 11 additions and 0 deletions

View file

@ -472,6 +472,9 @@ DrmOutputLayer *DrmOutput::cursorLayer() const
bool DrmOutput::setGammaRamp(const std::shared_ptr<ColorTransformation> &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<ColorTransformation> &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();

View file

@ -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();