diff --git a/src/backends/drm/drm_gpu.cpp b/src/backends/drm/drm_gpu.cpp index 4c0d52fdb2..bfd747469c 100644 --- a/src/backends/drm/drm_gpu.cpp +++ b/src/backends/drm/drm_gpu.cpp @@ -727,12 +727,20 @@ bool DrmGpu::maybeModeset() bool presentPendingForAll = std::all_of(pipelines.constBegin(), pipelines.constEnd(), [](const auto &pipeline) { return pipeline->modesetPresentPending() || !pipeline->pending.active; }); - if (presentPendingForAll) { - return DrmPipeline::commitPipelines(pipelines, DrmPipeline::CommitMode::CommitModeset, unusedObjects()); - } else { + if (!presentPendingForAll) { // commit only once all pipelines are ready for presentation return true; } + const bool ok = DrmPipeline::commitPipelines(pipelines, DrmPipeline::CommitMode::CommitModeset, unusedObjects()); + for (DrmPipeline *pipeline : qAsConst(pipelines)) { + if (pipeline->modesetPresentPending() && pipeline->output()) { + pipeline->resetModesetPresentPending(); + if (!ok) { + pipeline->output()->presentFailed(); + } + } + } + return ok; } QVector DrmGpu::unusedObjects() const diff --git a/src/backends/drm/drm_pipeline.cpp b/src/backends/drm/drm_pipeline.cpp index 5ac5ccf65e..003fd0bf2b 100644 --- a/src/backends/drm/drm_pipeline.cpp +++ b/src/backends/drm/drm_pipeline.cpp @@ -126,10 +126,6 @@ bool DrmPipeline::commitPipelines(const QVector &pipelines, Commit pipeline->pending.crtc->rollbackPending(); pipeline->pending.crtc->primaryPlane()->rollbackPending(); } - if (mode != CommitMode::Test && pipeline->activePending() && pipeline->output()) { - pipeline->m_modesetPresentPending = false; - pipeline->output()->presentFailed(); - } } for (const auto &obj : unusedObjects) { printProps(obj, PrintMode::OnlyChanged); @@ -187,7 +183,6 @@ bool DrmPipeline::commitPipelines(const QVector &pipelines, Commit } } if (mode != CommitMode::Test) { - pipeline->m_modesetPresentPending = false; pipeline->m_pageflipPending = true; pipeline->m_connector->commit(); if (pipeline->pending.crtc) { @@ -225,9 +220,6 @@ bool DrmPipeline::commitPipelines(const QVector &pipelines, Commit for (const auto &pipeline : pipelines) { pipeline->revertPendingChanges(); pipeline->applyPendingChangesLegacy(); - if (mode == CommitMode::CommitModeset && pipeline->output() && pipeline->activePending()) { - pipeline->output()->presentFailed(); - } } return false; } else { @@ -510,6 +502,11 @@ bool DrmPipeline::modesetPresentPending() const return m_modesetPresentPending; } +void DrmPipeline::resetModesetPresentPending() +{ + m_modesetPresentPending = false; +} + DrmCrtc *DrmPipeline::currentCrtc() const { return m_current.crtc; diff --git a/src/backends/drm/drm_pipeline.h b/src/backends/drm/drm_pipeline.h index 7850c86530..126fdc3e94 100644 --- a/src/backends/drm/drm_pipeline.h +++ b/src/backends/drm/drm_pipeline.h @@ -80,6 +80,7 @@ public: void pageFlipped(std::chrono::nanoseconds timestamp); bool pageflipPending() const; bool modesetPresentPending() const; + void resetModesetPresentPending(); void printDebugInfo() const; QSize sourceSize() const;