feat(video): host-DMA double-buffer for U64 bitmap scenes with text overlays#43
Merged
Merged
Conversation
…verlays resolve_double_buffer "auto" now enables the host-DMA page-flip not only on no-REU backends (TeensyROM) but also for a bitmap scene with a buffer-painting text overlay on a REU backend (the U64). resolve_use_reu_staged already turns the REU bank-swap OFF for bitmap+text (to dodge the swap shimmer), which left those scenes on single-buffer host-DMA that tears on scene cuts. The host-DMA double-buffer (already shipped for the TR) gives them tear-free frames AND crisp text: its swap IRQ does no in-IRQ DMA, so the $DD00 flip lands in vblank with no shimmer, and text glyphs live in banked screen RAM so they swap with the bitmap. Overlay-free bitmap video on a REU backend stays on the REU path (the better tear-free option there). Gated off when the REU mic pump is active (it owns $0314 too, with no merged dispatcher for this pair); never reached on a no-REU backend, where use_reu_pump is coerced off. HW-verified on U64 (mhires video + marquee, Cam Link A/B via the new scripts/diags/doublebuffer_tear_ab.py): the path arms on U64, structural top/bottom tear rate drops 1.3% -> 0.2% (the residual is the documented $D800 percell color-RAM seam, same as the REU path), and the marquee stays crisp even across that seam.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
=======================================
Coverage 79.68% 79.68%
=======================================
Files 68 68
Lines 12941 12943 +2
Branches 1909 1910 +1
=======================================
+ Hits 10312 10314 +2
Misses 2190 2190
Partials 439 439 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Extends
[video].double_buffer = "auto"to enable the host-DMA page-flip for a bitmap scene with a text overlay on a REU backend (the U64) — not just on no-REU backends (TeensyROM), as before.Why
resolve_use_reu_stagedalready turns the REU bank-swap off for bitmap + text overlays (the REU swap's mid-frame$DD00flip shimmers fine high-contrast glyphs in the bottom rows). That left those scenes on single-buffer host-DMA, which tears on scene cuts — the originalmhireswhole-screen-flash problem — with no tear-free path available on the U64.The host-DMA double-buffer (shipped for the TR in #42) is exactly the fix: its swap IRQ does no in-IRQ DMA, so the
$DD00flip lands cleanly in vblank (no shimmer), and text glyphs live in banked screen RAM so they swap atomically with the bitmap. This PR just letsautopick it for the one case where the REU path can't help.Behavior changes are surgical:
$0314too, with no merged dispatcher for this pair). Never reached on a no-REU backend, whereuse_reu_pumpis coerced off.Changes
config.resolve_double_buffer: newhas_buffer_overlays+audio_reu_pump_activeparams;autoenables when(not backend_supports_reu) or has_buffer_overlays, gated off under the REU mic pump. Threaded at thebuild_scenecall site (both values already computed there).resolve_double_buffercases (text-overlay-on-REU enables; char modes still excluded; reu-pump gates off; explicittrue+ pump gated).CLAUDE.md,c64cast.example.toml, regeneratedc64cast.schema.json.scripts/diags/doublebuffer_tear_ab.py(single- vs double-buffer tear A/B on the U64).HW verification (U64 @ Cam Link, mhires video + marquee)
Ran the new A/B harness — single-buffer vs the new auto (double-buffer on):
@ $C500$D800percell color-RAM seam (color RAM isn't VIC-banked) — identical to the REU path, and unchanged behavior.hiresand static-palettemhires(cheap/grayscale) are fully tear-free.