Skip to content

Simplify the menu-open frame and frame-probe code, and wire the underlay preload debounce - #372

Merged
GLinnik21 merged 3 commits into
mainfrom
simplify/open-frame-and-probe
Oct 1, 2026
Merged

GLinnik21 merged 3 commits into
mainfrom
simplify/open-frame-and-probe

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

What

A simplify pass over the code added by #365 (menu-open frame) and #370 (HUD clock prewarm and frame probe), which landed after the earlier pass in #357. It also fixes one defect the pass uncovered.

Fix: the underlay preload debounce was never wired

#365 added PRELOAD_REST_FRAMES and ModalUnderlay::note_at_rest so the ~8 ms underlay reconstruction waits out the playback-start frames, but the dispatcher called want_corners directly, so the latch ran on the first quiescent frame. The unit test drove ModalUnderlay alone and passed regardless.

  • The dispatcher's prepare pass now calls note_at_rest exactly once per pass, with None on every path that does not reach the page's note.
  • A note stands only after 30 consecutive prepare passes at rest over the same envelope. A changed envelope or a None pass restarts the count and withdraws any unconsumed note.
  • New test the_dispatchers_prepare_notes_the_envelope_only_after_the_page_has_rested goes through Dispatcher::frame. It failed against the old call site with frame 1 of 30: nothing latched yet.

Consequence: a popover opened within about half a second of the player page first resting, or of the envelope changing (next episode), pays the latch on its open frame. After that the field is held as before.

Simplifications (behaviour-preserving)

  • ModalUnderlay::latch_corners replaces the two copies of the reset / latch / held update in sync and preload.
  • PanelMotion::warm_open replaces is_warm plus the duplicated guard in the Tracks and More warm_open bodies.
  • ModalUnderlay::is_dormant, ClockWarm::queue, FrameRing::BEFORE and AFTER are private.

The frame probe's FFI shape, the FRAMEDROP fields and the arm_wayland_debug ordering are untouched.

Verification

  • make check on the committed tree: test result: ok. 5428 passed; 0 failed; 7 ignored, test result: ok. 102 passed; 0 failed, test result: ok. 5508 passed; 0 failed; 7 ignored.
  • cargo +nightly check --lib --no-default-features: rc=0.
  • ARM cross-build: ok at the second commit; the third commit (one line in note_at_rest, test and doc changes) relies on CI for it.

Not verified on the device: whether 30 passes clears the heavy playback-start frames, and whether the menu=1 dev trigger at t0+6 s now opens before the preload has run, which would change the open frame the track-menu-submenu-osc scene sees inside its warm-up. The open-frame figure in docs/player-submenus.md was measured before this change.

🤖 Generated with Claude Code

GLinnik21 and others added 3 commits October 1, 2026 22:45
…d preload debounce, share the corner latch and the warm_open guard, tighten visibility

ModalUnderlay::note_at_rest, PRELOAD_REST_FRAMES and its counters were only exercised by a test; production notes the envelope through want_corners. The corner latch in sync and preload is one latch_corners, and the Tracks and More warm_open bodies share PanelMotion::warm_open instead of repeating the is_warm guard.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The page's envelope reached ModalUnderlay through want_corners, so PRELOAD_REST_FRAMES gated nothing in production and the ~8 ms reconstruction could land on a playback-start frame. prepare_pass now notes through note_at_rest exactly once per pass, None on every path that does not reach the page (non-live host render, no top entry, a surface up, page not at rest), and a None note withdraws the standing one. A dispatcher-level regression test drives the real call path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the dispatcher test and the doc

note_at_rest's changed-envelope arm now clears wanted like the None arm, so an unconsumed note cannot latch the old envelope. The dispatcher test reads wanted before preload_underlay can mask it, covers both clearing arms, and sets its state up explicitly. The rest count is documented as prepare passes, ~0.5 s only while the video plane is bound.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 3a485a9 into main Oct 1, 2026
9 checks passed
@GLinnik21
GLinnik21 deleted the simplify/open-frame-and-probe branch October 1, 2026 20:41
GLinnik21 added a commit that referenced this pull request Oct 1, 2026
… back-buffer-wait capture showed (#377)

The first TV run read the non-consuming `trace` file, which re-walks the ring on every read on the
4.4.84 kernel: 3.3 s of data took about nine minutes, the ring had overrun, a third of the events
were arch-timer noise and no syscall events were enabled for the analyser.

The read-back now drains trace_pipe on the set (gzipped there), ends when the per-CPU stats show an
empty buffer, and is bounded on the host by --read-timeout (default 90 s); a stopped read-back keeps
what arrived as a valid gzip. Entries and overrun are printed per CPU. The arch timer is filtered
out of the irq events (string filter, falling back to irq numbers). The ring is sized for the
capture and capped at 32 MB. --tid N enables raw_syscalls for that thread. Restore clears all of it.
tools/test_tv_sched_trace.py drives the script against a fake tracefs and a fake tv-ssh and is
wired into check-python.

docs/player-submenus.md replaces the "next TV session" plan with the results: the GPU is idle
during the long waits; osd_irq paces commits at 8.33 ms; 29 of 31 steady-state waits of 18 ms or
more followed an on-time commit and are the compositor's, 2 followed platform threads preempting
the frame thread; the text prewarm drain was unbounded (fixed in #376); the #372 preload did not
drop a frame; WAYLAND_DEBUG printed nothing on this firmware.

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