core: fix DS and VRR automation (#9334)

This commit is contained in:
UjinT34
2025-03-21 16:33:07 +03:00
committed by GitHub
parent 7ea4fbf0ba
commit c7f0519faf
3 changed files with 19 additions and 20 deletions

View File

@@ -1054,9 +1054,9 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
}, },
SConfigOptionDescription{ SConfigOptionDescription{
.value = "misc:vrr", .value = "misc:vrr",
.description = " controls the VRR (Adaptive Sync) of your monitors. 0 - off, 1 - on, 2 - fullscreen only [0/1/2]", .description = " controls the VRR (Adaptive Sync) of your monitors. 0 - off, 1 - on, 2 - fullscreen only, 3 - fullscreen with game or video content type [0/1/2/3]",
.type = CONFIG_OPTION_INT, .type = CONFIG_OPTION_INT,
.data = SConfigOptionDescription::SRangeData{0, 0, 2}, .data = SConfigOptionDescription::SRangeData{.value = 0, .min = 0, .max = 3},
}, },
SConfigOptionDescription{ SConfigOptionDescription{
.value = "misc:mouse_move_enables_dpms", .value = "misc:mouse_move_enables_dpms",

View File

@@ -49,6 +49,7 @@
#include <memory> #include <memory>
using namespace Hyprutils::String; using namespace Hyprutils::String;
using namespace Hyprutils::Animation; using namespace Hyprutils::Animation;
using enum NContentType::eContentType;
//NOLINTNEXTLINE //NOLINTNEXTLINE
extern "C" char** environ; extern "C" char** environ;
@@ -1652,37 +1653,34 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
} }
m->vrrActive = true; m->vrrActive = true;
return; return;
} else if (USEVRR == 2) { } else if (USEVRR == 2 || USEVRR == 3) {
const auto PWORKSPACE = m->activeWorkspace; const auto PWORKSPACE = m->activeWorkspace;
if (!PWORKSPACE) if (!PWORKSPACE)
return; // ??? return; // ???
const auto WORKSPACEFULL = PWORKSPACE->m_bHasFullscreenWindow && (PWORKSPACE->m_efFullscreenMode & FSMODE_FULLSCREEN); bool wantVRR = PWORKSPACE->m_bHasFullscreenWindow && (PWORKSPACE->m_efFullscreenMode & FSMODE_FULLSCREEN);
if (wantVRR && USEVRR == 3) {
const auto contentType = PWORKSPACE->getFullscreenWindow()->getContentType();
wantVRR = contentType == CONTENT_TYPE_GAME || contentType == CONTENT_TYPE_VIDEO;
}
if (WORKSPACEFULL) { if (wantVRR) {
/* fullscreen */ /* fullscreen */
m->vrrActive = true; m->vrrActive = true;
m->output->state->resetExplicitFences(); if (!m->output->state->state().adaptiveSync) {
m->output->state->setAdaptiveSync(true); m->output->state->setAdaptiveSync(true);
if (!m->state.test()) { if (!m->state.test()) {
Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name); Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name);
m->output->state->setAdaptiveSync(false); m->output->state->setAdaptiveSync(false);
}
} }
} else {
if (!m->state.commit())
Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name);
} else if (!WORKSPACEFULL) {
m->vrrActive = false; m->vrrActive = false;
m->output->state->resetExplicitFences();
m->output->state->setAdaptiveSync(false); m->output->state->setAdaptiveSync(false);
if (!m->state.commit())
Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name);
} }
} }
}; };

View File

@@ -1214,7 +1214,8 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
pMonitor->tearingState.activelyTearing = shouldTear; pMonitor->tearingState.activelyTearing = shouldTear;
if ((*PDIRECTSCANOUT == 1 || if ((*PDIRECTSCANOUT == 1 ||
(*PDIRECTSCANOUT == 2 && pMonitor->activeWorkspace->getFullscreenWindow() && pMonitor->activeWorkspace->getFullscreenWindow()->getContentType() == CONTENT_TYPE_GAME)) && (*PDIRECTSCANOUT == 2 && pMonitor->activeWorkspace && pMonitor->activeWorkspace->m_bHasFullscreenWindow &&
pMonitor->activeWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN && pMonitor->activeWorkspace->getFullscreenWindow()->getContentType() == CONTENT_TYPE_GAME)) &&
!shouldTear) { !shouldTear) {
if (pMonitor->attemptDirectScanout()) { if (pMonitor->attemptDirectScanout()) {
return; return;