evidence · 4.5 KiB

README.md

Committed at docs/evidence/vglite-turn/README.md. This is what grounds the requirements that cite it.

Open raw source

Standalone output-turn benchmark: CPU vs VG-Lite on the mainline board

Evidence class: board observation, private buffers, runtime insmod only. Not compositor evidence, not an interaction or presentation measurement. Run 2026-10-30 ~14:45-15:00Z on boot 0b49504f-..., kernel 7.3.0-rc5, boot default 49mnsl2s... (GPU device-tree node installed, vglite.ko c07fydj8 loaded and unloaded by each run; after each run no PLIC 135 line, no vglite in lsmod, no Oops/BUG; shell and seatd stayed active). Charger online. Each run held the board lock for well under a minute. The module is not loaded at boot and the system closure is unchanged.

Program: nix/vglite-turn-bench.c, built by nix build .#k230-vglite-turn-bench, executable /nix/store/59vvqwy2bykb9qq4x883xpb5456pfrbd-k230-vglite-turn-bench-... (the earlier runs used predecessors of the same program: chpz00d8..., 16d7f5hc..., lzywc3nyk...; the last changes only added diagnostics and the BENCH_NOCLEAR switch). It turns one full 1232x568 RGB565 frame into 568x1232. Destination is a DRM dumb buffer created and freed by the program on /dev/dri/card0 with the padded 576-pixel storage width (pitch 1152), imported into VG-Lite as a dma-buf; it is never attached to a CRTC, so it is the same kind of memory as sway’s scanout buffers but not a scanout buffer. Source is a contiguous VG-Lite allocation (stride 2464). Reps: 40 per mode, 3 rounds, transform 1 (the compositor’s rotation=1) and 3.

Correctness

The GPU turn (vg_lite_blit, 90 degree matrix set directly, point filter, VG_LITE_BGR565) is byte-identical to the compositor’s k230_turn_copy_rect (nix/card-shell/quarter-turn.h) for both transforms: bad_rows=0 of 1232 (files *-noclear*).

Cost per full frame (median of 12 rounds x 40 frames; summary-passing-runs.txt)

Modewallprocess CPUof which submit / finish wait
CPU turn into heap4.38 ms4.01 ms-
CPU turn into the dumb (scanout-like) buffer4.36 ms4.01 ms-
GPU turn, source dirtied by the CPU before each pass18.91 ms0.22 ms0.12 / 18.79 ms
GPU turn, source untouched18.86 ms0.18 ms0.08 / 18.78 ms
GPU landscape copy (control, no rotation)2.59 ms0.15 ms0.07 / 2.53 ms

vg_lite_blit already cleans the source cache (SDK vg_lite.c:2511) and vg_lite_finish invalidates the target (vg_lite.c:4319); both are inside these numbers, and the dirty-source run shows the cost of the source clean is about 0.04 ms CPU / 0.1 ms wall for a 1.4 MB source (submit 0.118 vs 0.075 ms).

What this means

A cache hazard found on the way (relevant to task 2.4 of the-shell-trials-vglite-composition)

With memset(dumb, 0, size) and a vg_lite_clear of the destination before the GPU turn, the GPU output differed from the CPU turn in the first row of the buffer in 5 of 6 runs (bench-transform1-run0-edge-mismatch.txt, bench-transform1-run1..3.txt, bench-transform3-run1.txt: 96-320 pixels from x=0/192; the one passing run was luck). Skipping the CPU prefill (BENCH_NOCLEAR=1) gave bad_rows=0 in 4 of 4 runs. So CPU writes to a buffer the GPU then overwrites can leave stale cached lines that win against the GPU data: a renderer that mixes CPU-path frames (or CPU damage repair) and GPU-path frames in the same scanout buffer needs a proven clean/invalidate protocol for the destination as well as the source. Not root-caused here (which cache operation is missing is open).

Files

bench-transform1-noclear-run1..3.txt, bench-transform3-noclear.txt: passing runs (summarised by summarise.py). bench-transform1-run1..3.txt, bench-transform3-run1.txt, bench-transform1-run0-edge-mismatch.txt: the failing prefill runs, kept. Raw TURN_BENCH lines in each.