backends/drm: allow using both adaptive sync and tearing at the same time
The driver will translate that to adaptive sync in the vrr range, and tearing above it
This commit is contained in:
parent
7c3489b1a5
commit
bd26f57e18
4 changed files with 7 additions and 5 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
enum class SyncMode {
|
||||
Fixed,
|
||||
Adaptive,
|
||||
/* adaptive if possible, async if not */
|
||||
AdaptiveAsync,
|
||||
Async
|
||||
};
|
||||
SyncMode presentMode = SyncMode::Fixed;
|
||||
|
|
Loading…
Reference in a new issue