Skip to content

Draw 16-bit images faster - #11633

Merged
tannewt merged 1 commit into
adafruit:mainfrom
mikeysklar:displayio-rgb565-fast-path
Oct 19, 2026
Merged

tannewt merged 1 commit into
adafruit:mainfrom
mikeysklar:displayio-rgb565-fast-path

Conversation

@mikeysklar

Copy link
Copy Markdown
Collaborator

What

16-bit Bitmaps draw faster when colors need no conversion.

Why

Full-screen photos and video refresh slowly on large displays.

Measured on ESP32-S31-Korvo-1 with #11630 applied.

Used when Otherwise
16-bit Bitmap, ColorConverter with RGB565 or RGB565_SWAPPED, no dither, 16-bit display, no scale, flip or transpose Per-pixel conversion, as before
Also no transparent color 32 pixels copied at a time
Why the output is the same
RGB565 to RGB888 and back Bits come back unchanged
Byte order Swapped only when input and display order differ
Transparent color Checked per pixel, as before
display.refresh() after bitmap.fill(), ESP32-S31-Korvo-1, median of 10 (min to max) Before This PR
800x480 16-bit, RGB565_SWAPPED 255.3 ms (255.1 to 255.4) 33.6 ms (33.4 to 35.1)
800x480 16-bit, RGB565 255.2 ms (255.0 to 255.4) 25.7 ms (25.1 to 26.0)
800x480 8-bit, Palette(256) 87.5 ms (86.8 to 87.7) 82.7 ms (82.0 to 82.9)
320x240 at (240, 120), RGB565_SWAPPED 51.6 ms (51.4 to 51.7), earlier run 7.9 ms (7.0 to 8.2)
320x240 at (240, 120), RGB565 51.6 ms (51.3 to 52.0), earlier run 5.9 ms (5.4 to 6.7)

The Palette loop is unchanged; its timing shows no slowdown.

Flash size Change
feather_m4_express +388 B
adafruit_metro_esp32s3 +440 B

Not tested on SPI displays.

AI assistance: written with Claude Code. I ran the hardware tests above.

A 16-bit Bitmap shown through an RGB565 ColorConverter without dithering
reaches a 16-bit display unchanged apart from byte order, so it can take
the existing row fast path instead of converting each pixel. Runs of 32
pixels not yet drawn are copied as a block when no transparent color is
set.

A full-screen 800x480 Bitmap on the ESP32-S31-Korvo-1 refreshes in about
35 ms instead of 255 ms.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dhalbert
dhalbert requested a review from tannewt October 19, 2026 15:57

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
tannewt merged commit f18e855 into adafruit:main Oct 19, 2026
616 checks passed
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.

2 participants