From 87f80a7f61e90cb1f3c07d0641e59d98f6d9f86d Mon Sep 17 00:00:00 2001 From: anor Date: Tue, 28 Apr 2026 21:11:57 +1000 Subject: [PATCH] =?UTF-8?q?perf:=20graphics=20speedup=20=E2=80=94=20120=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=BE=D0=BA=20=C3=97=202=20buffer=20+=2060?= =?UTF-8?q?=20FPS=20cap=20+=20std=20memcpy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- vertushka_esp32s3/lv_conf.h | 6 +++--- vertushka_esp32s3/lvgl_v8_port.h | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/vertushka_esp32s3/lv_conf.h b/vertushka_esp32s3/lv_conf.h index cd9d33c..d8a4ae0 100644 --- a/vertushka_esp32s3/lv_conf.h +++ b/vertushka_esp32s3/lv_conf.h @@ -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]*/ diff --git a/vertushka_esp32s3/lvgl_v8_port.h b/vertushka_esp32s3/lvgl_v8_port.h index f532f42..67b1440 100644 --- a/vertushka_esp32s3/lvgl_v8_port.h +++ b/vertushka_esp32s3/lvgl_v8_port.h @@ -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) /**