diff --git a/Kconfig b/Kconfig index 06aefd5f1b..993266bd49 100644 --- a/Kconfig +++ b/Kconfig @@ -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 diff --git a/lv_conf_template.h b/lv_conf_template.h index 6b43c21832..4bfc2e5f88 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -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 diff --git a/src/draw/sw/lv_draw_sw.c b/src/draw/sw/lv_draw_sw.c index a84ed7bf90..fc4025c250 100644 --- a/src/draw/sw/lv_draw_sw.c +++ b/src/draw/sw/lv_draw_sw.c @@ -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 } diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 1ba5be3571..d56747ea40 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -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 diff --git a/src/osal/lv_pthread.c b/src/osal/lv_pthread.c index 68676c9467..a2244220b1 100644 --- a/src/osal/lv_pthread.c +++ b/src/osal/lv_pthread.c @@ -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; } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0ede0b51ff..7c8c33cd2a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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}) diff --git a/tests/src/lv_test_conf_full.h b/tests/src/lv_test_conf_full.h index d3d872905f..16b8f11c42 100644 --- a/tests/src/lv_test_conf_full.h +++ b/tests/src/lv_test_conf_full.h @@ -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