Skip to content

Commit 10accf8

Browse files
committed
lvgl: display buffer in SPIRAM
It appears the problem of LVGL saturating an entire CPU core isn't fixed by the increased buffer size. When a response is long enough to trigger scrolling of the label on the display, Willow would crash sometimes even after the first occurence. The torture test command and response are not long enough to trigger scrolling, so it didn't catch this. Further increasing the buffer then resulted in the TLS component not being able to allocate memory. Let's try something completely different: display buffer in SPIRAM. This didn't work when I tried initially, and the screen would draw only partially. Then stumbled on trans_size in the esp_lvgl_port README. It appears enabling that, makes display buffer in SPIRAM work. Since we have plenty SPIRAM, let's just create a buffer large enough for the entire screen, enable double buffering, and use a trans_size of 1/10 the screen size. This is my last attempt to fix this horribly buggy scrolling feature before I disable it.
1 parent e798eee commit 10accf8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

main/slvgl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ esp_err_t init_lvgl_display(void)
102102
ESP_LOGD(TAG, "init_lvgl: lcdp->lcd_io_handle: %p", lcdp->lcd_io_handle);
103103

104104
const lvgl_port_display_cfg_t cfg_ld = {
105-
.buffer_size = LCD_H_RES * LCD_V_RES / 5,
106-
.double_buffer = false,
105+
.buffer_size = LCD_H_RES * LCD_V_RES,
106+
.double_buffer = true,
107107
// DMA and SPIRAM
108108
// E (16:37:21.267) LVGL: lvgl_port_add_disp(190): Alloc DMA capable buffer in SPIRAM is not supported!
109109
.flags = {
110-
.buff_dma = true,
111-
.buff_spiram = false,
110+
.buff_dma = false,
111+
.buff_spiram = true,
112112
},
113113
.hres = LCD_H_RES,
114114
// confirmed this is correct by printf %p periph_lcd->lcd_io_handle in esp_peripherals/periph_lcd.c
@@ -120,6 +120,7 @@ esp_err_t init_lvgl_display(void)
120120
.mirror_y = LCD_MIRROR_Y,
121121
.swap_xy = LCD_SWAP_XY,
122122
},
123+
.trans_size = LCD_H_RES * LCD_V_RES / 10,
123124
.vres = LCD_V_RES,
124125
};
125126

0 commit comments

Comments
 (0)