Repository navigation
feat(display): allocate the draw buffers aligned to LV_DRAW_BUF_ALIGN - #916
Merged
Merged
Conversation
LVGL's lv_display_set_buffers() refuses buffers that are not aligned to LV_DRAW_BUF_ALIGN, and the display then draws nothing. Display allocated its draw buffers with plain heap_caps_malloc(), so raising LV_DRAW_BUF_ALIGN (LVGL's PPA draw unit on the ESP32-P4 requires the data cache line size, 128) broke every board whose BSP lets Display allocate them. - The DynamicMemoryConfig buffers come from heap_caps_aligned_alloc() at vram_alignment() (LV_DRAW_BUF_ALIGN, at least a pointer), their size rounded up to a multiple of it, so no other allocation shares their last cache line. - A StaticMemoryConfig buffer that is not aligned is logged as an error instead of failing silently. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
|
✅Static analysis result - no issues found! ✅ |
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.
What
espp::Displayallocates its draw buffers (DynamicMemoryConfig) aligned toLV_DRAW_BUF_ALIGN:heap_caps_aligned_alloc()at the newvram_alignment()(LV_DRAW_BUF_ALIGN, at least a pointer's size).heap_caps_free().A
StaticMemoryConfigbuffer that is not aligned is now logged as an error, instead of the display silently drawing nothing. The README notes the requirement.Why
LVGL's
lv_display_set_buffers()refuses buffers that are not aligned toLV_DRAW_BUF_ALIGN(LV_CHECK_ARGinlv_display.c), and the display then draws nothing. LVGL's PPA draw unit on the ESP32-P4 (LV_USE_PPA) requiresLV_DRAW_BUF_ALIGNto equal the data cache line size (128; its private header refuses to compile otherwise).heap_caps_malloc()gives no such alignment, so any BSP that letsDisplayallocate its buffers could not use the PPA draw unit.With the default
LV_DRAW_BUF_ALIGN(4) the allocation is the same as before, rounded to 4 bytes.Test
On an M5Stack Tab5 (ESP32-P4, ESP-IDF 6.1, LVGL 9.6.0), in an application whose BSP (
M5StackTab5::initialize_display()) letsDisplayallocate two 184 KB draw buffers in PSRAM, built withLV_DRAW_BUF_ALIGN=128:LV_USE_PPAon and with it off, the UI draws: six scripted 20 s scroll runs of a 1280 x 720 launcher, with screenshots checked.LV_DRAW_BUF_ALIGN=4(the default) was not run on hardware with this branch; it takes the same code path with a 4-byte alignment.The Tab5 BSP change that goes with the PPA draw unit (its flush rotation) is a separate PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY