From a075a2941f8fcdae155495da634cf63368c950b7 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Fri, 16 Oct 2026 09:33:39 +0300 Subject: Pace frame requests by the frame presented after them A frame request now only records intent. Each loop step resolves it after the callbacks that present, so a request made before the present waits for that frame. An animation that asked first got two REFRESH events per frame on X11 and with GL. With no frame in flight, the REFRESH comes one refresh interval after the last present or answer, so a request without a present cannot spin. Queued events now go before an owed REFRESH. Input reaches the application before it draws, and a queued REFRESH pays an owed one for the same surface. The loop prepare only peeks at a lost event, so deliver can report it as a final loss. A failed push from another thread wakes the loop. Signals and posts run at the end of a step, after descriptors and timers. A signal handler now sees the output that came with it. A render-thread GL swap counts as in flight on Wayland. Co-Authored-By: Claude Opus 5.5 --- src/common/events.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/common/events.c') diff --git a/src/common/events.c b/src/common/events.c index 83baf11..c310f06 100644 --- a/src/common/events.c +++ b/src/common/events.c @@ -71,6 +71,15 @@ int yasl_private_events_error(struct yasl_private_display *d) return error; } +bool yasl_private_events_failed(struct yasl_private_display *d) +{ + if (!d->events) return false; + yasl_private_mutex_lock(&d->events->mutex); + bool failed = d->events->error != 0; + yasl_private_mutex_unlock(&d->events->mutex); + return failed; +} + bool yasl_private_events_pending(struct yasl_private_display *d) { if (!d->events) return false; @@ -207,6 +216,8 @@ failed: yasl_private_mutex_lock(&d->events->mutex); d->events->error = ENOMEM; yasl_private_mutex_unlock(&d->events->mutex); + /* The loss is an event too; the owner reports it in its next step. */ + yasl_private_loop_wake(d->loop); errno = ENOMEM; return false; } -- cgit v1.2.3