From a9d53a2252f7ec084e2487d18777e2df01c8c351 Mon Sep 17 00:00:00 2001 From: UjinT34 <41110182+UjinT34@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:45:32 +0300 Subject: vrr: add option to fix mouse breaking vrr (#6483) * option to fix mouse breaking vrr * skip damage on mouse move * remove this-> & cleanup * add cursor:min_refresh_rate to avoid cursor freezing * run clang-format --------- Co-authored-by: UjinT34 --- src/helpers/Monitor.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/helpers/Monitor.cpp') diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 027b47bd..58687e09 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -362,6 +362,24 @@ void CMonitor::addDamage(const CBox* box) { g_pCompositor->scheduleFrameForMonitor(this); } +bool CMonitor::shouldSkipScheduleFrameOnMouseEvent() { + static auto PNOBREAK = CConfigValue("cursor:no_break_fs_vrr"); + static auto PMINRR = CConfigValue("cursor:min_refresh_rate"); + + // skip scheduling extra frames for fullsreen apps with vrr + bool shouldSkip = *PNOBREAK && output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED && activeWorkspace && activeWorkspace->m_bHasFullscreenWindow && + activeWorkspace->m_efFullscreenMode == FULLSCREEN_FULL; + + // keep requested minimum refresh rate + if (shouldSkip && *PMINRR && lastPresentationTimer.getMillis() > 1000 / *PMINRR) { + // damage whole screen because some previous cursor box damages were skipped + wlr_damage_ring_add_whole(&damage); + return false; + } + + return shouldSkip; +} + bool CMonitor::isMirror() { return pMirrorOf != nullptr; } -- cgit v1.2.3