diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index f313b155..842e3bf4 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -43,6 +43,8 @@ void CConfigManager::setDefaultVars() { configValues["debug:damage_blink"].intValue = 0; configValues["debug:disable_logs"].intValue = 0; + configValues["experimental:vfr"].intValue = 0; + configValues["decoration:rounding"].intValue = 1; configValues["decoration:blur"].intValue = 1; configValues["decoration:blur_size"].intValue = 8; diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index eb6c085c..65b45901 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -264,6 +264,14 @@ void HyprCtl::tickHyprCtl() { } std::string getRequestFromThread(std::string rq) { + // we need to do something to wake hyprland up if VFR is enabled + static auto *const VFRENABLED = &g_pConfigManager->getConfigValuePtr("experimental:vfr")->intValue; + if (*VFRENABLED) { + // TODO: is this safe...? + // this might be a race condition + wlr_output_schedule_frame(g_pCompositor->m_vMonitors.front()->output); + } + while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) { std::this_thread::sleep_for(std::chrono::milliseconds(5)); } diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp index 11527cee..562c4533 100644 --- a/src/events/Monitors.cpp +++ b/src/events/Monitors.cpp @@ -173,6 +173,7 @@ void Events::listener_monitorFrame(void* owner, void* data) { static auto *const PDEBUGOVERLAY = &g_pConfigManager->getConfigValuePtr("debug:overlay")->intValue; static auto *const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("general:damage_tracking_internal")->intValue; static auto *const PDAMAGEBLINK = &g_pConfigManager->getConfigValuePtr("debug:damage_blink")->intValue; + static auto *const VFRENABLED = &g_pConfigManager->getConfigValuePtr("experimental:vfr")->intValue; static int damageBlinkCleanup = 0; // because double-buffered @@ -231,7 +232,10 @@ void Events::listener_monitorFrame(void* owner, void* data) { if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && PMONITOR->forceFullFrames == 0 && damageBlinkCleanup == 0) { pixman_region32_fini(&damage); wlr_output_rollback(PMONITOR->output); - wlr_output_schedule_frame(PMONITOR->output); // we update shit at the monitor's Hz so we need to schedule frames because rollback wont + + if (!*VFRENABLED) + wlr_output_schedule_frame(PMONITOR->output); + return; } @@ -319,7 +323,8 @@ void Events::listener_monitorFrame(void* owner, void* data) { wlr_output_commit(PMONITOR->output); - wlr_output_schedule_frame(PMONITOR->output); + if (!*VFRENABLED) + wlr_output_schedule_frame(PMONITOR->output); if (*PDEBUGOVERLAY == 1) { const float µs = std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - startRender).count() / 1000.f;