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
This commit is contained in:
Ikalco
2025-04-15 18:02:31 -05:00
committed by GitHub
parent ffd6cf65e4
commit 0e521788bc
8 changed files with 147 additions and 116 deletions

View File

@@ -38,6 +38,17 @@ class CEventLoopManager {
std::vector<std::function<void()>> fns;
};
struct SReadableWaiter {
wl_event_source* source;
Hyprutils::OS::CFileDescriptor fd;
std::function<void()> 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<void()>& 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<int, SEventSourceData> aqEventSources;
SIdleData m_sIdle;
std::map<int, SEventSourceData> aqEventSources;
std::vector<UP<SReadableWaiter>> m_vReadableWaiters;
struct {
CHyprSignalListener pollFDsChanged;
@@ -67,7 +79,6 @@ class CEventLoopManager {
wl_event_source* m_configWatcherInotifySource = nullptr;
friend class CSyncTimeline;
friend class CAsyncDialogBox;
};