aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2023-02-26 14:17:38 +0000
committervaxerski <[email protected]>2023-02-26 14:17:38 +0000
commit32686d203aaf7110673d16a6d3df45e85efbb068 (patch)
treef62e19ce52696fbd9a9ba681f57390ebc9b8b0ea
parenteb3c114fa8d8cc03a716a7a09b867389da7f11d3 (diff)
downloadHyprland-32686d203aaf7110673d16a6d3df45e85efbb068.tar.gz
Hyprland-32686d203aaf7110673d16a6d3df45e85efbb068.zip
properly schedule frames during renderingpluginSystem
-rw-r--r--src/Compositor.cpp3
-rw-r--r--src/debug/HyprNotificationOverlay.cpp2
-rw-r--r--src/events/Monitors.cpp10
-rw-r--r--src/helpers/Monitor.hpp3
4 files changed, 17 insertions, 1 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index ff64dbf6..a7d48a15 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -2024,6 +2024,9 @@ void CCompositor::scheduleFrameForMonitor(CMonitor* pMonitor) {
if (!pMonitor->m_bEnabled)
return;
+ if (pMonitor->renderingActive)
+ pMonitor->pendingFrame = true;
+
wlr_output_schedule_frame(pMonitor->output);
}
diff --git a/src/debug/HyprNotificationOverlay.cpp b/src/debug/HyprNotificationOverlay.cpp
index a45ba2b2..94cb6a6c 100644
--- a/src/debug/HyprNotificationOverlay.cpp
+++ b/src/debug/HyprNotificationOverlay.cpp
@@ -132,6 +132,8 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
g_pHyprRenderer->damageBox(&damage);
g_pHyprRenderer->damageBox(&m_bLastDamage);
+ g_pCompositor->scheduleFrameForMonitor(pMonitor);
+
m_bLastDamage = damage;
// copy the data to an OpenGL texture we have
diff --git a/src/events/Monitors.cpp b/src/events/Monitors.cpp
index 840d9cae..271b7d81 100644
--- a/src/events/Monitors.cpp
+++ b/src/events/Monitors.cpp
@@ -197,6 +197,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
return;
}
+ PMONITOR->renderingActive = true;
+
// we need to cleanup fading out when rendering the appropriate context
g_pCompositor->cleanupFadingOut(PMONITOR->ID);
@@ -207,6 +209,8 @@ void Events::listener_monitorFrame(void* owner, void* data) {
if (*PDAMAGEBLINK || *PVFR == 0)
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
+ PMONITOR->renderingActive = false;
+
return;
}
@@ -309,12 +313,16 @@ void Events::listener_monitorFrame(void* owner, void* data) {
pixman_region32_fini(&frameDamage);
pixman_region32_fini(&damage);
+ PMONITOR->renderingActive = false;
+
if (!wlr_output_commit(PMONITOR->output))
return;
- if (*PDAMAGEBLINK || *PVFR == 0)
+ if (*PDAMAGEBLINK || *PVFR == 0 || PMONITOR->pendingFrame)
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
+ PMONITOR->pendingFrame = false;
+
if (*PDEBUGOVERLAY == 1) {
const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - startRender).count() / 1000.f;
g_pDebugOverlay->renderData(PMONITOR, µs);
diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp
index 6582cbfc..9ad6d917 100644
--- a/src/helpers/Monitor.hpp
+++ b/src/helpers/Monitor.hpp
@@ -42,6 +42,9 @@ class CMonitor {
bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed.
bool createdByUser = false;
+ bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after
+ bool renderingActive = false;
+
// mirroring
CMonitor* pMirrorOf = nullptr;
std::vector<CMonitor*> mirrors;