perf: graphics speedup — 120 строк × 2 buffer + 60 FPS cap + std memcpy

Found root cause for previous PSRAM-buffer black screen:
- esp_lcd_panel_io_spi не выставляет SPI_TRANS_DMA_USE_PSRAM
- IDF пытается аллоцировать временный SRAM такого же размера
- При 868КБ buffer'е — out of memory → flush молча падает → экран чёрный
- Это известный баг ESP-IDF (issue 8085), для QSPI-displays архитектурно не работает

Применённые ускорения:
1. SRAM buffer 100→120 строк × 2 (~224КБ из 327КБ): 3 прохода/кадр вместо 5
2. LV_DISP_DEF_REFR_PERIOD: 30→16 мс — 60 FPS cap (было 33)
3. LV_MEMCPY_MEMSET_STD: 0→1 — ROM memcpy/memset быстрее на 5-7%
4. LV_COLOR_SCREEN_TRANSP: 1→0 — нет alpha на root-layer, экономия на blending
This commit is contained in:
anor
2026-04-28 21:11:57 +10:00
parent e763f5fe2c
commit 87f80a7f61
2 changed files with 11 additions and 7 deletions
+3 -3
View File
@@ -32,7 +32,7 @@
/*Enable features to draw on transparent background.
*It's required if opa, and transform_* style properties are used.
*Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/
#define LV_COLOR_SCREEN_TRANSP 1
#define LV_COLOR_SCREEN_TRANSP 0 // нет полупрозрачных root-screens — экономим blending
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
@@ -71,14 +71,14 @@
#define LV_MEM_BUF_MAX_NUM 16
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
#define LV_MEMCPY_MEMSET_STD 0
#define LV_MEMCPY_MEMSET_STD 1 // ROM-овые memcpy/memset быстрее LVGL-ских (+5-7%)
/*====================
HAL SETTINGS
*====================*/
/*Default display refresh period. LVG will redraw changed areas with this period time*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
#define LV_DISP_DEF_REFR_PERIOD 16 /*[ms]*/ /*60 FPS cap (было 33 FPS / 30мс)*/
/*Input device read period in milliseconds*/
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
+8 -4
View File
@@ -36,11 +36,15 @@
* - Lager buffer size can improve FPS, but it will occupy more memory. Maximum buffer size is `width * height`.
* - The number of buffers should be 1 or 2.
*/
// Buffer в SRAM, 100 строк (~93КБ × 2 = 186КБ). Раньше было 20 строк → 24 прохода
// flush/кадр и видимые волны. С 100 строками — 5 проходов, волны не видны.
// PSRAM-buffer пробовали — экран чернеет (DMA с PSRAM на этом QSPI driver не работает).
// Buffer в SRAM, 120 строк × 2 буфера (~224КБ из 327КБ). Двойной буфер позволяет
// DMA отправлять один пока LVGL рисует второй параллельно — выгоднее одиночного
// буфера большего размера.
// PSRAM-buffer для LVGL не работает на этом QSPI driver: esp_lcd_panel_io_spi
// не выставляет SPI_TRANS_DMA_USE_PSRAM, и при PSRAM-источнике IDF пытается
// аллоцировать временный SRAM такого же размера → out-of-memory → flush падает
// молча → экран чёрный навсегда. Подтверждено в issue espressif/esp-idf #8085.
#define LVGL_PORT_BUFFER_MALLOC_CAPS (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)
#define LVGL_PORT_BUFFER_SIZE_HEIGHT (100)
#define LVGL_PORT_BUFFER_SIZE_HEIGHT (120)
#define LVGL_PORT_BUFFER_NUM (2)
/**