app: add App::subsurface_motion_only so a slide-to-reveal panel animates without re-rastering the main surface
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:
@@ -620,8 +620,24 @@ impl<A: App> Dispatch<WlCallback, super::SurfaceFocus> for AppData<A>
|
||||
state.main.frame_pending = false;
|
||||
if is_animating
|
||||
{
|
||||
state.view_dirty = true;
|
||||
state.main.request_redraw();
|
||||
if state.app.subsurface_motion_only()
|
||||
{
|
||||
// The main buffer is unchanged; only the subsurface
|
||||
// moves (repositioned by the per-frame reconcile).
|
||||
// Keep the vsync cadence with a bare frame callback +
|
||||
// commit — no buffer attach, no re-raster.
|
||||
if let Some( wl ) = state.main.surface.try_wl_surface().cloned()
|
||||
{
|
||||
let _ = wl.frame( &state.qh, super::SurfaceFocus::Main );
|
||||
wl.commit();
|
||||
state.main.frame_pending = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state.view_dirty = true;
|
||||
state.main.request_redraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
super::SurfaceFocus::Overlay( id ) =>
|
||||
|
||||
Reference in New Issue
Block a user