From cc7c117fe76ff0a4da56b18026c725501de92c84 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 30 Jul 2024 15:50:14 +0200 Subject: [PATCH] output: minor tearing fixes --- src/helpers/Monitor.cpp | 3 ++- src/render/Renderer.cpp | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 787b790f..33fe0c04 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -812,7 +812,8 @@ bool CMonitor::attemptDirectScanout() { // and comes from the appropriate device. This may implode on multi-gpu!! output->state->setBuffer(PSURFACE->current.buffer); - output->state->setPresentationMode(Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC); + output->state->setPresentationMode(tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE : + Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC); if (!state.test()) return false; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index df0c6af5..b5397598 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1193,6 +1193,8 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { shouldTear = true; } + pMonitor->tearingState.activelyTearing = shouldTear; + if (!*PNODIRECTSCANOUT && !shouldTear) { if (pMonitor->attemptDirectScanout()) { return; @@ -1202,11 +1204,6 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { } } - if (pMonitor->tearingState.activelyTearing != shouldTear) { - // change of state - pMonitor->tearingState.activelyTearing = shouldTear; - } - EMIT_HOOK_EVENT("preRender", pMonitor); timespec now;