src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/state_machine.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-06-20 11:46:33 -0500
committerLuke Hoersten <[email protected]>2026-06-20 11:46:33 -0500
commit568de1068e7fc3b4faefac6d218d7919337b212c (patch)
treea4d6722cc5b61357646a9b6859543653cdec7914 /main/state_machine.c
parent6e0e0270e2cb9c54b1b7e63d9e67d8ac16792cef (diff)
g2g semantics now per-frame, drop sharp mozjpeg for ~4x faster snapshot
Two follow-up fixes informed by the first-round field data: #1 — g2g measures display age, not time-since-wake Previously eventUsLow was stamped once at wake event and reused for the whole stream session. /state's last_paint_event_us_low echoed back the wake-time anchor, so g2g = "elapsed time since user wake." That metric is true but not actually informative — it just grows linearly with stream duration. What's actually useful for the "is the panel showing current reality" question is the AGE of the currently-displayed frame. Stamp event_us_low per emitted frame at Date.now()*1000 (low 32 bits) inside the stream demux loop. Now last_paint_event_us_low reflects the most recent painted frame's emit time, and g2g = (script_now_us_low - last_paint_event_us_low) = display staleness in ms. #2 — sharp first-paint dropped from ~1800ms to ~800ms Previous commit (phase 5) turned on sharp's mozjpeg encoder for slightly tighter file size at the same JPEG quality. Field measurement showed it costs ~1.5s of CPU per snapshot vs libjpeg-turbo's ~400ms — a ~4× regression on the metric we care most about (event → first-paint). The file-size win is ~5%; on 800x480 panel output that's not perceptible. Drop mozjpeg: true. Quality settings (quality=100, chroma 4:4:4 at jpegQuality ≤ 2) stay the same, so visual output is unchanged. First-paint comes back down to where it should be.
Diffstat (limited to 'main/state_machine.c')
0 files changed, 0 insertions, 0 deletions