-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rg_display: New partial update system
The previous partial update system worked as follows: 1. Compare the previous and current framebuffers line by line 2. For each line find the first different pixel and the last one 3. Do a second pass and merge line differences into rectangles 4. Adjust the rectangles until they're no longer on boundaries that would break scaling or filtering 5. Prepare/render the region within a rectangle (do pixel conversion, scaling, filtering, etc) 5. Send the block to the SPI display This worked reasonably well but: - Step 4 was always a problem and we often ended up with artifacts despite many attempts at fixing it - Mid-frame palette changes were completely broken - The need for two framebuffers is an issue in some emulators - It was fairly slow. Better than a full redraw, but still slow The new system works as follows: 1. Prepare/render a few lines to be sent to the display, as if we were doing a full update 2. Do a checksum of the block and compare it to the checksum of the same block from the previous frame 3. If it matches, drop the block and advance the window. Otherwise store the new checksum and send the SPI buffer This has many advantages: - We don't have to care about boundaries since they're always the same - In many cases it's faster than doing a diff, even though we have to render the full lines - It can work with a single framebuffer - It uses less memory - We can invalidate lines that rg_display_write writes to, avoiding accidental leftovers The main drawback is that it's currently less granular. If a single pixel changes in a block, we have to send it fully to the display. Whereas previously we narrowed down the diff to a smaller region. But I intend to experiment with block sizes and shapes, there's no reason we couldn't split the frame into smaller blocks. It was just more convenient to start with the current block size (4 full lines).
- Loading branch information
Showing
16 changed files
with
212 additions
and
321 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.