Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: lvgl performance tuning #39

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions zephyr/Kconfig.memory
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,31 @@ config LV_Z_DOUBLE_VDB
help
Use two buffers to render and flush data in parallel

config LV_Z_FULL_REFRESH
bool "Force full refresh mode"
help
Force full refresh of display on update. When combined with
LV_Z_VDB_SIZE, this setting can improve performance for display
controllers that require a framebuffer to be present in system memory,
since the controller can render the LVGL framebuffer directly

config LV_Z_VDB_ALIGN
int "Rending buffer alignment"
default 4
depends on LV_Z_BUFFER_ALLOC_STATIC
help
Rendering buffer alignment. Depending on chosen color depth,
buffer may be accessed as a uint8_t *, uint16_t *, or uint32_t *,
so buffer must be aligned to prevent unaligned memory access

config LV_Z_VBD_CUSTOM_SECTION
bool "Link rendering buffers to custom section"
depends on LV_Z_BUFFER_ALLOC_STATIC
help
Place LVGL rendering buffers in custom section, with tag ".lvgl_buf".
This can be used by custom linker scripts to relocate the LVGL
rendering buffers to a custom location, such as tightly coupled or
external memory.
choice
prompt "Rendering Buffer Allocation"
default LV_Z_BUFFER_ALLOC_STATIC
Expand Down
17 changes: 15 additions & 2 deletions zephyr/lvgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,19 @@ static lv_disp_draw_buf_t disp_buf;
* uint16_t * or uint32_t *, therefore buffer needs to be aligned accordingly to
* prevent unaligned memory accesses.
*/
static uint8_t buf0[BUFFER_SIZE] __aligned(4);
static uint8_t buf0[BUFFER_SIZE]
#ifdef CONFIG_LV_Z_VBD_CUSTOM_SECTION
Z_GENERIC_SECTION(.lvgl_buf)
#endif
__aligned(CONFIG_LV_Z_VDB_ALIGN);

#ifdef CONFIG_LV_Z_DOUBLE_VDB
static uint8_t buf1[BUFFER_SIZE] __aligned(4);
static uint8_t buf1[BUFFER_SIZE]
#ifdef CONFIG_LV_Z_VBD_CUSTOM_SECTION
Z_GENERIC_SECTION(.lvgl_buf)
#endif
__aligned(CONFIG_LV_Z_VDB_ALIGN);
#endif /* CONFIG_LV_Z_DOUBLE_VDB */

#endif /* CONFIG_LV_Z_BUFFER_ALLOC_STATIC */

Expand Down Expand Up @@ -353,6 +362,10 @@ static int lvgl_init(void)
lv_disp_drv_init(&disp_drv);
disp_drv.user_data = (void *)&disp_data;

#ifdef CONFIG_LV_Z_FULL_REFRESH
disp_drv.full_refresh = 1;
#endif

err = lvgl_allocate_rendering_buffers(&disp_drv);
if (err != 0) {
return err;
Expand Down
Loading