How to utilize STM32 LTDC 2 layers to boost the performance


What MCU/Processor/Board and compiler are you using?

STM32F429ZIT6. Display Resolution 800*480, pixel - 16 bit

What LVGL version are you using?


What do you want to achieve?

Improve performance by utilizing LTDC peripheral’s both layers.

What have you tried so far?

Only Layer 1

Code to reproduce

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

@kisvegabor can you help on this.

I think using 2 layers is not the best way (at least not a generic way) to improve the performance.

I suggest to take look at this Introduction — LVGL documentation

Hello, I have tried the *suggestions mentioned in the link. But the refreshing is still slow. Video link
*Also tried double buffering, but it doesn’t make any difference. So, used only single buffer.

Display Resolution 800*480 (Landscape).
I have also attached lvgl config files. tft.c (7.1 KB), lv_conf.h (25.1 KB)

Keshav Aggarwal

I think it’s slow because of disp_drv.sw_rotate = 1; You can increase LV_DISP_ROT_MAX_BUF to 40*1024. Does it make any difference?

Be sure compiler optimization is set to -O2 or -O3.

Note that using DMA this way in the flush_cb won’t work later if only parts of the screen is updated. For the sake of simplicity I suggest using something like this for now.

Hello. Thanks for replying,
I have tried LV_DISP_ROT_MAX_BUF to 40*1024. Still no difference.
opt level is already set to -O3.

I also tried replacing DMA with below. The colors got distorted and refresh speed was a bit slower as compared with DMA (Not much).

uint32_t w = lv_area_get_width(area);
for(y = area->y1; y <= area->y2 && y < vres; y++) {
    memcpy(&monitor.tft_fb[y * hres + area->x1], color_p, w * sizeof(lv_color_t));
    color_p += w;