feat(draw): add draw thread stack size config option (#5910)

Signed-off-by: lijianjun <lijianjun@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
Co-authored-by: lijianjun <lijianjun@xiaomi.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
lion2tomato
2024-03-22 10:06:27 +08:00
committed by GitHub
parent f37aebf332
commit 21dd110e63
7 changed files with 24 additions and 3 deletions

View File

@@ -197,6 +197,11 @@ menu "LVGL configuration"
> 1 requires an operating system enabled in `LV_USE_OS`
> 1 means multiply threads will render the screen in parallel
config LV_DRAW_THREAD_STACKSIZE
int "stack size of draw thread in byte"
default 32768
depends on LV_USE_OS > 0
config LV_USE_DRAW_ARM2D_SYNC
bool "Enable Arm's 2D image processing library (Arm-2D) for all Cortex-M processors"
default n

View File

@@ -150,6 +150,9 @@
#endif
#endif
/* Set stack size of drawing thread. Unit is byte. If Thorvg is enabled, 128kB is required tested on simulator.*/
#define LV_DRAW_THREAD_STACKSIZE 32768
/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
#define LV_USE_DRAW_VGLITE 0

View File

@@ -143,7 +143,7 @@ void lv_draw_sw_init(void)
draw_sw_unit->base_unit.delete_cb = LV_USE_OS ? lv_draw_sw_delete : NULL;
#if LV_USE_OS
lv_thread_init(&draw_sw_unit->thread, LV_THREAD_PRIO_HIGH, render_thread_cb, 8 * 1024, draw_sw_unit);
lv_thread_init(&draw_sw_unit->thread, LV_THREAD_PRIO_HIGH, render_thread_cb, LV_DRAW_THREAD_STACKSIZE, draw_sw_unit);
#endif
}

View File

@@ -408,6 +408,15 @@
#endif
#endif
/* Set stack size of drawing thread. Unit is byte. If Thorvg is enabled, 128kB is required tested on simulator.*/
#ifndef LV_DRAW_THREAD_STACKSIZE
#ifdef CONFIG_LV_DRAW_THREAD_STACKSIZE
#define LV_DRAW_THREAD_STACKSIZE CONFIG_LV_DRAW_THREAD_STACKSIZE
#else
#define LV_DRAW_THREAD_STACKSIZE 32768
#endif
#endif
/* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
#ifndef LV_USE_DRAW_VGLITE
#ifdef CONFIG_LV_USE_DRAW_VGLITE

View File

@@ -42,10 +42,12 @@ lv_result_t lv_thread_init(lv_thread_t * thread, lv_thread_prio_t prio, void (*c
void * user_data)
{
LV_UNUSED(prio);
LV_UNUSED(stack_size);
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, stack_size);
thread->callback = callback;
thread->user_data = user_data;
pthread_create(&thread->thread, NULL, generic_callback, thread);
pthread_create(&thread->thread, &attr, generic_callback, thread);
return LV_RESULT_OK;
}

View File

@@ -340,6 +340,7 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
${LIBINPUT_LIBRARIES}
${JPEG_LIBRARIES}
m
pthread
${TEST_LIBS})
target_include_directories(${test_name} PUBLIC ${TEST_INCLUDE_DIRS})
target_compile_options(${test_name} PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})

View File

@@ -1,5 +1,6 @@
#define LV_MEM_SIZE (32 * 1024 * 1024)
#define LV_DRAW_SW_SHADOW_CACHE_SIZE 8
#define LV_DRAW_THREAD_STACKSIZE (128 * 1024) /*Increase stack size to 128kB in order to run Thorvg*/
#define LV_USE_LOG 1
#define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
#define LV_LOG_PRINTF 1