Using lv_obj_set_style_opa_layered() with off-screen lv_label objects in LVGL v9 causes the LCD thread to freeze

Answers checklist.

  • I have read the documentation SiFli-SDK Programming Guide and the issue is not addressed there.
  • I have updated my SiFli-SDK branch (main or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

SiFli-SDK version.

v2.4.4-31-g3c762ea7

SiFli SoC revision.

SF32LB58

Operating System used.

macOS

Development Kit.

SF32LB58-DevKit-LCD MOD-A128R32N1

What is the expected behavior?

The behavior of lv_obj_set_style_opa_layered() should be as stable as lv_obj_set_style_opa()—it should not cause system freeze, even when the object is positioned outside the screen. It should not lead to thread deadlock.

What is the actual behavior?

The lcd_task thread stops running:

msh> ps
         pri  status      sp      top     stack size max used left tick  error
-------- ---  ------- ---------- ---------- ----------  ------  ---------- ---
KE_EVT3   10  suspend 0x20058b80 0x20058c7c 0x00000400    25%   0x00000014 000
KE_EVT0   25  ready   0x20058748 0x20058790 0x00000400    07%   0x00000014 000
KE_EVT2   12  suspend 0x200581a8 0x200582a4 0x00001000    13%   0x00000014 000
device_m  25  suspend 0x2004e288 0x2004e398 0x00000800    36%   0x00000013 000
mbox      11  close   0x20050098 0x20050164 0x00001000    21%   0x0000000a 000
tpread    10  suspend 0x20020610 0x2002071c 0x00000400    26%   0x0000000a 000
lcd_task  12  suspend 0x200201b8 0x2002031c 0x00000800    43%   0x00000001 000   <-------
tshell    20  ready   0x2004b958 0x2004bad8 0x00001000    20%   0x0000000a 000
thread     4  suspend 0x200468f0 0x20046a14 0x00001000    44%   0x00000010 000
thread     3  suspend 0x200457c8 0x200458e0 0x00002000    06%   0x00000010 000
tidle     31  ready   0x000276b8 0x00027710 0x00000200    19%   0x00000019 000
timer      4  suspend 0x20021618 0x2002171c 0x00001000    06%   0x00000009 000
main      21  ready   0x200426d8 0x20042958 0x00002000    31%   0x00000013 000

LVGL no longer calls the display driver’s flush function. The screen freezes completely. The serial port remains functional and can print commands, but the entire GUI is frozen and requires a RESET.

Steps to reproduce.

  • Create a label object completely outside the screen (e.g., negative y-coordinate or beyond screen height), or partially outside.
  • Use an LVGL animation (lv_anim_t) to animate opacity changes.
  • Inside the animation callback, call lv_obj_set_style_opa_layered().
  • The issue occurs whenever the object is positioned outside the visible screen area.

Tested: lv_label triggers this issue; a plain lv_obj (rectangle) does not.

Debug Logs.


More Information.

Reproduction code:

static void _set_opa_layered_cb(void *var, int32_t v)
{
    lv_obj_set_style_opa_layered((lv_obj_t *)var, (lv_opa_t)v, 0);
}
lv_obj_t *scr = lv_screen_active();

lv_obj_t *l = lv_label_create(scr);
lv_label_set_text(l, "Hello World");
lv_obj_set_pos(l, -50, 200);

// Tested: plain obj works fine
// lv_obj_t *rect = lv_obj_create(scr);
// lv_obj_set_size(rect, 100, 100);
// lv_obj_set_pos(rect, -50, 200);
// lv_obj_set_style_bg_color(rect, EOS_COLOR_RED, 0);
// lv_obj_set_style_bg_opa(rect, LV_OPA_100, 0);

lv_anim_t anim;
lv_anim_t *a = &anim;
lv_anim_init(a);
lv_anim_set_var(a, l);
lv_anim_set_values(a, LV_OPA_100, LV_OPA_20);
lv_anim_set_exec_cb(a, _set_opa_layered_cb);
lv_anim_set_path_cb(a, lv_anim_path_ease_in_out);
lv_anim_set_duration(a, 1000);
lv_anim_set_delay(a, 0);
lv_anim_start(a);

System state:

Assertion failed at function:assert_command, line number:460 ,(0)
Previous ISR enable 0
===================
Thread Info        
===================
         pri  status      sp      top     stack size max used left tick  error
-------- ---  ------- ---------- ---------- ----------  ------  ---------- ---
KE_EVT3   10  suspend 0x20058b80 0x20058c7c 0x00000400    25%   0x00000014 000
KE_EVT0   25  ready   0x20058748 0x20058790 0x00000400    07%   0x00000014 000
KE_EVT2   12  suspend 0x200581a8 0x200582a4 0x00001000    13%   0x00000014 000
device_m  25  suspend 0x2004e288 0x2004e398 0x00000800    36%   0x00000013 000
mbox      11  close   0x20050098 0x20050164 0x00001000    21%   0x0000000a 000
tpread    10  suspend 0x20020610 0x2002071c 0x00000400    26%   0x0000000a 000
lcd_task  12  suspend 0x200201b8 0x2002031c 0x00000800    43%   0x00000001 000
tshell    20  ready   0x2004b958 0x2004bad8 0x00001000    21%   0x00000004 000
thread     4  suspend 0x200468f0 0x20046a14 0x00001000    44%   0x00000010 000
thread     3  suspend 0x200457c8 0x200458e0 0x00002000    06%   0x00000010 000
tidle     31  ready   0x000276b8 0x00027710 0x00000200    19%   0x00000019 000
timer      4  suspend 0x20021618 0x2002171c 0x00001000    06%   0x00000009 000
main      21  ready   0x20042718 0x20042958 0x00002000    31%   0x0000000d 000
===================
Mailbox Info       
===================
        entry size suspend thread
------- ----  ---- --------------
ble_mb  0000  0008 0
===================
MessageQueue Info  
===================
         entry suspend thread
-------- ----  --------------
device_c 0000  1:device_m
drv_lcd  0000  1:lcd_task�
===================
Mutex Info         
===================
           owner  hold suspend thread
-------- -------- ---- --------------
ble_mute (null)   0000 0
tplck    (null)   0000 0
dhara    (null)   0000 0
fat0     (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    (null)   0000 0
mutex    main     0001 0
rtc      (null)   0000 0
ulog loc (null)   0000 0
fslock   (null)   0000 0
i2c_bus_ (null)   0000 0
i2c_bus_ (null)   0000 0
i2c_bus_ (null)   0000 0
i2c_bus_ (null)   0000 0
spi1     (null)   0000 0
===================
Semaphore Info     
===================
         v   suspend thread
-------- --- --------------
KE       000 1:KE_EVT3
KE       000 0
ke_mem_e 001 0
ke_mem_e 001 0
ke_mem_e 001 0
ke_mem_e 001 0
KE       000 1:KE_EVT2
sifli    000 0
btn      001 0
tp_ctrl  001 0
lv_lcd   001 0
lcd_msg  000 0
lcd_draw 000 0
drv_lcd  001 0
shrx     000 0
ft6146   000 1:tpread
sem      000 1:thread
epic     001 0
sem      000 1:thread
sem      044 0
psram_he 001 0
aes_drv  001 0
drv_eDma 001 0
nandlock 001 0
flash5   001 0
i2c4     000 0
i2c3     000 0
i2c2     000 0
i2c1     000 0
spi1     000 0
heap     001 0
===================
Memory Info     
===================
total memory: 1751812 used memory : 104376 maximum allocated memory: 108644
===================
MemoryHeap Info     
===================
          pool size  max used size available size
-------- ---------- ------------- --------------
psram_he 6291456    72            6291384
=====================
PSP: 0x0x2004b9fc, MSP: 0x0x20001fe0
=====================
 sp: 0x2004ba58
psr: 0x40000000
r00: 0x00000000
r01: 0x00001c1f
r02: 0x00012a23
r03: 0x30000000
r12: 0x1009465d
 lr: 0x1008413b
 pc: 0x1008413b
=====================
fatal error on thread: tshell

Related Links

I have already submitted this issue on GitHub: LVGL v9 中对屏幕外的 lv_label 对象使用 lv_obj_set_style_opa_layered() 动画会导致lcd线程卡死 · Issue #217 · OpenSiFli/SiFli-SDK · GitHub

Considering the issue I mentioned last month, LVGL9 causes system freeze under specific circumstances #205, this problem might be related to EPIC or to certain low-level image transformation engines within the SDK.

Please capture a more complete screenshot of the assertion location. Additionally, local testing using the attached code works normally and does not result in a crash.

@chao Hello, thank you for your reply.

The assertion was manually triggered by me using the serial port msh command. When the system hang occurs, no logs are printed, there is no useful information, and the assertion is not triggered either.

Regarding the bug involving creating text and setting transparency animation

I just tested the code snippet I provided using the LVGL_V9_EXAMPLES example code, and found that it indeed does not cause a hang. However, when placed into my own project, it does cause a hang.
Since this code snippet was extracted from my project, it may conflict with some other part of my project. I haven’t yet identified the root cause, but I will reply once I find it.

Regarding the issue of modifying text scale in a list causing a hang

The symptoms of these two issues are very similar — both result in lcd_task hanging, and both involve operations on text labels.

I just tested using the LVGL_V9_EXAMPLES project and confirmed that the main.c code mentioned in Issue#205 will definitely cause a hang. Please take a look at this issue first.

Below is the log:

Serial:c2,Chip:2,Package:0,Rev:1  Reason:00000000
NAND ID 0xc891c8
det bbm table with 1, 1, 2
detect result 2
V1 1 in block 992, V2 0 in block 994
Latest version 1
V1 1 in block 993, V2 0 in block 995
Latest version 1
v1 1 in blk 992, v2 1 in block 993
BBM MEM: ctx 200235b8, map1 200231a8, map2 200233b0 
sif_bbm_init done

 \ | /
- SiFli Corporation
 / | \     build on Dec 15 2025, 2.4.4 build 3c762ea7
 2020 - 2022 Copyright by SiFli team
mount /dev sucess
[D/USBD] No class register on usb device
[1406] I/drv.rtc main: PSCLR=0x80000100 DivAI=128 DivAF=0 B=256
[1431] I/drv.rtc main: RTC use LXT RTC_CR=00000000
[1451] I/drv.rtc main: Init RTC, wake = 0
[1615] I/drv.audprc main: init 00 ADC_PATH_CFG0 0x924
[1636] I/drv.audprc main: HAL_AUDPRC_Init res 0
[1656] I/drv.audcodec main: HAL_AUDCODEC_Init res 0
[1682] I/drv.epic main: drv_gpu opened.
call par CFG1(35bb)
fc 11, xtal 2000, pll 1982
call par CFG1(35bb)
fc 9, xtal 2000, pll 1982
[1859] I/TOUCH main: Regist touch screen driver, probe=0x1005c305 
[1894] I/drv.lcd main: [NONE] -> [OPENING]
[1911] I/drv.lcd lcd_task: open
[1923] I/drv.lcd lcd_task: HW open
[1937] I/drv.lcd lcd_task: Try registered LCD driver...
msh />
CO5300_ReadID 0x331100 
[4242] I/co5300 lcd_task: LCD module use CO5300 IC 

CO5300_ReadID 0x331100 
[10500] I/co5300 lcd_task: LCD module use CO5300 IC 

[10521] I/drv.lcd lcd_task: Found lcd co5300 id:331100h
[10542] I/drv.lcd lcd_task: HW open done.
[10558] I/drv.lcd lcd_task: [OPENING] -> [INITIALIZED]
[10578] I/drv.lcd lcd_task: open done.
sysmon: 0 FPS (refr_cnt: 0 | redraw_cnt: 0), refr 0ms (render 0ms | flush 0ms), CPU 0
[10735] I/drv.lcd_fb main: drv_lcd_fb_init
[10754] I/drv.lcd_fb main: drv_lcd_fb_init done.
[User]  (0.287, +287)    lv_touchscreen_create: touchscreen touch opening lv_touch.c:197
[10806] I/TOUCH main: Open
[10819] I/TOUCH tp_init: Find touch screen driver...
[10839] I/TOUCH tp_init: Probe 1005c305
[10855] I/TOUCH tp_init: touch screen found driver  0x20026528, ft6146
[10882] I/TOUCH main: Opened.
[User]  (0.291, +4)      lv_touchscreen_create: touchscreen touch open success lv_touch.c:217
[10929] I/LVGL main: [littlevgl2rtt] Welcome to the littlevgl2rtt lib.
[13003] I/drv.lcd lcd_task: Auto turn on display.
[13022] I/drv.lcd lcd_task: set brightness 50
[13040] I/drv.lcd lcd_task: display on
[13055] I/drv.lcd lcd_task: [INITIALIZED] -> [ON]
[13639] E/drv.ft6146 tp_init: ft6146 id_H=64
[13661] E/drv.ft6146 tp_init: ft6146 id_L=56
sysmon: 3 FPS (refr_cnt: 2 | redraw_cnt: 1), refr 14ms (render 9ms | flush 2ms), CPU 5
sysmon: 0 FPS (refr_cnt: 0 | redraw_cnt: 0), refr 0ms (render 0ms | flush 0ms), CPU 5
sysmon: 0 FPS (refr_cnt: 0 | redraw_cnt: 0), refr 0ms (render 0ms | flush 0ms), CPU 0
sysmon: 0 FPS (refr_cnt: 0 | redraw_cnt: 0), refr 0ms (render 0ms | flush 0ms), CPU 0
sysmon: 56 FPS (refr_cnt: 17 | redraw_cnt: 17), refr 15ms (render 10ms | flush 5ms), CPU 7
sysmon: 56 FPS (refr_cnt: 17 | redraw_cnt: 17), refr 15ms (render 10ms | flush 5ms), CPU 90
sysmon: 56 FPS (refr_cnt: 17 | redraw_cnt: 17), refr 15ms (render 9ms | flush 5ms), CPU 90
sysmon: 50 FPS (refr_cnt: 15 | redraw_cnt: 15), refr 15ms (render 10ms | flush 4ms), CPU 79
sysmon: 50 FPS (refr_cnt: 15 | redraw_cnt: 15), refr 15ms (render 9ms | flush 5ms), CPU 79
sysmon: 0 FPS (refr_cnt: 0 | redraw_cnt: 0), refr 0ms (render 0ms | flush 0ms), CPU 73
sysmon: 53 FPS (refr_cnt: 16 | redraw_cnt: 16), refr 15ms (render 9ms | flush 5ms), CPU 43
sysmon: 43 FPS (refr_cnt: 13 | redraw_cnt: 13), refr 15ms (render 10ms | flush 4ms), CPU 43
[137295] W/TOUCH tpread: touch buffer overwrite[2, 141 322] with [2, 188 145]

Below is the main.c code:

#include "rtthread.h"
#include "bf0_hal.h"
#include "drv_io.h"
#include "littlevgl2rtt.h"
#include "lv_examples.h"
#include "lvgl.h"
#include "lvgl_private.h"

static void _theme_apply_cb(lv_theme_t *th, lv_obj_t *obj)
{
    LV_UNUSED(th);
    if (lv_obj_check_type(obj, &lv_label_class))
    {
        lv_obj_set_style_transform_scale(obj, 200, 0);
    }
}

/**
 * @brief  Main program
 * @param  None
 * @retval 0 if success, otherwise failure number
 */
int main(void)
{
    rt_err_t ret = RT_EOK;
    rt_uint32_t ms;

    /* init littlevGL */
    ret = littlevgl2rtt_init("lcd");
    if (ret != RT_EOK)
    {
        return ret;
    }

    /*Call examples here*/
    // lv_example_scroll_1();
    // lv_example_tiny_ttf_1();
    // lv_example_file_explorer_1();
    // lv_example_tjpgd_1();

    lv_theme_t *th_act = lv_theme_default_init(lv_display_get_default(),
                                               lv_color_hex(0xFF0000),
                                               lv_color_hex(0x00FF00),
                                               true,
                                               &lv_font_montserrat_28);

    static lv_theme_t th_new;
    th_new = *th_act;

    lv_theme_set_parent(&th_new, th_act);
    lv_theme_set_apply_cb(&th_new, _theme_apply_cb);
    lv_display_set_theme(lv_display_get_default(), &th_new);

    lv_obj_t *list = lv_list_create(lv_screen_active());
    lv_obj_t *btn;
    for (int i = 0; i < 10; i++)
    {
        btn = lv_list_add_button(list, NULL, "Hello");
        lv_obj_set_style_margin_ver(btn, 50, 0);    // Set larger vertical margin so lv_list can scroll
    }

    while (1)
    {
        ms = lv_task_handler();
        rt_thread_mdelay(ms);
    }
    return RT_EOK;
}

@chao
Hello, after my testing, I found that triggering lv_obj_set_style_opa_layered() to cause a freeze requires setting the text font, and only specific fonts will lead to the freeze. Below is the reproduction code main.c:

#include "rtthread.h"
#include "bf0_hal.h"
#include "drv_io.h"
#include "littlevgl2rtt.h"
#include "lv_examples.h"
#include "lvgl.h"
#include "lvgl_private.h"

lv_obj_t *l;
int i = 0;
lv_font_t *font[21] = {
    &lv_font_montserrat_8,
    &lv_font_montserrat_10,
    &lv_font_montserrat_12,
    &lv_font_montserrat_14,
    &lv_font_montserrat_16,
    &lv_font_montserrat_18,
    &lv_font_montserrat_20,
    &lv_font_montserrat_22,
    &lv_font_montserrat_24,
    &lv_font_montserrat_26,
    &lv_font_montserrat_28,
    &lv_font_montserrat_30,
    &lv_font_montserrat_32,
    &lv_font_montserrat_34,
    &lv_font_montserrat_36,
    &lv_font_montserrat_38,
    &lv_font_montserrat_40,
    &lv_font_montserrat_42,
    &lv_font_montserrat_44,
    &lv_font_montserrat_46,
    &lv_font_montserrat_48};

static void _set_opa_layered_cb(void *var, int32_t v)
{
    lv_obj_set_style_opa_layered((lv_obj_t *)var, (lv_opa_t)v, 0);
}

static void _btn_switch_font_cb(lv_event_t *e)
{
    lv_obj_set_style_text_font(l, font[i], 0);
    lv_label_set_text_fmt(l, "Hello, font index %d", i);
    lv_anim_t anim;
    lv_anim_t *a = &anim;
    lv_anim_init(a);
    lv_anim_set_var(a, l);
    lv_anim_set_values(a, LV_OPA_100, LV_OPA_20);
    lv_anim_set_exec_cb(a, _set_opa_layered_cb);
    lv_anim_set_path_cb(a, lv_anim_path_ease_in_out);
    lv_anim_set_duration(a, 1000);
    lv_anim_set_delay(a, 0);
    lv_anim_start(a);
    i++;
}

static void _btn_skip_font_cb(lv_event_t *e)
{
    if(i==8)i++;
    lv_obj_set_style_text_font(l, font[i], 0);
    lv_label_set_text_fmt(l, "Hello, font index %d", i);
    i++;
}

/**
 * @brief  Main program
 * @param  None
 * @retval 0 if success, otherwise failure number
 */
int main(void)
{
    rt_err_t ret = RT_EOK;
    rt_uint32_t ms;

    /* init littlevGL */
    ret = littlevgl2rtt_init("lcd");
    if (ret != RT_EOK)
    {
        return ret;
    }

    /*Call examples here*/
    // lv_example_scroll_1();
    // lv_example_tiny_ttf_1();
    // lv_example_file_explorer_1();
    // lv_example_tjpgd_1();

    lv_obj_t *scr = lv_screen_active();

    l = lv_label_create(scr);
    lv_label_set_text(l, "Hello World");

    lv_obj_set_pos(l, -50, 100);

    lv_obj_t *btn = lv_button_create(scr);
    lv_obj_set_size(btn, 100, 100);
    lv_obj_center(btn);
    lv_obj_add_event_cb(btn, _btn_switch_font_cb, LV_EVENT_CLICKED, NULL);

    btn = lv_button_create(scr);
    lv_obj_set_size(btn, 100, 100);
    lv_obj_align(btn,LV_ALIGN_BOTTOM_MID,0,0);
    lv_obj_add_event_cb(btn, _btn_skip_font_cb, LV_EVENT_CLICKED, NULL);

    while (1)
    {
        ms = lv_task_handler();
        rt_thread_mdelay(ms);
    }
    return RT_EOK;
}

This code has been tested in the example project LVGL_V9_EXAMPLES and can reproduce the freeze issue.

After testing, I found that the system freezes immediately when i = 8, 12, 15, 16, 18, 20, 21, and freezes after the animation completes when i = 17, 19.
Additionally, larger fonts are more likely to cause freezes.

Attachment:

lvgl_v9_examples.zip (6.5 MB)

@chao Has this issue been resolved?

Sorry for the delay in addressing this issue due to other priorities. I’ve verified that it can be reproduced on the local emulator, and I’ll keep you updated on any progress.

1 Like

main.c (2.7 KB). The issue is a bug in LVGL itself, which occurs when creating a separate layer that does not perform any rendering operations. When this layer is stacked onto the parent layer, its state remains in WAIT indefinitely, preventing task dispatching and blocking all subsequent tasks. The specific fix applied is based on Revert "perf(draw): skip empty draw tasks (#6720)" (#6758) · lvgl/lvgl@2c021b6 · GitHub.

1 Like

The issue has been resolved, thank you for your help!