Skip to content

Player Tracks/More open frame: keep and preload the underlay envelope, warm the root page at mount - #365

Merged
GLinnik21 merged 3 commits into
mainfrom
perf/player-menu-open-frame
Oct 1, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
perf/player-menu-open-frame

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

Follow-up to the player sub-menus (#347, #352): the Tracks/More popover's OPEN frame cost 26–34 ms on the TV. It is now 18.7–19.3 ms.

What changed

  • The modal underlay keeps the player's UltraBlur corner envelope across the last dismissal.
    • New ModalUnderlay::retire / wake / drop_dormant. Before, every open re-latched and re-uploaded the envelope (ulatch, 5.5–7.3 ms).
    • A stack asking for the same corners adopts the kept envelope.
    • Any other stack drops it before anything reads it.
    • Dim-less player panels (Info, Chapters, Timing) leave it alone.
  • The envelope is preloaded while nothing is open.
    • Screen::underlay_corners (the player page) is noted in prepare_pass. ModalStack::preload_underlay latches it from the presenting block.
    • It only latches on an empty stack, on a quiescent page with no transition in flight, after 30 presenting frames at rest over the same envelope.
    • The note is cleared every prepare_pass, so it cannot outlive its frame.
  • Root strings are queued on the mount frame. TrackMenuState::warm_open / MoreMenuState::warm_open run from PlayerOverlayScreen::prepare (a speculative walk, drained by prepare_window on a presenting frame). Before, they were queued a frame late, in the first update.
  • draw_scrims / draw_scrims_on return early for an empty stack. They used to reset the kept field every frame.
  • New navcommit diag spans: dframe/dpre/dcommit/dpost/drecon/dhash/dprep/dsync/dstep/dafter/upre.

The visible pass is unchanged: same field, same dim, same path. Canon, state hash and replay are untouched.

TV

60 Hz panel, guest + mock, screen on, muted.

  • Open frame, Tracks: 26.1–33.7 ms before; total=18.7 … ulatch:0.0 after.
  • Open frame, More: 26.3 ms before; total=19.3 … ulatch:0.0 after.
  • Playback start: the one-time preload (upre, 5.7–7.2 ms) lands on one frame per playback (17.9 and 20.2 ms totals).
  • Still on the open frame: about 5 ms in dafter (focus seating on Enter) and the string drain.

Tests

  • a_corner_latch_survives_the_last_dismissal_and_the_same_corners_keep_it
  • a_kept_corner_field_never_leaks_into_a_different_stack_or_other_corners
  • an_empty_stacks_dim_pass_leaves_the_kept_envelope_alone
  • a_noted_envelope_is_preloaded_for_the_first_open_and_never_over_a_live_field
  • a_dimless_player_panel_opening_and_closing_keeps_the_envelope
  • the_preload_waits_for_a_page_at_rest
  • a_stale_noted_envelope_is_not_preloaded_over_a_live_stack
  • a_player_panel_presented_over_the_kept_field_adopts_it_through_the_dim_pass
  • the warm_open tests for Tracks and More

Gates on the committed tree (4bbf97195):

  • cargo test --lib: test result: ok. 5402 passed; 0 failed; 7 ignored
  • --no-default-features check: clean
  • ARM make: rc 0
  • make check: rc 0 (5402 / 5479 / 102 passed, 0 failed)

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits October 1, 2026 19:34
…, preload it, warm the root page at mount

The open frame of the player's Tracks/More popover cost 27-34 ms on the television:
- `ulatch` (5.5-7.3 ms): the modal underlay re-latched the playing item's corner envelope (a
  1920-texel reconstruction plus an upload) on every open, because `prune` reset the field on every
  close. A corner envelope is now kept dormant across the last dismissal, adopted by the next stack
  that asks for the same corners and dropped before anything reads it by any other; it is also
  latched on a presenting frame while nothing is open (`Screen::underlay_corners` ->
  `ModalUnderlay::preload` in `prepare_window`), so the first open of a playback pays nothing. The
  dim pass no longer touches the field for an empty stack, which would otherwise reset it every
  frame.
- the root page's strings (`textx4`, 2-10.8 ms): a surface mounts after its frame's Tick fan-out
  was built, so its first `update` (which queues the prewarm walk) ran a frame late. The overlay's
  `prepare` now queues the root page (`warm_open`) on the mount frame, ahead of the presenting
  side's drain.
- navcommit's unattributed remainder gets spans: dframe, dpre, dcommit, dpost, drecon, dhash,
  dprep, dsync, dstep, dafter, upre.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…velope, preload only at rest on an empty stack, stale note cleared, docs and tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o it never lands on the playback-start frame

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 285f18a into main Oct 1, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the perf/player-menu-open-frame branch October 1, 2026 17:33
GLinnik21 added a commit that referenced this pull request Oct 1, 2026
…lay preload debounce (#372)

The underlay preload debounce from #365 was never wired: the dispatcher
called want_corners directly, so the ~8 ms reconstruction latched on the
first quiescent frame instead of waiting out the playback-start frames. The
prepare pass now calls ModalUnderlay::note_at_rest once per pass; a note
stands only after PRELOAD_REST_FRAMES consecutive passes at rest over the
same envelope, and a changed envelope or a pass with nothing to note
withdraws it. A test through Dispatcher::frame covers the call site.

Simplifications over the #365 and #370 code, behaviour-preserving:
ModalUnderlay::latch_corners replaces two copies of the corner latch,
PanelMotion::warm_open replaces is_warm and the duplicated guard in the
Tracks and More menus, and four items lose visibility they did not need.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant