Speed up Model pi3a+ SPI speeds for coalescing decisions#206
Open
sastraxi wants to merge 3 commits into
Open
Conversation
rreichenbach
approved these changes
Jul 16, 2026
rreichenbach
left a comment
Collaborator
There was a problem hiding this comment.
Seems to work well on v2 and v3
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.
We have a cost model to predict how long an SPI write will take, so we always choose the fastest path for whatever the pending paint is on the next frame. This allows us to draw small things very quickly (50hz) while preventing falling behind for large writes.
This model was trained on a Pi 5 and applied everywhere. However, v2's Pi 3A+ per-pixel cost is 6.2x v3's. As such, we now now read the SoC from
/proc/device-tree/compatibleand use sensible decisions.In the future, we should investigate putting the SPI pushes on their own thread entirely.
Bonus work
Replace the numpy 565 pack with an SDL convert-blit into a 16-bit staging surface, and stop forcing PanelStack's root to RGBA when dimming: the root is a blend destination, and an SRCALPHA source sends the LCD's convert-blit down SDL's per-pixel alpha-blending path (~7x slower, on every push).
Adds tools/bench_adc_contention.py, extends bench_lcd_device/bench_pack_variants for refitting, and hardens deploy.sh (excludes .venv/caches, reports service start failure).