From 03ba5d9d39b238f12ff25fb6579ac5ba22fa1c49 Mon Sep 17 00:00:00 2001 From: marcus_xu Date: Wed, 28 Jun 2023 14:29:08 +0800 Subject: [PATCH 1/2] framebuffer: esp-box/esp-box-lite use framebuf height form Kconfig --- esp-box-lite/Kconfig | 14 ++++++++++++++ esp-box-lite/esp-box-lite.c | 6 +++--- esp-box-lite/idf_component.yml | 2 +- esp-box-lite/include/bsp/esp-box-lite.h | 5 ----- esp-box/Kconfig | 14 ++++++++++++++ esp-box/esp-box.c | 6 +++--- esp-box/idf_component.yml | 2 +- esp-box/include/bsp/esp-box.h | 3 --- 8 files changed, 36 insertions(+), 16 deletions(-) diff --git a/esp-box-lite/Kconfig b/esp-box-lite/Kconfig index e3f541b3..13a08f73 100644 --- a/esp-box-lite/Kconfig +++ b/esp-box-lite/Kconfig @@ -60,6 +60,20 @@ menu "Board Support Package" help LEDC channel is used to generate PWM signal that controls display brightness. Set LEDC index that should be used. + + config BSP_LCD_DRAW_BUF_HEIGHT + int "LCD framebuf height" + default 100 + range 10 240 + help + Framebuf is used for lvgl rendering output. + + config BSP_LCD_DRAW_BUF_DOUBLE + int "LCD framebuf number" + default 0 + range 0 1 + help + Whether to enable double framebuf. endmenu config BSP_I2S_NUM diff --git a/esp-box-lite/esp-box-lite.c b/esp-box-lite/esp-box-lite.c index c7f55daa..cc9d6981 100644 --- a/esp-box-lite/esp-box-lite.c +++ b/esp-box-lite/esp-box-lite.c @@ -371,7 +371,7 @@ static lv_disp_t *bsp_display_lcd_init(void) esp_lcd_panel_io_handle_t io_handle = NULL; esp_lcd_panel_handle_t panel_handle = NULL; const bsp_display_config_t bsp_disp_cfg = { - .max_transfer_sz = BSP_LCD_DRAW_BUFF_SIZE * sizeof(uint16_t), + .max_transfer_sz = (BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT) * sizeof(uint16_t), }; BSP_ERROR_CHECK_RETURN_NULL(bsp_display_new(&bsp_disp_cfg, &panel_handle, &io_handle)); @@ -382,8 +382,8 @@ static lv_disp_t *bsp_display_lcd_init(void) const lvgl_port_display_cfg_t disp_cfg = { .io_handle = io_handle, .panel_handle = panel_handle, - .buffer_size = BSP_LCD_DRAW_BUFF_SIZE, - .double_buffer = BSP_LCD_DRAW_BUFF_DOUBLE, + .buffer_size = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT, + .double_buffer = CONFIG_BSP_LCD_DRAW_BUF_DOUBLE, .hres = BSP_LCD_H_RES, .vres = BSP_LCD_V_RES, .monochrome = false, diff --git a/esp-box-lite/idf_component.yml b/esp-box-lite/idf_component.yml index 8f00b460..9ca663f0 100644 --- a/esp-box-lite/idf_component.yml +++ b/esp-box-lite/idf_component.yml @@ -1,4 +1,4 @@ -version: "1.0.1" +version: "1.0.2" description: Board Support Package for ESP32-S3-BOX-Lite url: https://github.com/espressif/esp-bsp/tree/master/esp-box-lite diff --git a/esp-box-lite/include/bsp/esp-box-lite.h b/esp-box-lite/include/bsp/esp-box-lite.h index d7e7de12..dbbc05dc 100644 --- a/esp-box-lite/include/bsp/esp-box-lite.h +++ b/esp-box-lite/include/bsp/esp-box-lite.h @@ -299,11 +299,6 @@ esp_err_t bsp_spiffs_unmount(void); #define BSP_LCD_PIXEL_CLOCK_HZ (40 * 1000 * 1000) #define BSP_LCD_SPI_NUM (SPI3_HOST) -#ifndef BSP_LCD_DRAW_BUFF_SIZE -#define BSP_LCD_DRAW_BUFF_SIZE (BSP_LCD_H_RES * 100) -#endif -#define BSP_LCD_DRAW_BUFF_DOUBLE (0) - /** * @brief Initialize display * diff --git a/esp-box/Kconfig b/esp-box/Kconfig index 1c001bdf..016f66a7 100644 --- a/esp-box/Kconfig +++ b/esp-box/Kconfig @@ -60,6 +60,20 @@ menu "Board Support Package" help LEDC channel is used to generate PWM signal that controls display brightness. Set LEDC index that should be used. + + config BSP_LCD_DRAW_BUF_HEIGHT + int "LCD framebuf height" + default 100 + range 10 240 + help + Framebuf is used for lvgl rendering output. + + config BSP_LCD_DRAW_BUF_DOUBLE + int "LCD framebuf number" + default 0 + range 0 1 + help + Whether to enable double framebuf. endmenu config BSP_I2S_NUM diff --git a/esp-box/esp-box.c b/esp-box/esp-box.c index ddd2bcea..e4a24945 100644 --- a/esp-box/esp-box.c +++ b/esp-box/esp-box.c @@ -362,7 +362,7 @@ static lv_disp_t *bsp_display_lcd_init(void) esp_lcd_panel_io_handle_t io_handle = NULL; esp_lcd_panel_handle_t panel_handle = NULL; const bsp_display_config_t bsp_disp_cfg = { - .max_transfer_sz = BSP_LCD_DRAW_BUFF_SIZE * sizeof(uint16_t), + .max_transfer_sz = (BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT) * sizeof(uint16_t), }; BSP_ERROR_CHECK_RETURN_NULL(bsp_display_new(&bsp_disp_cfg, &panel_handle, &io_handle)); @@ -373,8 +373,8 @@ static lv_disp_t *bsp_display_lcd_init(void) const lvgl_port_display_cfg_t disp_cfg = { .io_handle = io_handle, .panel_handle = panel_handle, - .buffer_size = BSP_LCD_DRAW_BUFF_SIZE, - .double_buffer = BSP_LCD_DRAW_BUFF_DOUBLE, + .buffer_size = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT, + .double_buffer = CONFIG_BSP_LCD_DRAW_BUF_DOUBLE, .hres = BSP_LCD_H_RES, .vres = BSP_LCD_V_RES, .monochrome = false, diff --git a/esp-box/idf_component.yml b/esp-box/idf_component.yml index b752200e..55fdb451 100644 --- a/esp-box/idf_component.yml +++ b/esp-box/idf_component.yml @@ -1,5 +1,5 @@ -version: "2.4.1" +version: "2.4.2" description: Board Support Package for ESP-BOX url: https://github.com/espressif/esp-bsp/tree/master/esp-box diff --git a/esp-box/include/bsp/esp-box.h b/esp-box/include/bsp/esp-box.h index 6e587092..7cebf573 100644 --- a/esp-box/include/bsp/esp-box.h +++ b/esp-box/include/bsp/esp-box.h @@ -283,9 +283,6 @@ esp_err_t bsp_spiffs_unmount(void); #define BSP_LCD_PIXEL_CLOCK_HZ (40 * 1000 * 1000) #define BSP_LCD_SPI_NUM (SPI3_HOST) -#define BSP_LCD_DRAW_BUFF_SIZE (BSP_LCD_H_RES * 10) -#define BSP_LCD_DRAW_BUFF_DOUBLE (0) - /** * @brief Initialize display * From 67cb318e0c97494bcef8e71c40a8dee0426b8635 Mon Sep 17 00:00:00 2001 From: marcus_xu Date: Wed, 28 Jun 2023 19:58:15 +0800 Subject: [PATCH 2/2] framebuffer: BSP_LCD_DRAW_BUF_DOUBLE set bool type --- esp-box-lite/Kconfig | 5 ++--- esp-box-lite/esp-box-lite.c | 6 +++++- esp-box/Kconfig | 5 ++--- esp-box/esp-box.c | 6 +++++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/esp-box-lite/Kconfig b/esp-box-lite/Kconfig index 13a08f73..28457ae6 100644 --- a/esp-box-lite/Kconfig +++ b/esp-box-lite/Kconfig @@ -69,9 +69,8 @@ menu "Board Support Package" Framebuf is used for lvgl rendering output. config BSP_LCD_DRAW_BUF_DOUBLE - int "LCD framebuf number" - default 0 - range 0 1 + bool "LCD double framebuf" + default n help Whether to enable double framebuf. endmenu diff --git a/esp-box-lite/esp-box-lite.c b/esp-box-lite/esp-box-lite.c index cc9d6981..7365a056 100644 --- a/esp-box-lite/esp-box-lite.c +++ b/esp-box-lite/esp-box-lite.c @@ -383,7 +383,11 @@ static lv_disp_t *bsp_display_lcd_init(void) .io_handle = io_handle, .panel_handle = panel_handle, .buffer_size = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT, - .double_buffer = CONFIG_BSP_LCD_DRAW_BUF_DOUBLE, +#if CONFIG_BSP_LCD_DRAW_BUF_DOUBLE + .double_buffer = 1, +#else + .double_buffer = 0, +#endif .hres = BSP_LCD_H_RES, .vres = BSP_LCD_V_RES, .monochrome = false, diff --git a/esp-box/Kconfig b/esp-box/Kconfig index 016f66a7..162d1bfd 100644 --- a/esp-box/Kconfig +++ b/esp-box/Kconfig @@ -69,9 +69,8 @@ menu "Board Support Package" Framebuf is used for lvgl rendering output. config BSP_LCD_DRAW_BUF_DOUBLE - int "LCD framebuf number" - default 0 - range 0 1 + bool "LCD double framebuf" + default n help Whether to enable double framebuf. endmenu diff --git a/esp-box/esp-box.c b/esp-box/esp-box.c index e4a24945..3025d4e6 100644 --- a/esp-box/esp-box.c +++ b/esp-box/esp-box.c @@ -374,7 +374,11 @@ static lv_disp_t *bsp_display_lcd_init(void) .io_handle = io_handle, .panel_handle = panel_handle, .buffer_size = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT, - .double_buffer = CONFIG_BSP_LCD_DRAW_BUF_DOUBLE, +#if CONFIG_BSP_LCD_DRAW_BUF_DOUBLE + .double_buffer = 1, +#else + .double_buffer = 0, +#endif .hres = BSP_LCD_H_RES, .vres = BSP_LCD_V_RES, .monochrome = false,