move no_vfr to vfr and add vrr

This commit is contained in:
vaxerski 2023-02-14 17:08:42 +00:00
parent 98c95aa34d
commit 127e80692f
3 changed files with 54 additions and 25 deletions

View file

@ -1957,6 +1957,8 @@ void CCompositor::setWindowFullscreen(CWindow* pWindow, bool on, eFullscreenMode
// DMAbuf stuff for direct scanout // DMAbuf stuff for direct scanout
g_pHyprRenderer->setWindowScanoutMode(pWindow); g_pHyprRenderer->setWindowScanoutMode(pWindow);
g_pConfigManager->ensureVRR(PMONITOR);
} }
void CCompositor::moveUnmanagedX11ToWindows(CWindow* pWindow) { void CCompositor::moveUnmanagedX11ToWindows(CWindow* pWindow) {

View file

@ -51,7 +51,8 @@ void CConfigManager::setDefaultVars() {
configValues["misc:disable_hyprland_logo"].intValue = 0; configValues["misc:disable_hyprland_logo"].intValue = 0;
configValues["misc:disable_splash_rendering"].intValue = 0; configValues["misc:disable_splash_rendering"].intValue = 0;
configValues["misc:no_vfr"].intValue = 1; configValues["misc:vfr"].intValue = 1;
configValues["misc:vrr"].intValue = 0;
configValues["misc:mouse_move_enables_dpms"].intValue = 0; configValues["misc:mouse_move_enables_dpms"].intValue = 0;
configValues["misc:always_follow_on_dnd"].intValue = 1; configValues["misc:always_follow_on_dnd"].intValue = 1;
configValues["misc:layers_hog_keyboard_focus"].intValue = 1; configValues["misc:layers_hog_keyboard_focus"].intValue = 1;
@ -1692,11 +1693,21 @@ void CConfigManager::ensureDPMS() {
} }
void CConfigManager::ensureVRR(CMonitor* pMonitor) { void CConfigManager::ensureVRR(CMonitor* pMonitor) {
static auto* const PNOVRR = &getConfigValuePtr("misc:no_vfr")->intValue; static auto* const PVRR = &getConfigValuePtr("misc:vrr")->intValue;
auto ensureVRRForDisplay = [&](CMonitor* m) -> void { static auto ensureVRRForDisplay = [&](CMonitor* m) -> void {
if (!*PNOVRR && !m->vrrActive) { if (*PVRR == 0) {
// Adaptive sync (VRR) if (m->vrrActive) {
wlr_output_enable_adaptive_sync(m->output, 0);
if (!wlr_output_commit(m->output)) {
Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> false", m->output->name);
}
}
m->vrrActive = false;
return;
} else if (*PVRR == 1) {
if (!m->vrrActive) {
wlr_output_enable_adaptive_sync(m->output, 1); wlr_output_enable_adaptive_sync(m->output, 1);
if (!wlr_output_test(m->output)) { if (!wlr_output_test(m->output)) {
@ -1707,20 +1718,36 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
if (!wlr_output_commit(m->output)) { if (!wlr_output_commit(m->output)) {
Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> true", m->output->name); Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> true", m->output->name);
} }
}
m->vrrActive = true;
return;
} else if (*PVRR == 2) {
/* fullscreen */
m->vrrActive = true; m->vrrActive = true;
Debug::log(LOG, "VRR ensured on %s -> true", m->output->name); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m->activeWorkspace);
} else if (*PNOVRR && m->vrrActive) {
if (!PWORKSPACE)
return; // ???
if (PWORKSPACE->m_bHasFullscreenWindow && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED) {
wlr_output_enable_adaptive_sync(m->output, 1);
if (!wlr_output_test(m->output)) {
Debug::log(LOG, "Pending output %s does not accept VRR.", m->output->name);
wlr_output_enable_adaptive_sync(m->output, 0);
}
if (!wlr_output_commit(m->output)) {
Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> true", m->output->name);
}
} else if (!PWORKSPACE->m_bHasFullscreenWindow && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) {
wlr_output_enable_adaptive_sync(m->output, 0); wlr_output_enable_adaptive_sync(m->output, 0);
if (!wlr_output_commit(m->output)) { if (!wlr_output_commit(m->output)) {
Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> false", m->output->name); Debug::log(ERR, "Couldn't commit output %s in ensureVRR -> false", m->output->name);
} }
}
m->vrrActive = false;
Debug::log(LOG, "VRR ensured on %s -> false", m->output->name);
} }
}; };

View file

@ -120,6 +120,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
static auto* const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("debug:damage_tracking")->intValue; static auto* const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("debug:damage_tracking")->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 PNODIRECTSCANOUT = &g_pConfigManager->getConfigValuePtr("misc:no_direct_scanout")->intValue; static auto* const PNODIRECTSCANOUT = &g_pConfigManager->getConfigValuePtr("misc:no_direct_scanout")->intValue;
static auto* const PVFR = &g_pConfigManager->getConfigValuePtr("misc:vfr")->intValue;
static int damageBlinkCleanup = 0; // because double-buffered static int damageBlinkCleanup = 0; // because double-buffered
@ -148,8 +149,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
// checks // // checks //
if (PMONITOR->ID == g_pHyprRenderer->m_pMostHzMonitor->ID || if (PMONITOR->ID == g_pHyprRenderer->m_pMostHzMonitor->ID ||
g_pHyprRenderer->m_pMostHzMonitor->output->adaptive_sync_status == *PVFR == 1) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
g_pCompositor->sanityCheckWorkspaces(); g_pCompositor->sanityCheckWorkspaces();
g_pAnimationManager->tick(); g_pAnimationManager->tick();
@ -204,7 +204,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
pixman_region32_fini(&damage); pixman_region32_fini(&damage);
wlr_output_rollback(PMONITOR->output); wlr_output_rollback(PMONITOR->output);
if (*PDAMAGEBLINK || PMONITOR->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED) if (*PDAMAGEBLINK || *PVFR == 0)
g_pCompositor->scheduleFrameForMonitor(PMONITOR); g_pCompositor->scheduleFrameForMonitor(PMONITOR);
return; return;
@ -311,7 +311,7 @@ void Events::listener_monitorFrame(void* owner, void* data) {
if (!wlr_output_commit(PMONITOR->output)) if (!wlr_output_commit(PMONITOR->output))
return; return;
if (*PDAMAGEBLINK || PMONITOR->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED) if (*PDAMAGEBLINK || *PVFR == 0)
g_pCompositor->scheduleFrameForMonitor(PMONITOR); g_pCompositor->scheduleFrameForMonitor(PMONITOR);
if (*PDEBUGOVERLAY == 1) { if (*PDEBUGOVERLAY == 1) {