src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/viewport_state.c
diff options
context:
space:
mode:
authorLuke Hoersten <[email protected]>2026-07-15 19:10:57 -0500
committerLuke Hoersten <[email protected]>2026-07-15 19:10:57 -0500
commit659da7f36473a21494693f031a39fb6bb977b90a (patch)
treeb36783374bd8f32fe8c8c763337b01056c4565f6 /main/viewport_state.c
parent7620b935728ea964ddca09b91ac0be36069a8c64 (diff)
display: tear-free frame path via triple buffering + scan tracking
draw_bitmap on a direct fb pointer only updates the driver's cur_fb_index; the DPI DMA reloads that index at the END of the in-progress frame scan (~21ms period at ~47Hz). Under double buffering, flipping and immediately decoding the next frame into the other fb writes a buffer the DMA may still be scanning out — a torn frame. This regime is common now that the TCP window fix delivers frames back-to-back (decode starts ~6ms after flip). Fix with zero added latency: num_fbs 2 -> 3 (+1.15MB PSRAM of 25MB free), track the actually-scanning fb via on_refresh_done (fires in the DMA-done ISR exactly when the DMA reloads cur_fb_index), and pick the decode target as the fb that is neither pending display nor scanning. Three buffers minus at most two excluded roles = always a free one; no waiting on vsync anywhere. Instrumented: /state tear_guard_engaged counts back-buffer picks made while the previous fb was still mid-scan — each one is a frame that would have torn under double buffering.
Diffstat (limited to 'main/viewport_state.c')
0 files changed, 0 insertions, 0 deletions