Repository navigation
Blitter screen copy where the DMA chip plays the sound - #10
Merged
Merged
Conversation
userfw asks TOS for a blitter at boot (XBIOS Blitmode) and reports it after the hello ($FB8Exx, st_session_features()). The blitter copies the frame where the MOVEM loop would: a 48-byte chunk per line going forward in the cart framebuffer, the destination going back a chunk per line (Y increment -94) from the page's last chunk, then the tail. It owns the bus 40 chunks at a time (about 1 ms, under an IKBD byte's 1.28 ms), and the interrupts run between pieces. A word in shared slot 7, read every VBL, picks the copy (fb_set_copy_mode()): auto takes the blitter when the sound goes through the DMA chip and the CPU on the YM path, where the blitter's pieces delay Timer-B's samples. On a Mega ST even 4-chunk pieces made a test tone audibly rougher for 0.15 ms gained, and sharing the bus took longer than a VBL. On a Mega STE the blit now ends 3.3 ms before the next VBL against 1.9 ms with MOVEM, with the sound unchanged and 50 fps with the mouse moved flat out. The RP can force the CPU or the blitter. FB_SLACK_REPORT measures with MFP Timer-A, restarted at each VBL without its interrupt, so it works on both sound paths; the ST reports one byte at $FB8Bxx. The host test models the blitter's copy, in one run and in pieces; test_layout.py checks the new shared constants. Debug builds take copy_mode from the host; swd.py counters shows the ST's features.
What the blitter does and where it copies by default, the measurements behind that choice on a Mega ST and a Mega STE, fb_set_copy_mode(), shared slot 7, the $FB8Bxx and $FB8Exx windows, the Timer-A slack report, and the copy_mode debug command.
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
On a machine with a blitter the ST can copy each frame to the screen with the blitter instead of the 68000's MOVEM loop. By default it does so only where the DMA sound chip plays the sound (an STE, a Mega STE), and keeps the MOVEM loop on the YM path.
userfwasks TOS for a blitter at boot (XBIOSBlitmode(-1)) and reports it after the hello ($FB8Exx,st_session_features(),stSessionFeaturesover SWD).$FA402C,CART_BLIT_MODE_OFFSET), read every VBL, picks the copy:fb_set_copy_mode()with auto (the default), CPU or blitter, plus the chunks per piece.FB_SLACK_REPORTnow measures with MFP Timer-A (no interrupt, 81 µs a count), on both sound paths; one byte at$FB8Bxx($FB8Cxxis free again). Still off by default.Why only on the DMA path
Both copies are bound by the bus (8 cycles a word against MOVEM's 9). While the blitter owns the bus, Timer-B's YM samples wait. Measured on a Mega ST (YM sound, blitter fitted):
On a Mega STE (TOS 2.06, 8 MHz, DMA sound): 1.9–2.0 ms with the CPU, 3.3–3.4 ms with the blitter, the tone unchanged, and 50 fps with the mouse moved flat out.
Tests
make -C tests/host test:test_chunk_layout.cmodels the blitter's copy (in one run and in pieces of 1, 7, 40, 255 and 666 chunks) against every pixel drawn;test_layout.pychecks the new shared constants and the Timer-A count.