evidence · 6.8 KiB

README.md

Committed at docs/evidence/interaction-jank/card-resize/README.md. This is what grounds the requirements that cite it.

Open raw source

Card entry and expand while the card is resizing

Evidence class: board, injected native touch. All captures were taken on 2026-10-22 on the board’s DSI panel in landscape: 1232x568 logical pixels, 52.19 Hz (19.16 ms per refresh), max_render_time 12, one online CPU. There was no real glass and no camera.

Workload

card-entry.py with --bench, 8 cycles per run. Each cycle does an entry swipe, a deck drag and a tap that expands the centre card (ordinary-cards). The busy arm is btop in a Foot window at font size 7; the video arm is the shipped Video app.

analyze.py gives touch acknowledgement and tracking. frames.py gives, for each frame presented with damage inside a gesture window (first contact until 400 ms after release):

RunBuildArm
base-busysgjam1h0 (boot default)busy
o-busypb5l6lmb, test-activatedbusy
o-videopb5l6lmb, test-activatedvideo
boot-busypb5l6lmb, boot default, ordinary bootbusy

Video is compared with recheck-video on sgjam1h0.

Where the time went

prof-base-busy profiled sway and the shell UI during 8 cycles of entry and tap only (entry-only.py is card-entry.py without the drag), on sgjam1h0. Of 8.2 s sampled CPU, sway used 7.2 s, and sync_card held 42% of all samples. Most of that was card_scaled_buffer_create_format (20.5%): it rescales the card’s source into a cached RGB565-path thumbnail, checks it for opacity and prepares it for the quarter-turn.

That cache (scaled_mirror in nix/card-shell/adapter.c) is keyed on the thumbnail’s size. During entry and expand the card’s size changes on every frame, so each frame rebuilt a full thumbnail from btop’s 1232-wide buffer, used it once, and then composited it. Busy-arm entry frames took 14–25 ms of sway time for about 390,000 damaged pixels, so they presented every second refresh. The video card’s buffer is not eligible for the cache, and it already took the direct scaled composite.

The change

While the scene is in motion (scene_in_motion(), which already selects the nearest filter), scaled_mirror now skips the cache when the size differs from the cached thumbnail. The mirror then takes the direct composite path, the fallback that ineligible buffers already used. A drag keeps its size, so it still hits the cache. Once the size holds still, the cache is rebuilt as before, with the bilinear filter at rest.

Results

Cells give the median / p90 in ms, or a count.

Busy armbase-busyo-busy
Entry: sway repaint13.7 / 27.69.3 / 12.7
Entry: presented interval38.3 / 38.319.2 / 38.3
Entry: touch acknowledgement, median / max129 / 14369 / 112
Entry: tracking intervals over 33.334 ms48 of 5925 of 85
Entry: release to first present, median4118
Tap-expand: sway repaint10.7 / 20.29.3 / 13.4
Tap-expand: presented interval38.3 / 38.319.2 / 38.3
Drag: sway repaint3.9 / 4.94.0 / 4.9
Drag: presented interval19.2 / 19.219.2 / 19.2
Video armrecheck-videoo-video
Entry: sway repaint10.1 / 20.07.1 / 10.8
Entry: presented interval19.2 / 38.319.2 / 19.2
Entry: tracking intervals over 33.334 ms382
Entry: touch acknowledgement, median6349
Drag: presented interval19.2 / 19.219.2 / 19.2
Tap: touch acknowledgement, median120119

Promotion to the boot default

On 2026-10-22, pb5l6lmb (commit 2905f5c8, which is what master evaluates to) replaced sgjam1h0 as the persistent system. The kernel and initrd are identical between the two. promote.py is the shade-pull promotion script with the system paths and the state directory changed. It ran as root under the board lock and set the profile to system-88-link.

An SSH-initiated reboot booted pb5l6lmb as both /run/booted-system and /run/current-system, with shell and shell-ui active, no failed units, and sway at SCHED_RR 1. See the receipt, boot ID 69d72d47….

run-boot-busy repeated the busy arm on that boot, and it matches o-busy:

Rollback: write the copies under /var/lib/k230/card-resize-promote-20261022/promotion/rollback/ back to /boot, then run nix-env --profile /nix/var/nix/profiles/system --set with sgjam1h0.

Visual check

A one-cycle --probe run on pb5l6lmb took grim captures of the focused app, the deck, the dragged deck and the expanded card. All were normal. They are not committed, because btop’s network panel shows the board’s private address. Frames in motion were not captured. Both paths use the nearest filter in motion and the same rounded clip, and the rest state still comes from the bilinear cache.

Host tests

python3 -m unittest tests.test_card_scaled_cache passes; the cache itself is unchanged. tests.test_card_mirror_order, test_card_shell_chrome, test_card_shell_home_bleed and test_card_shell_deck_title fail to build their harnesses with and without this change. They are not run in CI.

Limits