modules: lvgl: allow usage of zephyr memory-region for mem / vdb
Allow selection of a custom section for memory-poll and / or VDB based on zephyr memory-regions. This takes advantages that zephyr,memory-region automatically have sections being created, hence allowing to easily indicate into which memory-region to store data. Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
This commit is contained in:
committed by
Johan Hedberg
parent
00a9905f83
commit
c2fe44ee98
@@ -52,6 +52,21 @@ config LV_Z_MEMORY_POOL_CUSTOM_SECTION
|
||||
memory pool to a custom location, such as tightly coupled or
|
||||
external memory.
|
||||
|
||||
config LV_Z_MEMORY_POOL_ZEPHYR_REGION
|
||||
bool "Place LVGL memory pool in a Zephyr memory-region"
|
||||
depends on LV_Z_MEM_POOL_SYS_HEAP
|
||||
depends on !LV_Z_MEMORY_POOL_CUSTOM_SECTION
|
||||
help
|
||||
Place LVGL memory pool in a section, automatically
|
||||
created from a 'zephyr,memory-region' compatible node,
|
||||
whose name is specified in LV_Z_MEMORY_POOL_ZEPHYR_REGION_NAME.
|
||||
|
||||
config LV_Z_MEMORY_POOL_ZEPHYR_REGION_NAME
|
||||
string "Name of the zephyr memory-region for memory pool"
|
||||
depends on LV_Z_MEMORY_POOL_ZEPHYR_REGION
|
||||
help
|
||||
Name of the Zephyr memory-region where LVGL memory pool is placed.
|
||||
|
||||
config LV_Z_VDB_SIZE
|
||||
int "Rendering buffer size"
|
||||
default 100 if LV_Z_FULL_REFRESH
|
||||
@@ -92,6 +107,21 @@ config LV_Z_VDB_CUSTOM_SECTION
|
||||
rendering buffers to a custom location, such as tightly coupled or
|
||||
external memory.
|
||||
|
||||
config LV_Z_VDB_ZEPHYR_REGION
|
||||
bool "Place LVGL rendering buffers in a Zephyr memory-region"
|
||||
depends on LV_Z_BUFFER_ALLOC_STATIC
|
||||
depends on !LV_Z_VDB_CUSTOM_SECTION
|
||||
help
|
||||
Place LVGL rendering buffers in a section, automatically
|
||||
created from a 'zephyr,memory-region' compatible node,
|
||||
whose name is specified in LV_Z_VDB_ZEPHYR_REGION_NAME.
|
||||
|
||||
config LV_Z_VDB_ZEPHYR_REGION_NAME
|
||||
string "Name of the Zephyr memory-region for rendering buffers"
|
||||
depends on LV_Z_VDB_ZEPHYR_REGION
|
||||
help
|
||||
Name of the Zephyr memory-region where LVGL rendering buffers are placed.
|
||||
|
||||
config LV_Z_MONOCHROME_CONVERSION_BUFFER
|
||||
bool "Use intermediate conversion buffer for monochrome displays"
|
||||
default y
|
||||
|
||||
@@ -78,22 +78,27 @@ static uint8_t *mono_vtile_buf_p[DT_ZEPHYR_DISPLAYS_COUNT] = {NULL};
|
||||
/* uint16_t * or uint32_t *, therefore buffer needs to be aligned accordingly to */
|
||||
/* prevent unaligned memory accesses. */
|
||||
|
||||
#if defined(CONFIG_LV_Z_VDB_CUSTOM_SECTION)
|
||||
#define LV_BUF_SECTION Z_GENERIC_SECTION(.lvgl_buf)
|
||||
#elif defined(CONFIG_LV_Z_VDB_ZEPHYR_REGION)
|
||||
#define LV_BUF_SECTION Z_GENERIC_SECTION(CONFIG_LV_Z_VDB_ZEPHYR_REGION_NAME)
|
||||
#else
|
||||
#define LV_BUF_SECTION
|
||||
#endif
|
||||
|
||||
/* clang-format off */
|
||||
#define LV_BUFFERS_DEFINE(n) \
|
||||
static DISPLAY_BUFFER_ALIGN(LV_DRAW_BUF_ALIGN) uint8_t buf0_##n[BUFFER_SIZE(n)] \
|
||||
IF_ENABLED(CONFIG_LV_Z_VDB_CUSTOM_SECTION, (Z_GENERIC_SECTION(.lvgl_buf))) \
|
||||
__aligned(CONFIG_LV_Z_VDB_ALIGN); \
|
||||
LV_BUF_SECTION __aligned(CONFIG_LV_Z_VDB_ALIGN); \
|
||||
\
|
||||
IF_ENABLED(CONFIG_LV_Z_DOUBLE_VDB, ( \
|
||||
static DISPLAY_BUFFER_ALIGN(LV_DRAW_BUF_ALIGN) uint8_t buf1_##n[BUFFER_SIZE(n)] \
|
||||
IF_ENABLED(CONFIG_LV_Z_VDB_CUSTOM_SECTION, (Z_GENERIC_SECTION(.lvgl_buf))) \
|
||||
__aligned(CONFIG_LV_Z_VDB_ALIGN); \
|
||||
LV_BUF_SECTION __aligned(CONFIG_LV_Z_VDB_ALIGN); \
|
||||
)) \
|
||||
\
|
||||
IF_ENABLED(ALLOC_MONOCHROME_CONV_BUFFER, ( \
|
||||
static uint8_t mono_vtile_buf_##n[BUFFER_SIZE(n)] \
|
||||
IF_ENABLED(CONFIG_LV_Z_VDB_CUSTOM_SECTION, (Z_GENERIC_SECTION(.lvgl_buf))) \
|
||||
__aligned(CONFIG_LV_Z_VDB_ALIGN); \
|
||||
LV_BUF_SECTION __aligned(CONFIG_LV_Z_VDB_ALIGN); \
|
||||
))
|
||||
|
||||
FOR_EACH(LV_BUFFERS_DEFINE, (), LV_DISPLAYS_IDX_LIST);
|
||||
|
||||
@@ -15,6 +15,9 @@ LOG_MODULE_DECLARE(lvgl, CONFIG_LV_Z_LOG_LEVEL);
|
||||
|
||||
#ifdef CONFIG_LV_Z_MEMORY_POOL_CUSTOM_SECTION
|
||||
#define HEAP_MEM_ATTRIBUTES Z_GENERIC_SECTION(.lvgl_heap) __aligned(8)
|
||||
#elif defined(CONFIG_LV_Z_MEMORY_POOL_ZEPHYR_REGION)
|
||||
#define HEAP_MEM_ATTRIBUTES Z_GENERIC_SECTION(CONFIG_LV_Z_MEMORY_POOL_ZEPHYR_REGION_NAME)
|
||||
__aligned(8)
|
||||
#else
|
||||
#define HEAP_MEM_ATTRIBUTES __aligned(8)
|
||||
#endif /* CONFIG_LV_Z_MEMORY_POOL_CUSTOM_SECTION */
|
||||
|
||||
Reference in New Issue
Block a user