fix(draw): fix the default draw thread stack is too large (#5951)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
VIFEX
2024-04-09 03:31:19 +08:00
committed by GitHub
parent c96706da7e
commit 4d0c029827
6 changed files with 47 additions and 19 deletions

12
Kconfig
View File

@@ -183,6 +183,13 @@ menu "LVGL configuration"
it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks. it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks.
"Transformed layers" (if `transform_angle/zoom` are set) use larger buffers and can't be drawn in chunks. "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers and can't be drawn in chunks.
config LV_DRAW_THREAD_STACK_SIZE
int "Stack size of draw thread in bytes"
default 8192
depends on LV_USE_OS > 0
help
If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
config LV_USE_DRAW_SW config LV_USE_DRAW_SW
bool "Enable software rendering" bool "Enable software rendering"
default y default y
@@ -197,11 +204,6 @@ menu "LVGL configuration"
> 1 requires an operating system enabled in `LV_USE_OS` > 1 requires an operating system enabled in `LV_USE_OS`
> 1 means multiply threads will render the screen in parallel > 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 config LV_USE_DRAW_ARM2D_SYNC
bool "Enable Arm's 2D image processing library (Arm-2D) for all Cortex-M processors" bool "Enable Arm's 2D image processing library (Arm-2D) for all Cortex-M processors"
default n default n

View File

@@ -113,6 +113,11 @@
/*The target buffer size for simple layer chunks.*/ /*The target buffer size for simple layer chunks.*/
#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/ #define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/
/* The stack size of the drawing thread.
* NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
*/
#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/
#define LV_USE_DRAW_SW 1 #define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1 #if LV_USE_DRAW_SW == 1
/* Set the number of draw unit. /* Set the number of draw unit.
@@ -150,9 +155,6 @@
#endif #endif
#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. */ /* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
#define LV_USE_DRAW_VGLITE 0 #define LV_USE_DRAW_VGLITE 0

View File

@@ -197,6 +197,17 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#define LV_USE_THORVG (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL) #define LV_USE_THORVG (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL)
#endif #endif
#if LV_USE_OS
#if (LV_USE_FREETYPE || LV_USE_THORVG) && LV_DRAW_THREAD_STACK_SIZE < (32 * 1024)
#warning "Increase LV_DRAW_THREAD_STACK_SIZE to at least 32KB for FreeType or ThorVG."
#endif
#if defined(LV_DRAW_THREAD_STACKSIZE) && !defined(LV_DRAW_THREAD_STACK_SIZE)
#warning "LV_DRAW_THREAD_STACKSIZE was renamed to LV_DRAW_THREAD_STACK_SIZE. Please update lv_conf.h or run menuconfig again."
#define LV_DRAW_THREAD_STACK_SIZE LV_DRAW_THREAD_STACKSIZE
#endif
#endif
/*If running without lv_conf.h add typedefs with default value*/ /*If running without lv_conf.h add typedefs with default value*/
#ifdef LV_CONF_SKIP #ifdef LV_CONF_SKIP
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/ #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/

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; draw_sw_unit->base_unit.delete_cb = LV_USE_OS ? lv_draw_sw_delete : NULL;
#if LV_USE_OS #if LV_USE_OS
lv_thread_init(&draw_sw_unit->thread, LV_THREAD_PRIO_HIGH, render_thread_cb, LV_DRAW_THREAD_STACKSIZE, draw_sw_unit); lv_thread_init(&draw_sw_unit->thread, LV_THREAD_PRIO_HIGH, render_thread_cb, LV_DRAW_THREAD_STACK_SIZE, draw_sw_unit);
#endif #endif
} }

View File

@@ -305,6 +305,17 @@
#endif #endif
#endif #endif
/* The stack size of the drawing thread.
* NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
*/
#ifndef LV_DRAW_THREAD_STACK_SIZE
#ifdef CONFIG_LV_DRAW_THREAD_STACK_SIZE
#define LV_DRAW_THREAD_STACK_SIZE CONFIG_LV_DRAW_THREAD_STACK_SIZE
#else
#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/
#endif
#endif
#ifndef LV_USE_DRAW_SW #ifndef LV_USE_DRAW_SW
#ifdef _LV_KCONFIG_PRESENT #ifdef _LV_KCONFIG_PRESENT
#ifdef CONFIG_LV_USE_DRAW_SW #ifdef CONFIG_LV_USE_DRAW_SW
@@ -408,15 +419,6 @@
#endif #endif
#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. */ /* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */
#ifndef LV_USE_DRAW_VGLITE #ifndef LV_USE_DRAW_VGLITE
#ifdef CONFIG_LV_USE_DRAW_VGLITE #ifdef CONFIG_LV_USE_DRAW_VGLITE
@@ -3314,6 +3316,17 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#define LV_USE_THORVG (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL) #define LV_USE_THORVG (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL)
#endif #endif
#if LV_USE_OS
#if (LV_USE_FREETYPE || LV_USE_THORVG) && LV_DRAW_THREAD_STACK_SIZE < (32 * 1024)
#warning "Increase LV_DRAW_THREAD_STACK_SIZE to at least 32KB for FreeType or ThorVG."
#endif
#if defined(LV_DRAW_THREAD_STACKSIZE) && !defined(LV_DRAW_THREAD_STACK_SIZE)
#warning "LV_DRAW_THREAD_STACKSIZE was renamed to LV_DRAW_THREAD_STACK_SIZE. Please update lv_conf.h or run menuconfig again."
#define LV_DRAW_THREAD_STACK_SIZE LV_DRAW_THREAD_STACKSIZE
#endif
#endif
/*If running without lv_conf.h add typedefs with default value*/ /*If running without lv_conf.h add typedefs with default value*/
#ifdef LV_CONF_SKIP #ifdef LV_CONF_SKIP
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/ #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/

View File

@@ -1,6 +1,6 @@
#define LV_MEM_SIZE (32 * 1024 * 1024) #define LV_MEM_SIZE (32 * 1024 * 1024)
#define LV_DRAW_SW_SHADOW_CACHE_SIZE 8 #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_DRAW_THREAD_STACK_SIZE (64 * 1024) /*Increase stack size to 64KB in order to run ThorVG*/
#define LV_USE_LOG 1 #define LV_USE_LOG 1
#define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE #define LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
#define LV_LOG_PRINTF 1 #define LV_LOG_PRINTF 1