aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-01-27 19:11:03 +0000
committerVaxry <[email protected]>2024-01-27 19:11:14 +0000
commitbc7e488a4c7a4bfdd7bce66265fe8aea516fd2ed (patch)
tree496aa74e4f6a1f655e28adc145cd5af612d8211d
parent8b1069b33051dbc3a133444dc6ce7385cdc51377 (diff)
downloadHyprland-bc7e488a4c7a4bfdd7bce66265fe8aea516fd2ed.tar.gz
Hyprland-bc7e488a4c7a4bfdd7bce66265fe8aea516fd2ed.zip
monitor: clear output state after usage
fixes massive lag
-rw-r--r--src/config/ConfigManager.cpp8
-rw-r--r--src/helpers/Monitor.cpp6
-rw-r--r--src/helpers/Monitor.hpp1
-rw-r--r--src/render/Renderer.cpp6
4 files changed, 21 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index e9d2e512..0e98b977 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -2321,6 +2321,8 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
if (!wlr_output_commit_state(m->output, &m->outputState))
Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name);
+
+ pMonitor->clearState();
}
m->vrrActive = false;
return;
@@ -2335,6 +2337,8 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
if (!wlr_output_commit_state(m->output, &m->outputState))
Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name);
+
+ pMonitor->clearState();
}
m->vrrActive = true;
return;
@@ -2360,11 +2364,15 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
if (!wlr_output_commit_state(m->output, &m->outputState))
Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> true", m->output->name);
+ pMonitor->clearState();
+
} else if (!WORKSPACEFULL && m->output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED) {
wlr_output_state_set_adaptive_sync_enabled(&m->outputState, 0);
if (!wlr_output_commit_state(m->output, &m->outputState))
Debug::log(ERR, "Couldn't commit output {} in ensureVRR -> false", m->output->name);
+
+ pMonitor->clearState();
}
}
};
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index f476c4c3..6dfd0a65 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -682,3 +682,9 @@ void CMonitor::updateMatrix() {
wlr_matrix_translate(projMatrix.data(), -vecTransformedSize.x / 2.0, -vecTransformedSize.y / 2.0);
}
}
+
+void CMonitor::clearState() {
+ wlr_output_state_finish(&outputState);
+ outputState = {0};
+ wlr_output_state_init(&outputState);
+}
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index b1448fa9..4681419c 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -128,6 +128,7 @@ class CMonitor {
void moveTo(const Vector2D& pos);
Vector2D middle();
void updateMatrix();
+ void clearState();
bool m_bEnabled = false;
bool m_bRenderingInitPassed = false;
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 61f21854..b338dfb4 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -1244,9 +1244,13 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
if (UNLOCK_SC)
wlr_output_lock_software_cursors(pMonitor->output, false);
+ pMonitor->clearState();
+
return;
}
+ pMonitor->clearState();
+
if (shouldTear)
pMonitor->tearingState.busy = true;
@@ -2080,6 +2084,8 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR
Debug::log(ERR, "Couldn't commit output named {}", pMonitor->output->name);
}
+ pMonitor->clearState();
+
int x, y;
wlr_output_transformed_resolution(pMonitor->output, &x, &y);
pMonitor->vecSize = (Vector2D(x, y) / pMonitor->scale).floor();