app: add App::subsurface_motion_only so a slide-to-reveal panel animates without re-rastering the main surface
Some checks failed
CI / build + test (push) Has been cancelled
CI / cargo audit (push) Has been cancelled

An app whose gesture/animation only moves an input-transparent subsurface (a slide-to-reveal panel over a static main surface) still paid a full main-surface re-raster on every frame of the slide, because the runtime force-dirties the main view on two paths it cannot tell apart from a real content change: `MoveOutcome::Swipe` calls `dirty_caches()` + `request_redraw()` per motion sample, and the `WlCallback` Main handler sets `view_dirty` + `request_redraw()` on every frame callback while `is_animating`. The subsurface reconcile already repositions the panel with a cheap `set_position` + bare parent commit, so the main re-raster is wasted work — and on slow targets (Librem5) it competes with the reposition and makes the slide stutter.
New opt-in `App::subsurface_motion_only` (default `false`, so existing apps are unaffected). When it returns `true`:
- the swipe dispatch (`input/dispatch/outcomes.rs`) still calls the `on_swipe_progress` family but skips `dirty_caches()` / `request_redraw()`; incoming motion events pump the loop and the per-iteration `reconcile_subsurfaces` carries the move.
- the frame-callback animation pump (`event_loop/handlers.rs`) keeps the vsync cadence without a re-raster by requesting a bare `wl.frame()` + `commit()` on the main surface (no buffer attach) instead of dirtying the view; `poll_external` advances the animation and the reconcile repositions each frame.
The main surface still redraws for genuine content changes (messages, resize, the one-shot redraw on swipe release) — only the per-frame slide raster is dropped.
This commit is contained in:
2026-06-01 21:53:40 +02:00
parent b8a32cfb96
commit d221d5a0cd
3 changed files with 40 additions and 7 deletions

View File

@@ -657,6 +657,17 @@ pub trait App: 'static
/// The event loop will keep requesting redraws at ~60 fps until this returns `false`.
fn is_animating( &self ) -> bool { false }
/// Return `true` when a finger-tracked swipe or an [`Self::is_animating`]
/// slide only repositions the app's input-transparent subsurfaces
/// ([`Self::subsurfaces`]) while the main surface buffer stays unchanged.
/// The runtime then skips the per-frame main re-raster that
/// [`Self::on_swipe_progress`] and `is_animating` would otherwise force,
/// keeping the animation pumped (motion events during the drag, a bare
/// frame callback while `is_animating`) and letting the per-frame
/// subsurface reconcile carry the motion. Use it for a slide-to-reveal
/// panel over a static main surface.
fn subsurface_motion_only( &self ) -> bool { false }
/// Return `true` while the next frame should swap the expensive
/// Glass passes for cheap fallbacks — currently the
/// `backdrop-filter` blur drops from a 41-tap kernel to a 9-tap