added experimental:vfr

This commit is contained in:
vaxerski 2022-07-04 17:47:31 +02:00
parent c40ef59a35
commit e0bfec6ef2
3 changed files with 17 additions and 2 deletions

View file

@ -43,6 +43,8 @@ void CConfigManager::setDefaultVars() {
configValues["debug:damage_blink"].intValue = 0; configValues["debug:damage_blink"].intValue = 0;
configValues["debug:disable_logs"].intValue = 0; configValues["debug:disable_logs"].intValue = 0;
configValues["experimental:vfr"].intValue = 0;
configValues["decoration:rounding"].intValue = 1; configValues["decoration:rounding"].intValue = 1;
configValues["decoration:blur"].intValue = 1; configValues["decoration:blur"].intValue = 1;
configValues["decoration:blur_size"].intValue = 8; configValues["decoration:blur_size"].intValue = 8;

View file

@ -264,6 +264,14 @@ void HyprCtl::tickHyprCtl() {
} }
std::string getRequestFromThread(std::string rq) { 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) { while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) {
std::this_thread::sleep_for(std::chrono::milliseconds(5)); std::this_thread::sleep_for(std::chrono::milliseconds(5));
} }

View file

@ -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 PDEBUGOVERLAY = &g_pConfigManager->getConfigValuePtr("debug:overlay")->intValue;
static auto *const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("general:damage_tracking_internal")->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 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 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) { if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && PMONITOR->forceFullFrames == 0 && damageBlinkCleanup == 0) {
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
wlr_output_rollback(PMONITOR->output); 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; return;
} }
@ -319,7 +323,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
wlr_output_commit(PMONITOR->output); wlr_output_commit(PMONITOR->output);
wlr_output_schedule_frame(PMONITOR->output); if (!*VFRENABLED)
wlr_output_schedule_frame(PMONITOR->output);
if (*PDEBUGOVERLAY == 1) { if (*PDEBUGOVERLAY == 1) {
const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - startRender).count() / 1000.f; const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - startRender).count() / 1000.f;