frameclock_wayland: add Wayland timing adapter crate - #39
Conversation
Introduce frameclock_wayland with the Wayland timing facts that previously only lived inside subduction_backend_wayland: compositor-aligned clock selection and reads (Clock, now, timebase), wp_presentation feedback facts (SubmissionId, PresentEvent, PresentEventQueue, presented-timestamp conversion), and the frame-callback ticker state machine (TickerState), decoupled from the backend's output registry by taking the target OutputId from the caller. The backend keeps its private copies for now; migrating it and the examples to this crate is left to future implementation, along with present-hint estimation and a retained FrameDriver wrapper.
|
TickerState carries one global last_observed_actual_present.
Otherwise, feedback from an unrelated surface or output can become |
|
The backend wrapper currently guards this at |
TickerState keeps a single most-recent actual-present timestamp and stamps it onto the next tick's prev_actual_present. Document that each instance models one paced surface/output stream: create one per wl_surface, pass a stable OutputId, and feed it only that surface's presentation feedback. Hosts multiplexing several surfaces on one queue should keep a TickerState per stream and correlate feedback by SubmissionId themselves. This makes the single-surface contract explicit for reuse beyond subduction_backend_wayland; SubmissionId-based correlation remains future work in the present-hint/driver wrapper layer.
mark_callback_requested now returns bool instead of only debug-asserting: true when the single in-flight callback slot was newly claimed, false when a callback is already in flight (leaving state unchanged). Marked #[must_use] so external hosts handle the rejected case instead of silently re-arming. Update the crate docs and example to claim the slot before sending the wl_surface.frame request, and add a test covering the rejected double request. subduction_backend_wayland keeps its own ticker and external guard until the backend is migrated to this crate.
Add a
frameclock_waylandcrate following theframeclock_apple/frameclock_webadapter split: compositor-aligned clock reads (Clock,now,timebase),wp_presentationfeedback facts (SubmissionId,PresentEvent,PresentEventQueue), and the frame-callback ticker state machine (TickerState, decoupled from the output registry by taking the targetOutputIdfrom the caller).Purely additive:
subduction_backend_waylandkeeps its private copies until a follow-up migrates it and the examples. Present-hint estimation and a retainedFrameDriverwrapper are likewise left to future implementation.