summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-03-21 16:33:07 +0300
committerGitHub <noreply@github.com>2025-03-21 14:33:07 +0100
commitc7f0519fafbf334a8f5088a8a0fc385732a24036 (patch)
treeb431cf3bfca5772e53a7d00f4a773048ebe56585 /src
parent7ea4fbf0ba034d947339b3a94a10da022eca1988 (diff)
core: fix DS and VRR automation (#9334)
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigDescriptions.hpp4
-rw-r--r--src/config/ConfigManager.cpp32
-rw-r--r--src/render/Renderer.cpp3
3 files changed, 19 insertions, 20 deletions
diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp
index 6d0d8b1e..77cd8667 100644
--- a/src/config/ConfigDescriptions.hpp
+++ b/src/config/ConfigDescriptions.hpp
@@ -1054,9 +1054,9 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
},
SConfigOptionDescription{
.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,
- .data = SConfigOptionDescription::SRangeData{0, 0, 2},
+ .data = SConfigOptionDescription::SRangeData{.value = 0, .min = 0, .max = 3},
},
SConfigOptionDescription{
.value = "misc:mouse_move_enables_dpms",
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 90ec6305..35c5a502 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -49,6 +49,7 @@
#include <memory>
using namespace Hyprutils::String;
using namespace Hyprutils::Animation;
+using enum NContentType::eContentType;
//NOLINTNEXTLINE
extern "C" char** environ;
@@ -1652,37 +1653,34 @@ void CConfigManager::ensureVRR(PHLMONITOR pMonitor) {
}
m->vrrActive = true;
return;
- } else if (USEVRR == 2) {
+ } else if (USEVRR == 2 || USEVRR == 3) {
const auto PWORKSPACE = m->activeWorkspace;
if (!PWORKSPACE)
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 */
m->vrrActive = true;
- m->output->state->resetExplicitFences();
- m->output->state->setAdaptiveSync(true);
+ if (!m->output->state->state().adaptiveSync) {
+ m->output->state->setAdaptiveSync(true);
- if (!m->state.test()) {
- Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name);
- m->output->state->setAdaptiveSync(false);
+ if (!m->state.test()) {
+ Debug::log(LOG, "Pending output {} does not accept VRR.", m->output->name);
+ m->output->state->setAdaptiveSync(false);
+ }
}
-
- if (!m->state.commit())
- Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name);
-
- } else if (!WORKSPACEFULL) {
+ } else {
m->vrrActive = false;
- m->output->state->resetExplicitFences();
m->output->state->setAdaptiveSync(false);
-
- if (!m->state.commit())
- Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name);
}
}
};
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 88f1f95a..a89fd329 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1214,7 +1214,8 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
pMonitor->tearingState.activelyTearing = shouldTear;
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) {
if (pMonitor->attemptDirectScanout()) {
return;