summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-10-22 21:45:17 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-10-22 21:45:17 +0100
commit47eac4be1cde424f12e942d58813a10869bfb169 (patch)
tree958d0ff20c7dd04f5af2621e0709439adbdc10bc /src
parent29958677606ae3bc46b871303f2b2d956db90bfc (diff)
disable adaptive sync with no_vfr off
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp35
-rw-r--r--src/config/ConfigManager.hpp1
-rw-r--r--src/helpers/Monitor.cpp3
-rw-r--r--src/helpers/Monitor.hpp1
-rw-r--r--src/render/Renderer.cpp9
5 files changed, 41 insertions, 8 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index bb856995..d00c547b 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -1204,6 +1204,7 @@ void CConfigManager::loadConfigLoadVars() {
// check
ensureDPMS();
+ ensureVRR();
}
// Update window border colors
@@ -1535,6 +1536,40 @@ void CConfigManager::ensureDPMS() {
}
}
+void CConfigManager::ensureVRR() {
+ static auto *const PNOVRR = &getConfigValuePtr("misc:no_vfr")->intValue;
+
+ for (auto& m : g_pCompositor->m_vMonitors) {
+ if (!*PNOVRR && !m->vrrActive) {
+ // Adaptive sync (VRR)
+ 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);
+ }
+
+ m->vrrActive = true;
+
+ Debug::log(LOG, "VRR ensured on %s -> true", m->output->name);
+ } else if (*PNOVRR && 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;
+
+ Debug::log(LOG, "VRR ensured on %s -> false", m->output->name);
+ }
+ }
+}
+
SAnimationPropertyConfig* CConfigManager::getAnimationPropertyConfig(const std::string& name) {
return &animationConfig[name];
}
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index dfd0da9d..036b9d62 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -151,6 +151,7 @@ public:
bool m_bForceReload = false;
bool m_bNoMonitorReload = false;
void ensureDPMS();
+ void ensureVRR();
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index cb128617..9723e3ba 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -136,6 +136,9 @@ void CMonitor::onConnect(bool noRule) {
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
+
+ // ensure VRR (will enable if necessary)
+ g_pConfigManager->ensureVRR();
}
void CMonitor::onDisconnect() {
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index b7442188..7064ee28 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -38,6 +38,7 @@ public:
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
bool dpmsStatus = true;
+ bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
// mirroring
CMonitor* pMirrorOf = nullptr;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index a4b737f0..473d4d65 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1153,20 +1153,13 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
}
}
+ wlr_output_enable_adaptive_sync(pMonitor->output, 0); // disabled here, will be tested in CConfigManager::ensureVRR()
wlr_output_set_transform(pMonitor->output, pMonitorRule->transform);
pMonitor->transform = pMonitorRule->transform;
pMonitor->vecPixelSize = pMonitor->vecSize;
- // Adaptive sync (VRR)
- wlr_output_enable_adaptive_sync(pMonitor->output, 1);
-
- if (!wlr_output_test(pMonitor->output)) {
- Debug::log(LOG, "Pending output %s does not accept VRR.", pMonitor->output->name);
- wlr_output_enable_adaptive_sync(pMonitor->output, 0);
- }
-
if (!wlr_output_commit(pMonitor->output)) {
Debug::log(ERR, "Couldn't commit output named %s", pMonitor->output->name);
return true;