Closed deltabeard closed 2 years ago
This has been added in the RP2040-GB project (Peanut-GB on the RP2040) at https://github.com/deltabeard/RP2040-GB/commit/97360886efec22b1c2a5598baa338de4110e08b1. This code uses the DMA sniffing feature of the RP2040 to generate a hash. This improved frame rate from 65 to 80 FPS. The DMA transfer replaces a memcpy, but now also performs this additional hashing at no performance penalty.
I think the example in https://github.com/deltabeard/RP2040-GB is adequate.
Add a feature in the SDL2 example to only refresh the lines of the screen that have changed since the previous frame. This can be used as a reference for a performance improvement on platforms where communicating with an LCD is time costly.
A hashing algorithm that is fast for 160 bytes of data should be selected.
In this case, multiple hash algorithms could be added, and one could be selected for use at runtime. Some platforms, like the RP2040, have integrated CRC32 hashing. I think it will be interesting to see how well something like CRC32 will do against a stronger hash algorithm like wyhash or xxHash.