This document provides steps, how to set up your LCD and LVGL port for the best performance and comparison of different settings. All settings and measurements are valid for Espressif’s chips.
In this document we will use following metrics for performance evaluation:
Following options and settings have impact on LCD performance (FPS). Some options yield only small difference in FPS (e.g. ~1 FPS), and some of them are more significant. Usually it depends on complexity of the graphical application (number of widgets…), resources (CPU time, RAM available…) and size of screen (definition and color depth).
Another set of key parametes are hardware related (graphical IO, frame buffer location), which are not yet covered in this document.
This is by far the most significant setting. Users are encouraged to focus on correct frame buffer configuration before moving ahead with other optimizations.
On the other hand, the frame buffer(s) will consume significant portion of your RAM. In the graph below, you can see different frame buffer settings and resulting FPS:
Main takeaways from the graph are:
Note: The measurements are valid for frame buffer in internal SRAM. Placing the frame buffer into external PSRAM will yield worse results.
Recommended level is “Performance” for good results. The “Performance” setting causes the compiled code to be larger and faster.
CONFIG_COMPILER_OPTIMIZATION_PERF=y
The CPU frequency has a big impact on LCD performance. The recommended value is maximum -> 240 MHz.
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
The flash clock frequency and mode (bus width) has a big impact on LCD performance. Your choices will be limited by your hardware flash configuration. The higher the frequency and bus width, the better.
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
or CONFIG_ESPTOOLPY_OCT_FLASH
on supported chipsMore information about SPI Flash configuration can be found in ESP-IDF Programming Guide.
This option puts the most frequently used LVGL functions into IRAM for execution speed up.
CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y
The main LVGL task can be processed on the second core of the CPU. It can increase performance. (It is available only on dual-core chips)
CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y
memcpy
and memset
instead LVGL’s configurationNative esp-idf implementation are a little (~1-3 FPS) faster.
CONFIG_LV_MEMCPY_MEMSET_STD=y
This setting can improve subjective performance during screen transitions (scrolling, etc.).
CONFIG_LV_DISP_DEF_REFR_PERIOD=10
Default settings:
display_lvgl_demos
with ws_7inch
componentAverage FPS | Weighted FPS | Changed settings |
---|---|---|
17 | 32 | Default |
18 | 36 | + Optimization: Performance (CONFIG_COMPILER_OPTIMIZATION_PERF=y ) |
21 | 46 | + CPU frequency: 240 MHz (CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y ) |
26 | 56 | + Flash frequency: 120 MHz, Flash mode: QIO (CONFIG_ESPTOOLPY_FLASHFREQ_120M=y + CONFIG_ESPTOOLPY_FLASHMODE_QIO=y ) |
28 | 60 | + LVGL fast memory enabled (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y ) |
41 | 55 | + (CONFIG_LV_DISP_DEF_REFR_PERIOD=10 ) |
Default changes:
Average FPS | Weighted FPS | Changed settings |
---|---|---|
11 | 7 | Default |
11 | 7 | + Optimization: Performance (CONFIG_COMPILER_OPTIMIZATION_PERF=y ) |
12 | 8 | + CPU frequency: 240 MHz (CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y ) |
12 | 9 | + Flash frequency: 120 MHz, PSRAM frequency: 120 MHz, Flash mode: QIO (CONFIG_ESPTOOLPY_FLASHFREQ_120M=y + CONFIG_SPIRAM_SPEED_120M=y + CONFIG_ESPTOOLPY_FLASHMODE_QIO=y ) |
12 | 9 | + LVGL fast memory enabled (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y ) |
12 | 8 | + LVGL buffer size: 800 x 480 |
26 | 8 | + (CONFIG_LV_DISP_DEF_REFR_PERIOD=10 ) |
31 | 23 | + LCD clock: 10 MHz 1 |
esp_lvgl_port
), PSRAM (octal) with GDMA - ESP32-S3-LCD-EV-BOARDDefault settings:
display_lvgl_demos
Average FPS | Weighted FPS | Changed settings |
---|---|---|
18 | 24 | Default |
18 | 26 | + Optimization: Performance (CONFIG_COMPILER_OPTIMIZATION_PERF=y ) |
21 | 32 | + CPU frequency: 240 MHz (CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y ) |
21 | 32 | + Flash mode: QIO (CONFIG_ESPTOOLPY_FLASHMODE_QIO=y ) |
21 | 32 | + LVGL fast memory enabled (CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM=y ) |
35 | 34 | + (CONFIG_LV_DISP_DEF_REFR_PERIOD=10 ) |
The graphical performance depends on a lot of things and settings, many of which affect the whole system (Compiler, Flash, CPU, PSRAM configuration…). The user should primarily focus on trade-off between frame-buffer(s) size and RAM consumption of the buffer, before optimizing the design further.
Other configuration options not covered in this document are:
This is not working in default and sometimes in fast changes on screen is not working properly. ↩