Skip to content

Commit 09f0b14

Browse files
Merge pull request #524 from espressif/fix/lvgl_draw_buf_alignment
fix(esp_lvgl_port): Fix draw buffer alignment
2 parents 41d8689 + 8917b34 commit 09f0b14

16 files changed

+23
-4
lines changed

bsp/m5dial/idf_component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies:
1616
espressif/esp_lvgl_port:
1717
version: "^2"
1818
public: true
19+
override_path: "../../components/esp_lvgl_port"
1920

2021
button:
2122
public: true

bsp/m5stack_core_s3/idf_component.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies:
1616
espressif/esp_lvgl_port:
1717
version: "^2"
1818
public: true
19+
override_path: "../../components/esp_lvgl_port"
1920

2021
esp_codec_dev:
2122
version: "~1.3.1"

components/esp_lvgl_port/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
### Fixes
99
- Fixed buffer size by selected color format
1010
- Fixed memory leak in LVGL8 in display removing https://github.com/espressif/esp-bsp/issues/462
11+
- Fixed draw buffer alignment
1112

1213
## 2.4.4
1314

components/esp_lvgl_port/include/esp_lvgl_port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typedef struct {
6262
#define ESP_LVGL_PORT_INIT_CONFIG() \
6363
{ \
6464
.task_priority = 4, \
65-
.task_stack = 6144, \
65+
.task_stack = 7168, \
6666
.task_affinity = -1, \
6767
.task_max_sleep_ms = 500, \
6868
.timer_period_ms = 5, \

components/esp_lvgl_port/src/lvgl9/esp_lvgl_port_disp.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/*
2-
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

77
#include <string.h>
8+
#include "sdkconfig.h"
89
#include "esp_log.h"
910
#include "esp_err.h"
1011
#include "esp_check.h"
@@ -32,6 +33,10 @@
3233
#define LVGL_PORT_HANDLE_FLUSH_READY 1
3334
#endif
3435

36+
#ifndef CONFIG_LV_DRAW_BUF_ALIGN
37+
#define CONFIG_LV_DRAW_BUF_ALIGN 1
38+
#endif
39+
3540
static const char *TAG = "LVGL";
3641

3742
/*******************************************************************************
@@ -308,10 +313,10 @@ static lv_display_t *lvgl_port_add_disp_priv(const lvgl_port_display_cfg_t *disp
308313
} else {
309314
/* alloc draw buffers used by LVGL */
310315
/* it's recommended to choose the size of the draw buffer(s) to be at least 1/10 screen sized */
311-
buf1 = heap_caps_malloc(buffer_size * color_bytes, buff_caps);
316+
buf1 = heap_caps_aligned_alloc(CONFIG_LV_DRAW_BUF_ALIGN, buffer_size * color_bytes, buff_caps);
312317
ESP_GOTO_ON_FALSE(buf1, ESP_ERR_NO_MEM, err, TAG, "Not enough memory for LVGL buffer (buf1) allocation!");
313318
if (disp_cfg->double_buffer) {
314-
buf2 = heap_caps_malloc(buffer_size * color_bytes, buff_caps);
319+
buf2 = heap_caps_aligned_alloc(CONFIG_LV_DRAW_BUF_ALIGN, buffer_size * color_bytes, buff_caps);
315320
ESP_GOTO_ON_FALSE(buf2, ESP_ERR_NO_MEM, err, TAG, "Not enough memory for LVGL buffer (buf2) allocation!");
316321
}
317322

examples/display_lvgl_benchmark/sdkconfig.bsp.esp-box

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ CONFIG_LV_MEMCPY_MEMSET_STD=y
3131

3232
## LVGL9 ##
3333
CONFIG_LV_CONF_SKIP=y
34+
CONFIG_LV_DEF_REFR_PERIOD=10
3435

3536
#CLIB default
3637
CONFIG_LV_USE_CLIB_MALLOC=y

examples/display_lvgl_benchmark/sdkconfig.bsp.esp-box-3

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CONFIG_LV_MEMCPY_MEMSET_STD=y
3232

3333
## LVGL9 ##
3434
CONFIG_LV_CONF_SKIP=y
35+
CONFIG_LV_DEF_REFR_PERIOD=10
3536

3637
#CLIB default
3738
CONFIG_LV_USE_CLIB_MALLOC=y

examples/display_lvgl_benchmark/sdkconfig.bsp.esp-box-lite

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ CONFIG_LV_MEMCPY_MEMSET_STD=y
3131

3232
## LVGL9 ##
3333
CONFIG_LV_CONF_SKIP=y
34+
CONFIG_LV_DEF_REFR_PERIOD=10
3435

3536
#CLIB default
3637
CONFIG_LV_USE_CLIB_MALLOC=y

examples/display_lvgl_benchmark/sdkconfig.bsp.esp32_p4_function_ev_board

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CONFIG_LV_USE_PERF_MONITOR=y
3939

4040
## LVGL9 ##
4141
CONFIG_LV_CONF_SKIP=y
42+
CONFIG_LV_DEF_REFR_PERIOD=10
4243

4344
#CLIB default
4445
CONFIG_LV_USE_CLIB_MALLOC=y

examples/display_lvgl_benchmark/sdkconfig.bsp.esp32_s2_kaluga_kit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ CONFIG_LV_MEMCPY_MEMSET_STD=y
3131

3232
## LVGL9 ##
3333
CONFIG_LV_CONF_SKIP=y
34+
CONFIG_LV_DEF_REFR_PERIOD=10
3435

3536
#CLIB default
3637
CONFIG_LV_USE_CLIB_MALLOC=y

0 commit comments

Comments
 (0)