Repository navigation
Add LVGL implementation of displayio - #11887
Conversation
2d1e92f to
b0de524
Compare
Generally this splits displayio related modules into legacy and lvgl implementation directories. Headers stay at the outside level and include the implementation specific version. The LVGL version does not do everything that the legacy version does because there are many weird corners. For example, the color conversion stuff we do for e-paper doesn't fit nicely into LVGL. The LVGL implementation is focused on speed instead of memory footprint. This means that some code that legacy displayio can run slowly won't run with LVGL. Unfortunately, LVGL may run out of memory during compositing and is hard to recover from. A new safe mode is added for this case so that the failure is clear. Another primary consideration in the LVGL implementation is the internal buffer formats and how they impact future acceleration. For example, TileGrid stores indexed bitmaps as-is (unless used in a tile mapping) so that chips with accelerated color mapping can be used. We don't use LVGL for tile mapping because it causes many many images to change content and triggers a full display refresh. Instead, we store a pre-composed full color buffer for multi-tile TileGrids. This costs RAM but makes compositing much easier. TileGrid scrolling is optimized to have four views into this buffer to prevent moving many pixels. Co-authored-by: Mikey Sklar <mikeysklar@gmail.com>
b0de524 to
4401a7d
Compare
The blinka and terminal font bitmaps lost const for every build, which moved about 1 KB from flash into DRAM. ESP32-S2 boards then overflowed dram0_0_seg by 600 to 1200 bytes. Only LVGL builds need them writable. Tested: Metro ESP32-S2 builds (dram0 99.73%) and boots, terminal font reads from flash. Metro ESP32-P4 boots and runs homeview. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested on Metro ESP32-P4 with homeview and Teensy Chess, works well. The S2 DRAM overflow is the dropped A few ESP_LOGI calls look left over from debugging, in lvgl_port.c, port.c, Bitmap.c and FramebufferDisplay.c. I'll follow up with an LVGL re-pin for PPA rotate once lvgl#10979 lands. |
There was a problem hiding this comment.
Great progress toward unified displayio!
Since there was a lot of refactoring of shared displayio code, I tested the PyPortal artifact from this build (I know it's not LVGL) against 11.0.0-alpha.3. Claude wrote a thorough displayio test and I stepped through it on a PyPortal and PyPortal Titano, one running the PR build and one the stock build. Saw no differences.
(Yes, I could have used a camera, but my eyes are good and I don't want to spend tokens on that now.)
A few comments.
Also, did you run the code comments through the kind of prose clarifier I asked you for in a previous PR? The comments are ok, but clearly LLM output.
Keep display resource bitmaps const outside LVGL builds
dhalbert
left a comment
There was a problem hiding this comment.
OK! Let's get it in and in use.
|
There are DRAM-size-related build errors like |
Yup, working on it. |
|
Ok, @dhalbert the build is green. |
Generally this splits displayio related modules into legacy and lvgl implementation directories. Headers stay at the outside level and include the implementation specific version.
The LVGL version does not do everything that the legacy version does because there are many weird corners. For example, the color conversion stuff we do for e-paper doesn't fit nicely into LVGL.
The LVGL implementation is focused on speed instead of memory footprint. This means that some code that legacy displayio can run slowly won't run with LVGL. Unfortunately, LVGL may run out of memory during compositing and is hard to recover from. A new safe mode is added for this case so that the failure is clear.
Another primary consideration in the LVGL implementation is the internal buffer formats and how they impact future acceleration. For example, TileGrid stores indexed bitmaps as-is (unless used in a tile mapping) so that chips with accelerated color mapping can be used.
We don't use LVGL for tile mapping because it causes many many images to change content and triggers a full display refresh. Instead, we store a pre-composed full color buffer for multi-tile TileGrids. This costs RAM but makes compositing much easier. TileGrid scrolling is optimized to have four views into this buffer to prevent moving many pixels.