From 50509c34cc0ffb8323c415dc8723deb0de0e60af Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Mon, 18 Nov 2024 16:38:30 +0100 Subject: [PATCH] lvgl: Flush thread can have preemptive priority The LVGL flush thread was hard-coded to be cooperative. For long-running actions like data transfer to the display, this is problematic as it might block high-frequency actions like USB or input events. Hence, make it configurable to be preemptive, and rename it to match the similar Kconfig values like CONFIG_SDL_THREAD_PRIORITY. Signed-off-by: Martin Stumpf --- doc/releases/migration-guide-4.1.rst | 4 ++++ modules/lvgl/Kconfig | 6 +++--- modules/lvgl/lvgl_display.c | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/releases/migration-guide-4.1.rst b/doc/releases/migration-guide-4.1.rst index 04eabfdcd34..6fc151701a2 100644 --- a/doc/releases/migration-guide-4.1.rst +++ b/doc/releases/migration-guide-4.1.rst @@ -36,6 +36,10 @@ Trusted Firmware-M LVGL ==== +* The config option :kconfig:option:`CONFIG_LV_Z_FLUSH_THREAD_PRIO` is now called + :kconfig:option:`CONFIG_LV_Z_FLUSH_THREAD_PRIORITY` and its value is now interpreted as an + absolute priority instead of a cooperative one. + Device Drivers and Devicetree ***************************** diff --git a/modules/lvgl/Kconfig b/modules/lvgl/Kconfig index 932df9e55d9..5345e2a7d58 100644 --- a/modules/lvgl/Kconfig +++ b/modules/lvgl/Kconfig @@ -103,11 +103,11 @@ config LV_Z_FLUSH_THREAD_STACK_SIZE help Stack size for LVGL flush thread, which will call display_write -config LV_Z_FLUSH_THREAD_PRIO +config LV_Z_FLUSH_THREAD_PRIORITY int "LVGL flush thread priority" - default 0 + default -1 help - Cooperative priority of LVGL flush thread. + Priority of LVGL flush thread. endif # LV_Z_FLUSH_THREAD diff --git a/modules/lvgl/lvgl_display.c b/modules/lvgl/lvgl_display.c index 39f3da1f795..12f84725008 100644 --- a/modules/lvgl/lvgl_display.c +++ b/modules/lvgl/lvgl_display.c @@ -34,9 +34,8 @@ void lvgl_flush_thread_entry(void *arg1, void *arg2, void *arg3) } } -K_THREAD_DEFINE(lvgl_flush_thread, CONFIG_LV_Z_FLUSH_THREAD_STACK_SIZE, - lvgl_flush_thread_entry, NULL, NULL, NULL, - K_PRIO_COOP(CONFIG_LV_Z_FLUSH_THREAD_PRIO), 0, 0); +K_THREAD_DEFINE(lvgl_flush_thread, CONFIG_LV_Z_FLUSH_THREAD_STACK_SIZE, lvgl_flush_thread_entry, + NULL, NULL, NULL, CONFIG_LV_Z_FLUSH_THREAD_PRIORITY, 0, 0); void lvgl_wait_cb(lv_disp_drv_t *disp_drv)