Skip to content

Let ESP32-S3 boards build with the LVGL display core - #11976

Open
mikeysklar wants to merge 2 commits into
adafruit:mainfrom
mikeysklar:lvgl-esp32s3-build
Open

mikeysklar wants to merge 2 commits into
adafruit:mainfrom
mikeysklar:lvgl-esp32s3-build

Conversation

@mikeysklar

Copy link
Copy Markdown
Collaborator

What

ESP32-S3 boards can now be built with the LVGL display core turned on.

Why

It only built on the P4 and S31, which have a graphics accelerator the S3 lacks.

Change
Accelerator (PPA) Linked and used only on chips that have one
LV_CONF_INCLUDE_SIMPLE Set whenever LVGL is on, not per chip
GC block size 64 bytes when LVGL is on, for LVGL's draw buffer alignment (P4 and S31 already use 64)
JpegDecoderFast.c Drop an initializer the LVGL area type doesn't have
Tested
Board Adafruit Qualia ESP32-S3, 4" 720x720 panel (5795), CIRCUITPY_DISPLAYIO_LVGL=1 CIRCUITPY_BLEIO_NATIVE=0 CIRCUITPY_ULAB=0
Result Boots; displayio output equals legacy displayio at 60/60 pixel checks; 95,280 bytes flash free
Builds Metro ESP32-P4 and S31 korvo_1 defaults build
Flash Qualia with only LVGL on is 237,376 bytes over its 2 MB firmware space
Not changed No board turns LVGL on by default

Which way should an S3 board make room: turn modules off, or a larger firmware partition?

Written with Claude Code. Results are build logs and serial output from the board.

🤖 Generated with Claude Code

Building with CIRCUITPY_DISPLAYIO_LVGL=1 only worked on the P4 and S31.

- Link the PPA components and turn on LVGL's PPA draw unit only on
  chips that have a PPA.
- Add LV_CONF_INCLUDE_SIMPLE whenever LVGL is on, not only in the P4 and
  S31 sections.
- Use 64-byte GC blocks when LVGL is on, so heap draw buffers meet
  LV_DRAW_BUF_ALIGN. The P4 and S31 already do.
- Drop the extra initializer in JpegDecoderFast.c. The LVGL
  displayio_area_t has no next field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhalbert

Copy link
Copy Markdown
Collaborator

Which way should an S3 board make room: turn modules off, or a larger firmware partition?

Changing the firmware partition requires changing the bootloader and makes an incompatible change. But is S3 compiled with -O2 or -Os?

@mikeysklar

mikeysklar commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

The ESP-S3 is -O2only RISC-V defaults to -Os.

Qualia with LVGL on, same commit:

Flash free Python call loop Full-screen 8-bit refresh
-O2, BLE + ulab off 95,376 665 ms 340 ms
-Os, BLE off 151,760 711 ms 360 ms

-Os saves 156 KB for 0 to 8% slower, and a full-screen RGB565 refresh doesn't change.

With -Os, turning off BLE alone is enough to fit, and no Qualia guide uses BLE.

I'm fine with using -Os for LVGL ESP32-S3 builds. 8% is nothing and we get 156 KB back!

@tannewt

tannewt commented Nov 30, 2026

Copy link
Copy Markdown
Member

I don't think you should turn anything off. -Os is fine though.

@dhalbert

Copy link
Copy Markdown
Collaborator

How much flash does BLE take?

@mikeysklar

Copy link
Copy Markdown
Collaborator Author

@dhalbert BLE is about 214 KB on this build (ulab is about 100 KB).

@tannewt -Os alone is still 62 KB over.

Looking at alternatives to turn off for the Qualia :

Qualia + LVGL, -Os Free in 2 MB
Everything on -62,384
espcamera, qrio, epaperdisplay, _eve, canio off 24,960

@dhalbert

Copy link
Copy Markdown
Collaborator

@mikeysklar I have not done a lot of trying to shrink the espressif builds via ESP-IDF settings as opposed to disabling modules. Could do a little research on that.

What does LVGL buy us on Qualia as opposed to classic displayio? Speed?

@mikeysklar

Copy link
Copy Markdown
Collaborator Author

@dhalbert -

Best case on the Qualia 720x720 with the LVGL full screen was 2x as fast.

  • 8-bit palette, full screen write: 236 ms legacy vs 114 ms LVGL (2x)

LVGL also leaves about 2 MB less heap after display init. I don't think that trade is worth it on the S3. JPEG already uses the fast decoder, and I can add an esp-dsp FFT for ulab.

If we still want it, turning off BLE alone is enough with -Os.

ESP-IDF doesn't have much left to give:

  • Already -Os, with logging, assertions and error names off, and nano printf
  • About 340 KB is Espressif's closed Wi-Fi/BLE libraries
  • SoftAP and WPA3 off: about 45 KB, but loses features

@tannewt

tannewt commented Dec 1, 2026

Copy link
Copy Markdown
Member

espcamera, qrio, epaperdisplay, _eve, canio off

These are fine to disable because there aren't external pins to use them with. I wouldn't disable BLE though because it may still be useful with a display.

Turn off espcamera, qrio, epaperdisplay, _eve and canio, which have no
external pins on this board, and build ESP32-S3 LVGL builds at -Os so
the firmware fits the 2 MB app partition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mikeysklar

mikeysklar commented Dec 2, 2026 •

Copy link
Copy Markdown
Collaborator Author

Qualia boards now turn off espcamera, qrio, epaperdisplay, _eve and canio, keeps BLE, and builds with -Os.

That leaves 25 kB free.

Full-screen LVGL refresh is slower until two follow-up PRs land, then up to 2x faster.

  • Update LVGL to pick up two speedups for full-screen images.
  • Let LVGL draw straight into the dot-clock screen memory instead of copying strips.

@mikeysklar
mikeysklar requested a review from a team December 2, 2026 00:46
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.

3 participants