backends/drm: when presentation with tearing+vrr fails, retry first with vrr only

Tearing may not always work, and currently is guaranteed to not work when we try to enable VRR at the
same time. VRR without tearing may still work though, so this commit makes KWin fall back to VRR-only
presentation before giving up and using the basic vsync presentation mode instead.
This commit is contained in:
Xaver Hugl 2024-09-05 16:20:12 +02:00
parent 91eb1972c1
commit 0670631a12

View file

@ -306,8 +306,13 @@ bool DrmOutput::present(const std::shared_ptr<OutputFrame> &frame)
} else {
m_pipeline->setPresentationMode(frame->presentationMode());
DrmPipeline::Error err = m_pipeline->present(frame);
if (err != DrmPipeline::Error::None && frame->presentationMode() == PresentationMode::AdaptiveAsync) {
// tearing can fail in various circumstances, but vrr shouldn't
m_pipeline->setPresentationMode(PresentationMode::AdaptiveSync);
err = m_pipeline->present(frame);
}
if (err != DrmPipeline::Error::None && frame->presentationMode() != PresentationMode::VSync) {
// retry with a more basic presentation mode
// retry with the most basic presentation mode
m_pipeline->setPresentationMode(PresentationMode::VSync);
err = m_pipeline->present(frame);
}