Skip to content

perf: one backdrop mechanism for every live glass, an async underlay field, and held-image page transitions - #178

Merged
GLinnik21 merged 33 commits into
mainfrom
perf/stress-v3
Sep 19, 2026
Merged

GLinnik21 merged 33 commits into
mainfrom
perf/stress-v3

Conversation

@GLinnik21

@GLinnik21 GLinnik21 commented Sep 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

This lands the ambient/overlay performance line that has been developing on perf/stress-v3, merged onto current main:

  • One backdrop mechanism for every live glass (rust-modules/src/ui/frame/backdrop.rs, GlassPlan), replacing the old per-screen mechanism (Dispatcher::prepare_present, Screen::prepare_present, Popover::prepare_present, popover::glass_refresh, GlassState, Glass::CACHED) end to end — confirmed via git grep that none of those symbols remain anywhere in the merged tree. A declaration traversal records each frame's glass rectangles and exact draw arguments (transforms, clip bounds, material values, text bytes, texture revisions); a source refreshes only when its sampling footprint's recorded arguments actually changed underneath it. No shared cadence clock, no glasshz override — those are gone with the mechanism they governed.
  • A ticket-based, async underlay-field readback (gfx::field_kick/FieldTicket/field_collect/field_frame_begin/field_frame_end), replacing the old synchronous gfx::sample_underlay_field. The reduction is queued on the frame that captures the host and read back at the head of a later drawn frame once an EGL fence has signalled, so the 480-byte glReadPixels never blocks on the GPU.
  • PageDip page transitions that hold a captured image of the outgoing page rather than cross-fading two live pages.
  • Fixes to the backdrop mechanism found while building it: text packing, recording-boundary correctness, discovery side-effect-freedom, capture dependency-following, alpha-invariant filtering.
  • Two repeated per-frame measurements removed (a wrapped text run, a rating group — each now measured once and reused).
  • FRAMEDROP gained a disc span (the discovery/declaration walk) and a dip=out|hold|in|held|live phase field for PageDip attribution.
  • A new dithered panel program, shaders/fs_field_panel.frag (widgets::panel_ground's panel twin of fs_field.frag), bringing the dithered-program count to four (fs_ambient, fs_field, fs_field_panel, fs_glass).

The duplicate deep-bench commit already on main (a52271fe here ≡ cdc831a8/#176 there) was dropped during the merge; main's copy is what's kept.

Conflict resolution notes

The merge against origin/main (31 commits ahead) touched ~30 files. Resolution kept both sides' behavior throughout — main's independent, unrelated work (the onboarding report flow, the ALL-CAPS clickable-text-mark rule, the "no red" Failed read-out redesign, the person-page Filmography/bio gap retune, PlayingItem::show_rk, PR #169's valid_choice() fix) is preserved alongside this branch's backdrop/field work, never one at the expense of the other. Two follow-up fixes were needed after the merge compiled clean but failed at test/build time:

  • a duplicated Screen::scrim() impl the merge left in screens/library/menu.rs,
  • a stray call to the now-removed popover::note_own_damage() in decision_alert.rs's main-only reconcile_card(),
  • popover_host_tests.rs's CPU-standin FrameCache needed the same render_available/tex/render_into/finish_render/rendered/draw_alpha/resident_bytes surface the real gfx::FrameCache gained on this branch (it always declines the FBO-render path, matching render_available's own "no GL context in a host test" doc, and falls back to the existing capture/draw copy path).

A doc-claim-auditor pass against the full merge diff found two stale claims, both fixed: docs/liquid-glass.md §4 still described the retired DEFAULT_DYNAMIC_PERIOD/EveryChangedPresent cadence clock as live code, and rust-modules/src/ui/CLAUDE.md's shared-dither paragraph still said "three" dithered programs instead of four (missing fs_field_panel).

An fw-compat-reviewer pass on the one new FFI surface this branch adds (a private re-declaration of the already-linked glBindFramebuffer symbol in surface.rs, backing the new PageTarget render-into-texture path) came back PASS — safe to push: proven in the built ELF, not inferred — .dynsym carries exactly one UND glBindFramebuffer entry, DT_NEEDED is unchanged (15 entries, byte-identical to ci/expected-dt-needed.txt), and the firmware load matrix passes on all 9 gated releases (4.4.2 through 11.2.0). The EGL fence mechanism this branch's field_kick pipeline relies on was already reviewed before this branch's HEAD and untouched by the merge (git diff against egl.rs is empty), so it was not re-reviewed.

Verification

  • cargo +nightly test --manifest-path rust-modules/Cargo.toml --lib — 3958 passed, 0 failed
  • CARGO_INCREMENTAL=0 cargo +nightly check --manifest-path rust-modules/Cargo.toml --lib --no-default-features — clean
  • make check — full host suite + lint gate, clean
  • make — ARM cross-build, clean link

Measured on the television

Interleaved in one session against integ/stress@e8c016dc (the per-screen build this line replaces), panel off, sound muted, guest identity. Raw logs: the coordinator's ab-r7 run set.

Bench this line integ/stress
modal-100, cycles with a frame over 20 ms 16, 14 15
push-100, cycles with a frame over 20 ms 29, 25 35
push-100 worst frame 90.5 ms, 91.5 ms 120.5 ms

Regression scenes, all nine PASS on this line: home-hero 60 fps, home-fold 57, home-grid 44 (floor 20), detail-transition 58, item-menu (ceiling-gated), settings-root 61, library-scroll 61, home-acct-glass 61, modal-ramp worst frame 20.1 ms against a 75 ms ceiling. Mid-transition captures show no blank page, no flash, no stale content and no wrong page.

Where the remaining over-20 ms frames are, by the new dip= field: overwhelmingly dip=live — ordinary drawing of a freshly opened page, dominated by the page span — not the transition machinery. deep-100 (200 steps) runs 120 steps over the ceiling, and its memory does not return to baseline after a full unwind (+33.7 MB at the root). A 100-page unwind host test covering the stack, eviction and remount, retired entries, queued return states and focus memory passes as written, so the navigation stack's own bookkeeping is NOT the retainer; the owning allocation is unidentified.

These two — the live page draw of a fresh page, and the unwind retention — are the tracked follow-up. The stress ceilings stay where they are.

What's still open

The numbers above were measured on the branch tip before this merge with main; the merged tree itself has not been re-graded on the television. The stress ceilings still fail, and closing them is tracked work, not a reason to loosen a gate.

🤖 Generated with Claude Code

GLinnik21 and others added 30 commits September 19, 2026 08:02
The owner reported banding that appears during animations on the ambient
background. `gfx::page_wash_dither` was the page's slide flag AND the page's
motion verdict, and every spring integrator reports to `idle::note_spring` —
including `AmbientWash::step`'s own twelve corner springs. So the wash
undithered itself for the whole of its colour dissolve, and every focus pop,
shelf scroll and press dip on the page did the same to it.

The predicate is now the identity on its argument, and the argument is the
owning screen's answer to one question: is translucent artwork sliding or
fading over this wash right now.

- Home computes it where it steps the snap dive, from the spring's position
  AND velocity plus the hero-slide flag (`Backdrop::still`). The position test
  the draw used to make is blind to a critically damped tail, which is what the
  motion verdict had been compensating for; one `snap_moving` expression now
  feeds both the backdrop and the present gate.
- Detail asks its scroll velocity and how far its art ease still has to travel
  (`art_still`), the latter derived from `ease`'s own rest threshold.
- `PageGround` — the browsing grounds, which never have artwork over them —
  dithers unconditionally and no longer takes the gate at all.

`idle::underlay_moving` lost its last reader with this and is deleted, along
with `note_underlay_motion` and the thread-local behind them; the host cache
already takes the same verdict for itself in `begin_frame`.

Detail keeps its bare `AmbientWash` rather than moving to `PageGround`: that
type draws itself whenever it is not flat and dithers unconditionally, and
Detail must not lay a wash over a live video plane and does need a per-frame
dither answer.

Tests: two regressions watched red first — a wash dissolving to a new item, and
an unrelated focus spring at scope depth 0 — plus the pinned policy test
rewritten to assert that no motion this frame can raise moves either answer.

Device verification of fps and banding is pending; `docs/backdrop-blur-
profiling.md` carries a dated addendum saying so.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
PR1 took library-scroll 60 -> 45 and home-grid 56 -> 51 on the set. The
census found four costs, fixed as shared mechanisms:

- dither.glsl: the tile coordinate is a varying from the paired vertex
  shader (glsl_vs_dithered!, PLX_DITHER_NC), not a highp multiply of
  gl_FragCoord per fragment (cost rule 4).
- dither.glsl: the prelude is straight-line. The uniform branch measured
  +5.8M arithmetic words a frame on a scrolling Library (49 vs 59 fps);
  OFF is the plain twin program (rule 1, rewritten).
- fs_img: card interiors further than the rim's reach return the texel
  before the rounded-rect SDF (u_inner, gfx::card_inner).
- fs_ambient: the bilinear field is evaluated per vertex of a 16x16-cell
  mesh (gfx::field_mesh, error < half a code), so the wash is one varying
  plus the dither per fragment.

With those in, the art gate is deleted: gfx::page_wash_dither,
home::Backdrop::still and detail::art_still. A mid-dive capture showed
the wash-only band under Home's hero at adjacent-pixel change 0.023
(undithered) with the gate, ~0.70 without. draw_ambient,
Painter::ambient and AmbientWash take no dither flag.

Detail's TextView wrap goes through the global wrap_memo when the
measurer's font is live (Measure::live_font).

Device, two runs each: hero 60, fold 57 (rmin 55), grid 58/57 (56),
detail 59/58, settings 60, library 60, acct-glass 58. The fold remains
below 58; its census is in docs/backdrop-blur-profiling.md.

Co-Authored-By: Claude Opus 5 <[email protected]>
An overlay has had two ways to relate to the page under it, and both
throw away WHERE: a flat scrim says nothing about the page, and a
four-corner envelope says it is greenish but cannot say the green is on
the left of the bottom edge. The underlay field is the third: the frame
reduced to 15x8 cells, low-passed, graded and reconstructed to 60x32,
drawn as one magnified quad. No blur pass. The low-pass kernel is a literal table (pinned by a test
against exp), so the libm allow-list does not grow.

GPU half (gfx.rs): sample_underlay_field() copies the viewport and runs
exact 2x box passes down to 15x8 (seven halvings on the television),
then one glReadPixels. It refuses inside a blur source pass, on a
video-plane frame, while the page is served from FrameCache, under
drawmask=field, and on a drawable the exact-2x chain cannot be built
for. Row order is derived from the pass count, not asserted. GL state is
restored the way cap_cycle restores it. draw_field() draws through a new
fs_field.frag (one fetch, one multiply, the shared dither) over
vs_src.vert, in the slot fs_modal_ground held, so the dithered-program
count is still three. Class::Field joins the overdraw ledger and mask.
gfx::lin/enc are factored out of diffuse_ground_mean.

CPU half (ui/underlay.rs): UnderlayField with latch_from_frame,
latch_from_corners (the CPU source for the video plane and pre-Home),
reset, sample, key and draw(Role). Every step is a pure function a host
test can grade. The Ground grade goes through AmbientWash::keyed_one,
the new single-sample function AmbientWash::keyed is now four of, so a
120-cell ground and a four-corner ground are one palette. Role::Dim at
weight 0, or on an unlatched field, is the plain scrim_black rect to the
bit. Painter::field and Painter::field_ground sit beside ambient/grad4;
field_ground fades toward SURFACE_APP as ambient does. The state lives
on its owner, with no static mut, and the texture is freed on Drop.
Nothing consumes it yet; stage B migrates RouteGround.

Deleted, all verified dead by grep and by the release-config check:
Popover::modal_ground (no callers) -> Glass::modal_ground ->
Painter::backdrop_blur_flat -> gfx::draw_blur_snapshot_flat ->
fs_modal_ground.frag and its MPROG program, plus the five theme tokens
only that chain (or only their own test) read: MODAL_SAMPLE_MATERIAL,
MODAL_FROST_ALPHA, MODAL_BLUR_TAPS, MODAL_BLUR_TINT and
MODAL_BLUR_SATURATION.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
PR2 stage B. RouteGround now holds an UnderlayField (rust-modules/src/ui/
route_screen.rs) instead of the private four-corner AmbientWash envelope:
draw_host latches once from the live frame (Grade::Ground), falling back to
the authored corners on any refusal (video plane, frozen page, blur pass,
non-power-of-two drawable); for_home/draw_default/draw_home latch straight
from corners. sample()/palette() keep their old contracts, sourced from the
field. gfx::sample_modal_ambient and ModalAmbientSample are gone along with
mean_key/mean_target_key, now that the field is the only reader of a live
frame.

draw_host and draw_default are split into a private latch_host/latch_default
step plus the draw call, so a host test can prove the latch-once and
frame-refusal-falls-back-to-corners behavior without ever calling
UnderlayField::draw: unlike draw_field (tex == 0 || UPROG == 0 gated),
draw_rect has no such guard, and a host test binary links OpenGL.framework
but never creates a context, so any unguarded draw is an immediate SIGSEGV.

Updated the doc references in gfx.rs, theme.rs, fixture.rs (the "four doors"
video-plane spec test's literal moved from route_screen.rs to gfx.rs, since
the refusal now lives inside sample_underlay_field) and ui/CLAUDE.md that
named the retired sampler or described RouteGround's old shape.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
… stack

A surface's dim is no longer a black sheet: `ModalStack` owns one
`UnderlayField` (`ModalUnderlay`) and paints every surface's dim through it as
`Role::Dim { weight: theme::underlay::TINT }`, so the page's own light stays
where it is under the panel. The field is read at the head of
`draw_scrims`, inside the frame's first `host::live()` and before any dim —
the undimmed page — re-read when `popover::host::page_epoch` moves (the host
snapshot was re-taken), and reset with the last surface. `TINT = 0` is the
old flat `scrim_black` to the bit.

The weights are roles in a new `theme::underlay` table (DIM_COMPACT 0.34,
DIM_PANEL 0.46 — was `alert::SCRIM_A` — DIM_SHEET 0.50, DIM_DECISION 0.55,
DIM_PLAYER 0.58, DIM_PROSE 0.72); every private SCRIM_A and literal is gone,
and a source-grep test keeps it that way. The Library's Sort/Filter menu
gains the COMPACT dim.

The player's track and `…` menus stop hand-drawing their dims: they ask the
container like every other surface, over `UnderlaySource::Corners` from the
playing item's UltraBlur envelope (new `PlayingItem::blur`), since GL cannot
read the video plane; the Info card and Chapters strip still ask for none.

Co-Authored-By: Claude Opus 5 <[email protected]>
Adds plxnative-pushbench[=<n>[,<ratingKey>]] and
plxnative-modalbench[=<n>[,<ratingKey>]], the counted twins of navosc/modalosc:
n deterministic push->settle->pop / present->settle->dismiss cycles through the
real bridge entry points (nav_push/nav_pop/nav_tab, open_settings/
open_account_menu/open_item_menu/open_content_panel, dismiss_surfaces),
rotating Detail/Person/Library and Settings/AccountMenu/ItemMenu/About
respectively. Each cycle logs `bench: kind=<k> cycle=<i>/<n> target=<t>
worst_ms=<f> frames=<k> dur_ms=<d> rss_kb=<r>`, reusing Instruments' existing
Top->Swap frame-time stamps via a new narrow last_frame_ms() accessor; a
`bench: kind=<k> done cycles=<n>` line closes the run and the oscillator goes
idle. Library menu and Filmography are left out of the modal rotation — both
need an already-mounted page (Library section / Person from cast data) that
only push navigation produces, which push-100 covers separately; see
ModalBench::new's doc.

tests/run.py gains parse_bench/grade_bench: FAIL unless every cycle completed
and the `done` line lands, every cycle's worst_ms is under bench_worst_ms
(default 20.0), the last-10-vs-first-10 mean worst_ms drift is under
bench_drift_ms (default 2.0), and RSS growth from cycle 10 onward is under
bench_rss_growth_kb (default 8192kB); bench_latch_exempt_ms optionally
absorbs one named cycle per run. New push-100/modal-100 fps_scenes exercise
both. Pure cycle/rotation state machine factored into dev/scenarios/bench.rs
(BenchClock/PushBench/ModalBench) with 7 unit tests driven by a fake clock;
tests/test_harness.py gains 9 tests for the parser/grader covering the pass
case and all four fail conditions plus the exemption.

Co-Authored-By: Claude Opus 5 <[email protected]>
…hrome-only

Popover and alert panels stop frosting a live backdrop blur. Each panel's
ground is now the 15x8 underlay field the modal dim already latches,
sampled through the panel's own screen rect (UV = rect / screen size), so
the page's light stays where it is on the page. The field is multiplied by
theme::underlay::PANEL_TINT, capped so the brightest texel under the panel
lands at PANEL_LUMA_MAX (the ground_capped rule applied per panel), and the
existing frost quad and rim go over it. An unlatched field draws the flat
PANEL_TOP/BOT sheet.

- New dithered program fs_field_panel (gfx::draw_field_panel,
  Painter::field_panel). UnderlayField keeps a per-texel luma table and adds
  panel_plan/draw_panel. widgets::panel_ground is the one ground every panel
  calls.
- Surfaces get the field through DrawFrame::underlay, set in the
  dispatcher's surface loop. That covers item_menu, account_menu,
  alt_sources, about_panel, tracks_panel, library/menu and person_bio.
- decision_alert is drawn from inside its page, so it latches its own field
  at the head of draw_scrim, before its dim. Over the video plane the
  sample is refused and the panel draws the flat sheet.
- Deleted: Glass::panel/sheet, Glass::CACHED and GlassRefresh::Cached,
  needs_page_scrim, the non-clock activate/prepare, the popovers'
  GlassState, Popover::with_glass/open_on/sheet/prepare_present*,
  glass_refresh, the OWN_DAMAGE/OWN_MOTION ledger and note_own_damage,
  host::own_damage_this_frame, Screen::prepare_present,
  Dispatcher::prepare_present and its app/run.rs call,
  GlassPlan::prepare_dynamic and clock(), and the about panel's
  blur-region test.
- The top bar's standing track, the profile chip capsule and the dev tile
  band keep real glass (Glass::DYNAMIC_BACKDROP).

Tests:
- Panel UVs equal the rect over the screen size, including mid-slide.
- An unlatched field draws the flat sheet.
- The luma cap applies only to texels under the panel.
- Text contrast floors hold over white, black and yellow underlays.
- A source grep proves the blur path is chrome-only and every migrated
  panel calls panel_ground.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ame late

Home's hero countdown noted PresentEvent::Motion on every tick, so a settled
Home kept presenting full ~24 ms GPU frames forever and the next transition
inherited the backlog. The countdown is a timer; the flip wakes the gate.

The modal dim's underlay field was reduced and read back (glReadPixels) on
the frame the host snapshot was taken: 26-37 ms of every modal's 60-69 ms
open frame on the television. gfx::field_kick now queues the chain (from the
host's Held::Page texture when it has one, saving the full-screen copy) and
gfx::field_collect reads a ticket FIELD_READ_LAG_SWAPS drawn frames later.
ModalUnderlay holds the host's Held::Ground stage off until the read lands;
RouteGround defers its latch while its surface is still invisible. One frame,
not two: two made the read free but the collecting frame worse (measured).

Adds diag::spans: FRAMEDROP lines now carry per-phase GPU/CPU attribution.

modal worst_ms p50 63.9 -> 42.6 ms (16-cycle run); the benches still fail
their 20 ms ceiling: Home's steady GPU cost, Settings' first visible ground
latch and the Detail/Library page fill remain. See
docs/backdrop-blur-profiling.md, 2026-09-19.

Co-Authored-By: Claude Opus 5 <[email protected]>
… field read, held first frame

The modal open frame used to stall the GPU in several places. This commit removes each one.

- FrameCache::render_into: the host page is drawn straight into the snapshot texture instead of
  being copied off framebuffer 0 mid-frame.
- gfx::field_kick / field_collect: the underlay field's readback now waits on an EGL fence
  (egl::fence) and is never a synchronous drain.
- The stack queues its read on the first frame a dim is SEEN, and RouteGround::draw_host latches
  on the first frame its ground is visible.
- gfx::may_read_ground: a frozen page never issues the tab-track / Hero-row glReadPixels. Before
  this, every 30th frame of a modal held over Home drained the GPU for 21 ms.
- underlay::texture_rgba: the reconstruction is evaluated separably and is bit-identical to
  reconstruct(). The dim-latch frame's CPU time drops from 7.5-8.6 ms to 3.5-4.5 ms.
- PopoverMotion::hold: the appear spring holds at 0 for the tick after present. The snapshot
  frame therefore carries no dim, no reduction and no ramp.

On the television, TMP-modal-short worst_ms p50 goes from 40.1 to 31.1 ms. It is still over the
20 ms gate: GPU backlog at the open, attributed in docs/backdrop-blur-profiling.md.

Co-Authored-By: Claude Opus 5 <[email protected]>
gfx::enc_u8 answers (enc(v).clamp(0,1)*255+0.5) as u8 from 255 thresholds
bisected once against the formula itself, so it is that formula to the bit
(the_quantised_encode_is_the_powf_encode_to_the_bit). underlay::texture_rgba
used it 5760 times per latch.

Co-Authored-By: Claude Opus 5 <[email protected]>
field_collect used to glReadPixels wherever a consumer collected — between the
page and the surfaces, which ends framebuffer 0's render pass on Midgard and
makes the rest of the frame reload its tiles. gfx::field_frame_begin now reads
the live run (same due rule: a frame after the kick and past its fence) before
draw; field_collect answers from what landed and touches no GL. Both consumers
(ModalUnderlay, RouteGround's UnderlayField) take it unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
… between frames

Both ground samplers (the tab track's `sample_ground`, the Hero row's
`sample_control_ground`) answered a due call with a synchronous
`glReadPixels` mid-page: a full GPU drain once every thirty frames. On the
Detail page that frame cost 27-29 ms (`clear` ~11 + ~15 ms inside `page`)
and failed every Detail cycle of fps:push-100.

A due call now queues a GPU-side copy of the tap boxes into a small probe
target and fences it (`GroundProbe`, cadence in the pure `ProbeCadence`).
The probe is read back right after the swap, once the fence has signalled,
so the read binds another framebuffer while the frame's own has nothing
pending (reading it mid-page still cost ~12 ms). The Hero row's linear-light
mean goes through a 256-entry table instead of 36,015 `powf` per reading,
bit-identical to the `powf` mean.

Tests: a_due_ground_reading_is_queued_and_collected_only_once_the_gpu_has_passed_it
and an_invalidated_probe_drops_its_reading_in_flight_and_queues_a_fresh_one
(observed red against the synchronous shape), a_probe_tap_is_its_own_box_of_the_atlas,
the_u8_ground_mean_is_the_powf_mean_to_the_bit.

Co-Authored-By: Claude Opus 5 <[email protected]>
The popover host's snapshot frame puts a whole page render on top of its own
composite. The CPU runs a frame ahead, so that cost landed on the next
presented frame as a 22-37 ms buffer wait, once per modal open. A fence now
goes in after the capture frame's swap (gfx::snapshot_frame_end); the frames
after it are not presented until it signals (snapshot_frame_begin, the present
gate in app::run), bounded by SNAPSHOT_DEFER_MAX frames, and a held appear
spring stays at 0 through them (PopoverMotion::tick_gated) so the ramp starts
on an empty GPU queue. The panel keeps showing the capture frame, which is the
unchanged page. No fences (the simulator): nothing is deferred.

TMP-modal-short (16 cycles, TV): cycles over 20 ms 15 -> 5, p50 31.4 -> 19.2.

Co-Authored-By: Claude Opus 5 <[email protected]>
Both field readers (ModalStack's dims, RouteGround's host ground) queued their
reduction on the first frame the dim/ground was seen, to keep it off the
capture frame. With presents now held until the capture has left the GPU
(gfx::snapshot_frame_begin), the capture frame is exactly where extra GPU work
is free: the reduction queued there is waited out with the capture. Queued on
the first ramp frame instead, it was the backlog the frame after paid (20-24 ms).
DimSink::captured / gfx::snapshot_captured_this_frame carry the fact;
ground_reads_host is RouteGround's rule.

TMP-modal-short (16 cycles, TV): p50 19.2 -> 17.7 ms; item-menu and About
cycles now 16.7-18.5 ms.

Co-Authored-By: Claude Opus 5 <[email protected]>
The first push to a page paid for all its new strings on its first visible
frame (cold Detail: 47 strings, 24.7 ms TTF + 26.2 ms upload, a ~100 ms
frame). The incoming destination is now staged without publishing its
lifecycle, laid out through an inert recording painter that queues text-cache
misses, and the misses drain during PageDip::Out under a 6 ms per-frame
budget. Anything not warmed by the turn draws through the ordinary path, so
text is never hidden or popped.

Co-Authored-By: Claude Opus 5 <[email protected]>
The recording-painter's three text() branches called crate::text::text_width
directly, which the textmeasure layering gate treats as a raw call outside the
Measure seam (ui/mod.rs owns none of the three exempt files). Painter is Copy
and threaded through hundreds of draw leaves, so it has no room to carry a
measure capability the way an ordinary call site threads one down from its
caller. RecordingMeasure mirrors widgets::LegacyMeasure: the identical free
functions TtfMeasure wraps, minus its boot-order debug_assert!, called from
inside an impl Measure for block so the gate's structural exemption applies.
Numeric behaviour is unchanged — same functions, same arguments.

Co-Authored-By: Claude Opus 5 <[email protected]>
Review flagged the prior RecordingMeasure: a second, parallel `impl Measure
for` passes the textmeasure gate's structural exemption but only by moving
the same raw crate::text::text_width call to a file the grep doesn't scan
inside an impl block for the SECOND TIME — it teaches the gate to look
somewhere new for the exact call it exists to forbid, rather than honouring
the layering. widgets::LegacyMeasure already exists for precisely this
shape (a leaf with no capability parameter, exercised by host tests before a
font loads, wrapping TtfMeasure's free functions without its boot-order
debug_assert!) — it is now pub(crate) so ui/mod.rs's recording Painter can
reuse it directly instead of declaring its own copy. Numeric behaviour is
unchanged; TtfMeasure's assert is untouched.

Co-Authored-By: Claude Opus 5 <[email protected]>
Every hero advance under a modal uploaded a new 1280x720 backdrop (3.6 MB) into the texture cache, cost ~14 ms when it landed on a modal-open frame, and grew RSS by 15 MB over 100 modal cycles until the bounded cache filled. Home now follows the container's Cover/Uncover lifecycle: the first presented surface pauses the countdown, and dismissing the last one restarts it from the full interval. The selected hero is unchanged, so plxnative-heroidx still pins.

Co-Authored-By: Claude Opus 5 <[email protected]>
…atic page already gave it

The top bar's blur source pass handed the full dispatcher callback to gfx, which re-rendered the whole scene, modal surfaces included, and its invalidation discarded Held::Ground, so every frame under a modal was drawn twice (174 of modal-100's slow Home frames). The source pass is now blocked while a modal is visible, reuses its last source while the page under the glass is unchanged (real page damage and the final settle frame still refresh it), text prewarming runs once per visible frame, and a recording pass can no longer clear the visible frame (nested, unwind-safe clear suppression).

Co-Authored-By: Claude Opus 5 <[email protected]>
…cclusion, per-rect validity

Replaces r3's modal special case with a general rule owned by ui/frame/backdrop.rs (GlassPlan). A blur source walk carries an explicit z ceiling, so it cannot draw its own glass or anything above it; a glass covered by an opaque or frozen layer neither captures nor draws; a retained source is reused until the draws under that glass's rect change (foreground and outside motion never count, the settle frame does); overlapping glasses at different z keep separate captures, the higher sampling the lower composite, while compatible glasses share one capture of the frame's union. Every changed visible source still refreshes on each present. Removed: the modal cover/prepare coupling, the global dynamic cadence clock and its plxnative-glasshz profiling knob.

Co-Authored-By: Claude Opus 5 <[email protected]>
…echanism never reads

modal-100/push-100 regressed after the general backdrop mechanism (394ff9e) replaced the
special-cased fix, because its per-frame exact-draw-description walk recorded content no
current consumer reads:

- text_value() packed one u64 per BYTE of every declared string, on every discovered frame
  regardless of change (validity is compared every frame by design). Settings rows and Detail
  synopses paid an 8x Vec<u64> inflation. Now packs 8 bytes per word: same exact-identity
  semantics, no hash, no truncation.

- The nav.modals.surfaces draw loop (Settings/AccountMenu/ItemMenu/About's own content) is not
  gated by host_render/PagePlan and walks fully on both the no-GL discovery pass and the real
  draw pass. But no glass entry is ever created at or above Z::surface(0) (grep-verified: every
  DYNAMIC_BACKDROP.backdrop() call site sits inside the CHROME scope), and popovers stood off
  the blur chain entirely on 2026-09-19 in favour of their own frozen-host snapshot. paint() now
  refuses to record above that boundary, and Painter::declare has a fast pre-check so the caller
  skips building the primitive's Vec<u64> at all; a debug_assert catches any future glass
  declared up there instead of silently starving it of data.

Both fixes stay inside the general mechanism: no special case, no ceiling change, no exemption
from "every changed source refreshes each present," and the ambient wash still dithers every
frame. TV re-measurement (modal-100): cycles-over-20ms improved from B's original 31-34 (34 with
only the text fix applied in isolation measured worse, 36, due to run variance) down to 31 with
both fixes, bringing about/item-menu to parity with or better than A and p95 inside A's own
run-to-run spread; settings/account-menu keep a ~1-1.5ms/frame residual gap, most likely the
frozen-host page/chrome tree still walking under discovery and real draw even though its GL
output is suppressed — documented as an open hypothesis for the next worker in the dated
addendum, since it needs the same grep-proof safety analysis this change gave the surfaces band
before anything there can be excluded from recording.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Cached hosts (Settings/AccountMenu over Home, HostRender::Cached from
Style::Sheet/Opaque) still walk their full page+chrome widget tree on
every discovered frame, because the existing HostRender::Replaced gate
in dispatch.rs::draw_with only skips the page pass for the OTHER
freeze kind. `gfx::may_read_ground`'s doc already says a frozen page's
draw "produces no pixels", but nothing stopped `backdrop.rs::paint`
from recording every primitive underneath it anyway: the walk still
built each primitive's Vec<u64> (text included) and pushed a Paint for
later signature comparison, even though `held_ceiling()`'s synthetic
Layer already occludes that content from every consumer — a glass
above the boundary retains the layer's own revision-keyed synthetic
Paint instead, never the real content below it (Sources::begin,
signature()'s existing visibility subtraction already proved this for
validity purposes; recording just hadn't caught up).

This is the same shape as the surfaces-band fix in 29f7d7e, just with
a dynamic per-frame ceiling (the layer stack's held_ceiling) instead of
a fixed one (Z::surface(0)): `paint()` gets an authoritative geometric
occlusion test (`occluded`, reusing the same rect-subtraction `decide`
already runs for glass visibility), and `Painter::declare`'s fast
pre-check (`recording_excluded`) gets a conservative rect-free version
(`fully_occluded`) that skips building the primitive's data at all when
a canvas-covering blocking layer sits above the current z — every
blocking Layer this mechanism has ever produced (a frozen host
replacement, a Replaced surface's ground, a full-alpha dim) covers the
whole canvas, so the coarse check is exact for all real content and
only conservative (never wrong) if a partial-rect blocker is ever
added.

No ceiling was raised, no screen was exempted, and the "every changed
source refreshes every present" rule is unchanged; this only prunes
recording that no consumer could ever read. Regression tests (red
without the fix, confirmed by temporarily disabling the new checks):
content_below_a_frozen_host_boundary_is_never_recorded and
recording_excluded_follows_the_frozen_host_boundary_too.

Co-Authored-By: Claude Opus 5 <[email protected]>
A PageDip push or pop redrew the whole outgoing and incoming page on
every frame of its 70 ms Out and 140 ms In, at full GPU cost (Detail's
fill alone is 26-28 ms on the Mali-T820). The dip now captures the
outgoing page once at full alpha and fades that texture, reuses the
container's captured image for the incoming page, and resumes live
drawing under a 70 ms held-image dissolve after In settles. Shared chrome
stays outside the capture and keeps drawing; input ownership and hit
stops are unchanged. The capture reuses the modal snapshot texture,
budget and fence; glass discovery treats the held image as a frozen
layer. Capture refusal, modals and video fall back to live drawing.
RoutePush stays live because it shows two levels at once.

Co-Authored-By: Claude Opus 5 <[email protected]>
Five fixes from the TV-log diagnosis of the push/modal stress benches,
all inside the shared mechanisms:

- Discovery does no GL or cache work: sample_control_ground refuses
  every blur/discovery source walk, the ground-probe cadence counts
  presented frames rather than calls, and excluded text skips
  measurement. Discovery gets its own `disc` FRAMEDROP span.
- Glass capture follows visible dependencies: a retained lower glass
  covered by a frozen replacement no longer forces the upper glass onto
  an inline framebuffer capture; the upper source replays directly.
- A held page transition releases on visual quiescence (no page-owned
  motion, no pending first-frame resource work), bounded at 600 ms, not
  on the dip's clock.
- No frame draws a live page under a full-screen held image: the settled
  page is captured once off-screen and live drawing resumes on a frame
  whose output matches it.
- Held-image backdrop filtering is alpha-invariant: the source is
  filtered at full alpha and the fade is applied over the constant
  ground at composite time; a content revision still invalidates.

FRAMEDROP lines now carry the dip phase (dip=out|hold|in|held|live).

Co-Authored-By: Claude Opus 5 <[email protected]>
Adds a third stress bench, DeepBench (/tmp/plxnative-deepbench[=<depth>[,<ratingKey>]],
default depth 100), alongside PushBench/ModalBench. Unlike those two round-tripping
oscillators, DeepBench pushes `depth` pages with no pop in between (rotating Detail/Person
only — see below), then pops all the way back to the root one page at a time, so the
harness can grade whether transition cost or memory holds flat as the real nav stack goes
ninety-plus entries deep, not just the shallow depth-1<->2 churn PushBench measures. Each
push/pop is one Start/Settle pair, reusing BenchClock/bench_advance unchanged with
n = 2*depth; a new pure helper `deep_step` derives direction and stack depth from the cycle
index.

Nav-stack finding (as directed, driven through honestly rather than guessed at): reading
ui/containers/stack.rs shows NavStack's logical entry list is unbounded (depth() has no
cap) — only the MOUNTED body count is capped at CAP=16 via NavStack::evict(), which
unmounts (tears down Screen, delivers Unmount) the oldest live body below the top while
retaining its Entry (id/arg/ReturnState), so a Pop past CAP remounts from that retained
state rather than hitting a wall. Separately, NavOp::SelectTab (what Library's only
production entry point, nav_tab -> nav_peer, uses) retires every entry above the root and
mints at most one new entry over it — a peer swap, not a push. That makes Library unsafe
for a monotonic push rotation (unlike PushBench, which is free to use it because it
round-trips to depth 1 every cycle regardless), so DeepBench's push rotation is Detail/
Person only, with Person falling back to re-pushing Detail (not Library) when no cast data
has landed yet. Both findings are logged at runtime and documented in bench.rs.

Grading: tests/run.py gains parse_deep_bench/grade_deep_bench (dispatched by
scene["bench"] == "deep") alongside the existing grade_bench — FAIL unless all 2*depth
steps and the done line land; per-step worst_ms <= bench_worst_ms; push and pop drift
(first-10 vs last-10) <= bench_drift_ms; a new bench_depth_rss_kb gate (default 16384) on
RSS growth from step 10 to max depth; bench_rss_growth_kb on RSS growth from step 10 to the
final root RSS. New tests/manifest.json scene deep-100 (tier ui, bench: deep) carries
first-guess ceilings pending a device baseline, same as push-100/modal-100 did.

Tests: 5 new bench.rs unit tests (fake-clock: step count, push/pop trajectory, rotation,
Library exclusion, no-ratingKey zero-cycles run) plus 10 new test_harness.py tests
(parser, a healthy pass, and each fail condition: missing steps, missing done line, a slow
step, push drift, pop drift, depth-RSS growth, root-RSS growth, plus a manifest shape
check). docs/agent-reference.md's STRESS family sentence and trigger list gain deepbench/
bench_depth_rss_kb.

Co-Authored-By: Claude Opus 5 <[email protected]>
GLinnik21 and others added 3 commits September 20, 2026 01:06
Two repeated measurements in the live page draw, found while chasing the
25-45 ms frames a freshly pushed page spends before it settles:

- TextView retains its wrapped-line widths in the existing cache, so the
  fade, alignment and last-line queries reuse them instead of
  re-measuring the run on every frame.
- A rating group returns the extent it already measured rather than
  walking its runs a second time.

A 100-page unwind test covers Immediate and PageDip, eviction and
remount, retired entries, queued return states and focus memory. It
passes as written: the 33 MB an unwind does not give back is NOT in the
navigation stack's own bookkeeping, and the owning allocation is still
unidentified.

Co-Authored-By: Claude Opus 5 <[email protected]>
Integrates the GlassPlan backdrop mechanism, ticket-based underlay
field (field_kick/field_collect), and PageDip transitions against
main's independent work landed since this branch diverged: the
onboarding report flow, the ALL-CAPS clickable-text-mark rule, the
"no red" Failed read-out redesign, the person-page Filmography/bio
gap retune (#143, #156), and PlayingItem's show_rk field.

Conflict resolution kept both sides' behavior throughout:
- rust-modules/src/ui/popover.rs, widgets.rs, dispatch.rs and the
  screens/* Screen impls drop the old per-screen glass mechanism
  (Dispatcher::prepare_present, Popover::prepare_present,
  popover::glass_refresh, GlassState) wherever GlassPlan/backdrop.rs
  has already replaced it end to end (confirmed via `git grep` that
  none of the old symbols remain reachable).
- rust-modules/src/gfx.rs keeps the field_kick/FieldTicket async
  readback pipeline, ambient dither four-program set, and the
  texture-ledger bench helpers.
- rust-modules/src/ui/underlay.rs, containers/modal.rs and related
  tests are HEAD's strict-superset versions.
- rust-modules/src/screens/decision_alert.rs keeps main's
  valid_choice() fix (#169) alongside HEAD's field-latching scrim.
- rust-modules/src/dev/scenarios.rs keeps the tex_field() bench
  column (a distinct, later commit on this branch, not the
  duplicate deep-bench commit already on main as cdc831a).
- docs/agent-reference.md and the deep-bench prose keep main's
  wording per the deep-bench duplication note.
- rust-modules/src/ui/CLAUDE.md rows were resolved per-row: kept
  HEAD's field_kick/panel_ground description for underlay.rs and
  popover.rs, merged decision_alert.rs's card/report-flow addition
  onto HEAD's field-latching description, and took main's newer
  person.rs/filmography.rs prose (commits f001220, 1c3b3cd, not
  in this branch's history) while keeping HEAD's person_bio.rs row
  (documents the same prepare_present removal already applied to
  the code).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Compile fixes surfaced by the gate sequence after the merge:
- screens/library/menu.rs had a duplicated Screen::scrim() impl left
  by the merge (two identical fn bodies in one impl block).
- ui/decision_alert.rs's reconcile_card() (a main-only addition, not
  part of any conflict) still called the removed
  popover::note_own_damage(); ground_invalidate()/own_motion() cover
  the same job now.
- ui/popover_host_tests.rs's CPU-standin FrameCache only implemented
  main's old 3-method API (invalidate/capture/draw). This branch's
  render-into-texture path (render_available/tex/resident_bytes/
  render_into/finish_render/rendered/draw_alpha) is real, host-test
  code that popover.rs's host::TransitionSnapshot and page_pass()
  call unconditionally, so the test double needed the same surface.
  render_into() always declines (no GL context in a host test,
  matching gfx::FrameCache::render_available's own doc), so every
  caller falls back to the existing capture()/draw() copy path the
  three tests already exercise.

Doc fixes from a doc-claim-auditor pass against `git diff cdc831a..HEAD`:
- docs/liquid-glass.md §4 still described the retired
  DEFAULT_DYNAMIC_PERIOD/EveryChangedPresent cadence clock as live
  code; ui/frame/backdrop.rs's GlassPlan has no period or clock, only
  a per-footprint declaration-traversal comparison (matches
  docs/backdrop-blur-profiling.md's "live backdrop sources follow the
  layer stack" section, which this merge already kept in sync).
- ui/CLAUDE.md's shared-dither paragraph and the underlay.rs row
  still said "three" dithered programs / "five programs, four
  answers"; fs_field_panel.frag (this branch's panel twin of
  fs_field.frag, used by widgets::panel_ground) is a fourth, per
  gfx.rs's own host test and its "(Four since the panel twin below.)"
  comment.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 19, 2026 23:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@GLinnik21
GLinnik21 merged commit f3dcd3d into main Sep 19, 2026
5 checks passed
@GLinnik21
GLinnik21 deleted the perf/stress-v3 branch September 19, 2026 23:21
GLinnik21 added a commit that referenced this pull request Sep 25, 2026
…repeat of an in-flight push (#238)

* Player: BACK/Stop/EOS return to the page playback was started from again

Since #178 the page dip-out PREPARES a pushed destination: its body mounts
before the floor, and that mount is where the player spends its one-shot
origin seed. `start_playback` pushes the player while the plan is still
resolving; when the plan lands inside the dip, the committed route still
names the detail page, so `update`'s landing arm asks for the player again
(`show_page(Player)`). `NavStack::request` replaced the pending push, dropped
the prepared player and prepared a fresh one whose seed was already spent,
so the session had no origin and every exit fell back to Home.

A repeated Push/Replace of the pending destination is now inert, like the
Root/SelectTab/PopTo twins already were, so the prepared body (and whatever
seed it consumed) survives. `enter_player` also treats a pending player push
as "already up", so a second Play inside the dip cannot leave an unspent
origin seed for a later unseeded player mount to inherit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: library preferences fixture reads in blocking mode

An accepted socket inherits the listener's O_NONBLOCK on macOS, so a read
that beat the client's write panicked WouldBlock and failed the test
intermittently (2 of 5 isolated runs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Detail: a second open of the page already on its way writes no seed

Review follow-up: the detail half of enter_player's pending-push rule. The
repeated Push is inert against its prepared twin, so a DetailSeed written
for it would never be spent by that page and would linger for a later,
unseeded mount of the same item.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: every nonblocking loopback acceptor accepts through one helper

Darwin hands an accepted socket the listener's O_NONBLOCK; Linux does not.
Fixtures that poll a nonblocking listener and then read or write the
accepted socket as if it blocked flaked on the Mac with WouldBlock. Five
fixtures had fixed that inline; the rest had not. crate::testnet::accept
does the accept and restores blocking mode, and every such acceptor now
uses it (route decision fixtures, net, curlio, ff support, stall guard,
library preferences, the lifecycle rig). Acceptors that only count
connections (http, keepalive, checkpoint, ipv6, transcoder) do no I/O on
the socket and are unaffected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: the runtime-probe teardown test parks the probe in setup

The server answered the probe's Range with a plain 200 at once, which the
probe refuses as RangeIgnored. When the test thread ran late — a loaded
suite — the probe ended on its own and retired its handle before teardown
signalled it: "got Err(Open(RangeIgnored))", or a 20 s spin ending in
"never published teardown's wake target". The server now withholds its
answer, so only the wake can end the probe, and the test waits 100 ms
before waking it so the late case is the case every run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
GLinnik21 added a commit that referenced this pull request Oct 9, 2026
… page image is taken (#570)

Opening a Library of the other kind than the one last shown (Shows visited, back
Home, press Movies), everything cached, froze the destination as an image on the
frame it mounts, but the Library only learned which library to show a frame
later (store select from its first tick, Enter a frame after that). The image
was an empty page with a still spinner, held through the whole dip-in, then the
full grid appeared in one frame. Shipped since #178.

nav_tab now aims the store at the pressed kind a dip-out ahead (Bridge::aim_library),
only when the Library is not already on top and the store is not already on a
library of that kind, so the reader's last pick of that kind stays. The target is
one function, DirectoryView::kind_address, shared with the page's own select.

Co-authored-by: Gleb Linnik <[email protected]>
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.

2 participants