Skip to content

send opaque BGRA on full frame updates - #8

Open
teddytennant wants to merge 1 commit into
tinygrad:mainfrom
teddytennant:fix-full-frame-bgra
Open

send opaque BGRA on full frame updates#8
teddytennant wants to merge 1 commit into
tinygrad:mainfrom
teddytennant:fix-full-frame-bgra

Conversation

@teddytennant

Copy link
Copy Markdown

tinyturing/ here is a subtree and is currently byte-identical to tinygrad/tinyturing main, so this gets reverted by the next git subtree pull on its own. I opened the same change upstream as tinygrad/tinyturing#1. This one fixes it for anyone on the current tree.

Full-frame updates send the framebuffer straight through .tobytes(), which on little-endian emits A B G R. The partial path in _build_update writes B G R (display.py:207-209), and the DISPLAY_BITMAP length field is 0x00177000, which is 8004804, so the wire wants four bytes per pixel in BGRA. White rendered yellow, and pure red, green and blue each landed on colour byte 0 and rendered black.

The framebuffer's low byte isn't usable as alpha, so this forces 0xff rather than shifting the existing byte along: _blit_alpha writes (red << 24) | (green << 16) | (blue << 8) with no alpha term, while clear() fills 0x000000ff.

Checked against a recording serial stub: all eight test colours now match what _build_update emits for the same pixels, plus opaque alpha. No panel here, so this is verified against the protocol and the partial path, not on hardware.

Closes #6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Full-frame updates send ABGR instead of BGRA

1 participant