From a2a29a60e5301df2cadf58c1bb18495d02710547 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 30 Sep 2023 17:07:50 +0100 Subject: tearing: cleanup vars and avoid rendering before drm is ready --- src/render/Renderer.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/render/Renderer.cpp') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index ea6a246a..12b745ff 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -846,10 +846,9 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { // tearing and DS first bool shouldTear = false; - bool canTear = *PTEARINGENABLED && g_pHyprOpenGL->m_RenderData.mouseZoomFactor == 1.0; recheckSolitaryForMonitor(pMonitor); - if (pMonitor->nextRenderTorn) { - pMonitor->nextRenderTorn = false; + if (pMonitor->tearingState.nextRenderTorn) { + pMonitor->tearingState.nextRenderTorn = false; if (!*PTEARINGENABLED) { Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring"); @@ -861,18 +860,13 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { return; } - if (!pMonitor->canTear) { + if (!pMonitor->tearingState.canTear) { Debug::log(WARN, "Tearing commit requested but monitor doesn't support it, ignoring"); return; } if (pMonitor->solitaryClient) shouldTear = true; - } else { - // if this is a non-tearing commit, and we are in a state where we should tear - // then this is a vblank commit that we should ignore - if (canTear && pMonitor->solitaryClient && pMonitor->canTear && pMonitor->solitaryClient->canBeTorn() && pMonitor->renderingFromVblankEvent) - return; } if (!*PNODIRECTSCANOUT && !shouldTear) { @@ -884,12 +878,12 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { } } - if (pMonitor->activelyTearing != shouldTear) { + if (pMonitor->tearingState.activelyTearing != shouldTear) { // change of state - pMonitor->activelyTearing = shouldTear; + pMonitor->tearingState.activelyTearing = shouldTear; for (auto& m : g_pCompositor->m_vMonitors) { - wlr_output_lock_software_cursors(m->output, pMonitor->activelyTearing); + wlr_output_lock_software_cursors(m->output, pMonitor->tearingState.activelyTearing); } } @@ -1090,7 +1084,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) { } if (shouldTear) - pMonitor->ignoreNextFlipEvent = true; + pMonitor->tearingState.busy = true; wlr_damage_ring_rotate(&pMonitor->damage); -- cgit v1.2.3