From 0e521788bcc414c9cf81648d3167757d83deb60f Mon Sep 17 00:00:00 2001 From: Ikalco <73481042+ikalco@users.noreply.github.com> Date: Tue, 15 Apr 2025 18:02:31 -0500 Subject: core: wait for dmabuf readiness (#9806) * add doOnReadable to event loop manager * move syncTimeline addWaiter to doOnReadable * wait on dmabuf buffers to be readable * don't over synchronize in scanout, also give present feedback on same buffer commit --- src/managers/eventLoop/EventLoopManager.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/managers/eventLoop/EventLoopManager.hpp') diff --git a/src/managers/eventLoop/EventLoopManager.hpp b/src/managers/eventLoop/EventLoopManager.hpp index f240dae9..8a0e0439 100644 --- a/src/managers/eventLoop/EventLoopManager.hpp +++ b/src/managers/eventLoop/EventLoopManager.hpp @@ -38,6 +38,17 @@ class CEventLoopManager { std::vector> fns; }; + struct SReadableWaiter { + wl_event_source* source; + Hyprutils::OS::CFileDescriptor fd; + std::function fn; + }; + + // schedule function to when fd is readable (WL_EVENT_READABLE / POLLIN), + // takes ownership of fd + void doOnReadable(Hyprutils::OS::CFileDescriptor fd, const std::function& fn); + void onFdReadable(SReadableWaiter* waiter); + private: // Manages the event sources after AQ pollFDs change. void syncPollFDs(); @@ -58,8 +69,9 @@ class CEventLoopManager { Hyprutils::OS::CFileDescriptor timerfd; } m_sTimers; - SIdleData m_sIdle; - std::map aqEventSources; + SIdleData m_sIdle; + std::map aqEventSources; + std::vector> m_vReadableWaiters; struct { CHyprSignalListener pollFDsChanged; @@ -67,7 +79,6 @@ class CEventLoopManager { wl_event_source* m_configWatcherInotifySource = nullptr; - friend class CSyncTimeline; friend class CAsyncDialogBox; }; -- cgit v1.2.3