MCU: NXP MIMXRT1176DVMAA, with a MIPI 480x640 screen
LVGL version:8.3.2
It seems that MIPI screen doesn’t support partial refresh mode.The cpu usage is 99% even there are only some simple objects(two buttons,one label) on the screen.
Then I found the most time-consuming code is the function refr_area_part
:
refr_invalid_areas
refr_area
refr_area_part(full_refresh == 1 branch)
refr_area_part
{
......
else {
/*Refresh the previous screen if any*/
if(disp_refr->prev_scr) {
if(top_prev_scr == NULL) top_prev_scr = disp_refr->prev_scr;
refr_obj_and_children(draw_ctx, top_prev_scr); /* not executed */
}
if(top_act_scr == NULL) top_act_scr = disp_refr->act_scr;
/* take up to 600ms! */
refr_obj_and_children(draw_ctx, top_act_scr);
}
/*Also refresh top and sys layer unconditionally*/
/* take up to 100ms! */
refr_obj_and_children(draw_ctx, lv_disp_get_layer_top(disp_refr));
refr_obj_and_children(draw_ctx, lv_disp_get_layer_sys(disp_refr));
draw_buf_flush(disp_refr);
}
But I’ve no idea to optimize this code.Then I’ve set every relevant param(such as LV_MEM_SIZE
,LV_MEM_BUF_MAX_NUM
,LV_LAYER_SIMPLE_BUF_SIZE
,LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE
…) as big as possible,but doesn’t work.
Finally,the CPU usage decrease to 50% if I set the GCC optimized flag to -O3(still too big?only 8 imagebuttons and labels).
Now I wan’t to show the camera buffer from MIPI CSI to a canvas,and the cpu usage reachs to 99% again.The display is very sluggish.
Do you have any suggestions to optimize the cpu usage further?
Thanks.