diff --git a/src/backends/drm/drm_pipeline.cpp b/src/backends/drm/drm_pipeline.cpp index 375c4e8fff..4ba9d0ff24 100644 --- a/src/backends/drm/drm_pipeline.cpp +++ b/src/backends/drm/drm_pipeline.cpp @@ -210,7 +210,7 @@ void DrmPipeline::prepareAtomicPresentation() contentType->setEnum(m_pending.contentType); } - m_pending.crtc->setPending(DrmCrtc::PropertyIndex::VrrEnabled, m_pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive); + m_pending.crtc->setPending(DrmCrtc::PropertyIndex::VrrEnabled, m_pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive || m_pending.syncMode == RenderLoopPrivate::SyncMode::AdaptiveAsync); m_pending.crtc->setPending(DrmCrtc::PropertyIndex::Gamma_LUT, m_pending.gamma ? m_pending.gamma->blobId() : 0); const auto modeSize = m_pending.mode->size(); const auto fb = m_pending.layer->currentBuffer().get(); diff --git a/src/backends/drm/drm_pipeline_legacy.cpp b/src/backends/drm/drm_pipeline_legacy.cpp index 0d3a0177e6..c17bccd0e8 100644 --- a/src/backends/drm/drm_pipeline_legacy.cpp +++ b/src/backends/drm/drm_pipeline_legacy.cpp @@ -31,7 +31,7 @@ DrmPipeline::Error DrmPipeline::presentLegacy() } const auto buffer = m_pending.layer->currentBuffer(); uint32_t flags = DRM_MODE_PAGE_FLIP_EVENT; - if (m_pending.syncMode == RenderLoopPrivate::SyncMode::Async) { + if (m_pending.syncMode == RenderLoopPrivate::SyncMode::Async || m_pending.syncMode == RenderLoopPrivate::SyncMode::AdaptiveAsync) { flags |= DRM_MODE_PAGE_FLIP_ASYNC; } if (drmModePageFlip(gpu()->fd(), m_pending.crtc->id(), buffer->framebufferId(), flags, gpu()) != 0) { @@ -97,7 +97,7 @@ DrmPipeline::Error DrmPipeline::applyPendingChangesLegacy() } if (activePending()) { auto vrr = m_pending.crtc->getProp(DrmCrtc::PropertyIndex::VrrEnabled); - if (vrr && !vrr->setPropertyLegacy(m_pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive)) { + if (vrr && !vrr->setPropertyLegacy(m_pending.syncMode == RenderLoopPrivate::SyncMode::Adaptive || m_pending.syncMode == RenderLoopPrivate::SyncMode::AdaptiveAsync)) { qCWarning(KWIN_DRM) << "Setting vrr failed!" << strerror(errno); return errnoToError(); } diff --git a/src/core/renderloop.cpp b/src/core/renderloop.cpp index 1b3e98c909..f3cb474d26 100644 --- a/src/core/renderloop.cpp +++ b/src/core/renderloop.cpp @@ -40,7 +40,7 @@ void RenderLoopPrivate::scheduleRepaint() return; } if (vrrPolicy == RenderLoop::VrrPolicy::Always || (vrrPolicy == RenderLoop::VrrPolicy::Automatic && fullscreenItem != nullptr)) { - presentMode = SyncMode::Adaptive; + presentMode = allowTearing ? SyncMode::AdaptiveAsync : SyncMode::Adaptive; } else { presentMode = allowTearing ? SyncMode::Async : SyncMode::Fixed; } @@ -95,7 +95,7 @@ void RenderLoopPrivate::scheduleRepaint() nextRenderTimestamp = currentTime; } - if (presentMode == SyncMode::Async) { + if (presentMode == SyncMode::Async || presentMode == SyncMode::AdaptiveAsync) { compositeTimer.start(0); } else { const std::chrono::nanoseconds waitInterval = nextRenderTimestamp - currentTime; diff --git a/src/core/renderloop_p.h b/src/core/renderloop_p.h index 9c9533a2e3..9e7eca050e 100644 --- a/src/core/renderloop_p.h +++ b/src/core/renderloop_p.h @@ -50,6 +50,8 @@ public: enum class SyncMode { Fixed, Adaptive, + /* adaptive if possible, async if not */ + AdaptiveAsync, Async }; SyncMode presentMode = SyncMode::Fixed;