mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
feat(refr): improve performance measurement (#7430)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
c1b32017d4
commit
99a785cdc6
4
Kconfig
4
Kconfig
@ -1522,6 +1522,10 @@ menu "LVGL configuration"
|
||||
bool "Enable cache profiler"
|
||||
default y
|
||||
|
||||
config LV_PROFILER_EVENT
|
||||
bool "Enable event profiler"
|
||||
default y
|
||||
|
||||
endif # LV_USE_PROFILER
|
||||
|
||||
config LV_USE_MONKEY
|
||||
|
@ -1025,6 +1025,9 @@
|
||||
|
||||
/*Enable cache profiler*/
|
||||
#define LV_PROFILER_CACHE 1
|
||||
|
||||
/*Enable event profiler*/
|
||||
#define LV_PROFILER_EVENT 1
|
||||
#endif
|
||||
|
||||
/** 1: Enable Monkey test */
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
draw_dsc->base.obj = obj;
|
||||
draw_dsc->base.part = part;
|
||||
|
||||
@ -52,6 +53,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_
|
||||
draw_dsc->border_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->outline_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->shadow_opa = LV_OPA_TRANSP;
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -142,21 +144,30 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_
|
||||
draw_dsc->shadow_opa = LV_OPA_MIX2(draw_dsc->shadow_opa, opa);
|
||||
draw_dsc->outline_opa = LV_OPA_MIX2(draw_dsc->outline_opa, opa);
|
||||
}
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
draw_dsc->base.obj = obj;
|
||||
draw_dsc->base.part = part;
|
||||
|
||||
draw_dsc->opa = lv_obj_get_style_text_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = LV_OPA_MIX2(draw_dsc->opa, opa);
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
|
||||
@ -171,21 +182,30 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_ds
|
||||
#endif
|
||||
|
||||
draw_dsc->align = lv_obj_get_style_text_align(obj, part);
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
draw_dsc->base.obj = obj;
|
||||
draw_dsc->base.part = part;
|
||||
|
||||
draw_dsc->opa = lv_obj_get_style_image_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = LV_OPA_MIX2(draw_dsc->opa, opa);
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
draw_dsc->rotation = 0;
|
||||
draw_dsc->scale_x = LV_SCALE_NONE;
|
||||
@ -197,24 +217,36 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_ds
|
||||
draw_dsc->recolor = lv_obj_get_style_image_recolor_filtered(obj, part);
|
||||
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
draw_dsc->base.obj = obj;
|
||||
draw_dsc->base.part = part;
|
||||
|
||||
draw_dsc->opa = lv_obj_get_style_line_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = LV_OPA_MIX2(draw_dsc->opa, opa);
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
draw_dsc->width = lv_obj_get_style_line_width(obj, part);
|
||||
if(draw_dsc->width == 0) return;
|
||||
if(draw_dsc->width == 0) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_line_color_filtered(obj, part);
|
||||
|
||||
@ -227,33 +259,46 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_
|
||||
draw_dsc->round_end = draw_dsc->round_start;
|
||||
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
draw_dsc->base.obj = obj;
|
||||
draw_dsc->base.part = part;
|
||||
|
||||
draw_dsc->width = lv_obj_get_style_arc_width(obj, part);
|
||||
if(draw_dsc->width == 0) return;
|
||||
if(draw_dsc->width == 0) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
draw_dsc->opa = lv_obj_get_style_arc_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = LV_OPA_MIX2(draw_dsc->opa, opa);
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_arc_color_filtered(obj, part);
|
||||
draw_dsc->img_src = lv_obj_get_style_arc_image_src(obj, part);
|
||||
|
||||
draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
int32_t s = 0;
|
||||
|
||||
int32_t sh_width = lv_obj_get_style_shadow_width(obj, part);
|
||||
@ -283,11 +328,13 @@ int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part)
|
||||
int32_t wh = LV_MAX(w, h);
|
||||
if(wh > 0) s += wh;
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
return s;
|
||||
}
|
||||
|
||||
void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
int32_t s_old = lv_obj_get_ext_draw_size(obj);
|
||||
@ -306,6 +353,7 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
if(s_new != s_old) lv_obj_invalidate(obj);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
int32_t lv_obj_get_ext_draw_size(const lv_obj_t * obj)
|
||||
|
@ -86,7 +86,9 @@ lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
|
||||
/*Call the actual event callback*/
|
||||
e->user_data = NULL;
|
||||
LV_PROFILER_EVENT_BEGIN_TAG(lv_event_get_code_name(e->code));
|
||||
base->event_cb(base, e);
|
||||
LV_PROFILER_EVENT_END_TAG(lv_event_get_code_name(e->code));
|
||||
|
||||
lv_result_t res = LV_RESULT_OK;
|
||||
/*Stop if the object is deleted*/
|
||||
|
@ -584,9 +584,12 @@ lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_
|
||||
|
||||
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
|
||||
{
|
||||
|
||||
LV_PROFILER_STYLE_BEGIN;
|
||||
lv_opa_t opa_obj = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_obj <= LV_OPA_MIN) {
|
||||
LV_PROFILER_STYLE_END;
|
||||
return LV_OPA_TRANSP;
|
||||
}
|
||||
|
||||
lv_opa_t opa_final = LV_OPA_COVER;
|
||||
if(opa_obj < LV_OPA_MAX) {
|
||||
@ -602,7 +605,10 @@ lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
|
||||
|
||||
while(obj) {
|
||||
opa_obj = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_obj <= LV_OPA_MIN) {
|
||||
LV_PROFILER_STYLE_END;
|
||||
return LV_OPA_TRANSP;
|
||||
}
|
||||
if(opa_obj < LV_OPA_MAX) {
|
||||
opa_final = LV_OPA_MIX2(opa_final, opa_obj);
|
||||
}
|
||||
@ -610,8 +616,17 @@ lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
if(opa_final <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_final >= LV_OPA_MAX) return LV_OPA_COVER;
|
||||
if(opa_final <= LV_OPA_MIN) {
|
||||
LV_PROFILER_STYLE_END;
|
||||
return LV_OPA_TRANSP;
|
||||
}
|
||||
|
||||
if(opa_final >= LV_OPA_MAX) {
|
||||
LV_PROFILER_STYLE_END;
|
||||
return LV_OPA_COVER;
|
||||
}
|
||||
|
||||
LV_PROFILER_STYLE_END;
|
||||
return opa_final;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ void lv_refr_now(lv_display_t * disp)
|
||||
|
||||
void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
|
||||
{
|
||||
LV_PROFILER_REFR_BEGIN;
|
||||
lv_area_t clip_area_ori = layer->_clip_area;
|
||||
lv_area_t clip_coords_for_obj;
|
||||
|
||||
@ -108,7 +109,10 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
|
||||
int32_t ext_draw_size = lv_obj_get_ext_draw_size(obj);
|
||||
lv_area_increase(&obj_coords_ext, ext_draw_size, ext_draw_size);
|
||||
|
||||
if(!lv_area_intersect(&clip_coords_for_obj, &clip_area_ori, &obj_coords_ext)) return;
|
||||
if(!lv_area_intersect(&clip_coords_for_obj, &clip_area_ori, &obj_coords_ext)) {
|
||||
LV_PROFILER_REFR_END;
|
||||
return;
|
||||
}
|
||||
/*If the object is visible on the current clip area*/
|
||||
layer->_clip_area = clip_coords_for_obj;
|
||||
|
||||
@ -252,6 +256,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
|
||||
}
|
||||
|
||||
layer->_clip_area = clip_area_ori;
|
||||
LV_PROFILER_REFR_END;
|
||||
}
|
||||
|
||||
void lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
|
||||
@ -1023,15 +1028,18 @@ static bool obj_get_matrix(lv_obj_t * obj, lv_matrix_t * matrix)
|
||||
|
||||
static void refr_obj_matrix(lv_layer_t * layer, lv_obj_t * obj)
|
||||
{
|
||||
LV_PROFILER_REFR_BEGIN;
|
||||
lv_matrix_t obj_matrix;
|
||||
if(!obj_get_matrix(obj, &obj_matrix)) {
|
||||
/* NOT draw if obj matrix is not available */
|
||||
LV_PROFILER_REFR_END;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_matrix_t matrix_inv;
|
||||
if(!lv_matrix_inverse(&matrix_inv, &obj_matrix)) {
|
||||
/* NOT draw if matrix is not invertible */
|
||||
LV_PROFILER_REFR_END;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1060,6 +1068,7 @@ static void refr_obj_matrix(lv_layer_t * layer, lv_obj_t * obj)
|
||||
layer->matrix = ori_matrix;
|
||||
/* restore clip area */
|
||||
layer->_clip_area = clip_area_ori;
|
||||
LV_PROFILER_REFR_END;
|
||||
}
|
||||
|
||||
static bool refr_check_obj_clip_overflow(lv_layer_t * layer, lv_obj_t * obj)
|
||||
|
@ -139,7 +139,13 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t)
|
||||
t->preferred_draw_unit_id = 0;
|
||||
lv_draw_unit_t * u = info->unit_head;
|
||||
while(u) {
|
||||
if(u->evaluate_cb) u->evaluate_cb(u, t);
|
||||
if(u->evaluate_cb) {
|
||||
LV_PROFILER_DRAW_BEGIN_TAG("evaluate_cb");
|
||||
LV_PROFILER_DRAW_BEGIN_TAG(u->name);
|
||||
u->evaluate_cb(u, t);
|
||||
LV_PROFILER_DRAW_END_TAG(u->name);
|
||||
LV_PROFILER_DRAW_END_TAG("evaluate_cb");
|
||||
}
|
||||
u = u->next;
|
||||
}
|
||||
if(t->preferred_draw_unit_id == LV_DRAW_UNIT_NONE) {
|
||||
@ -156,7 +162,13 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t)
|
||||
t->preferred_draw_unit_id = 0;
|
||||
lv_draw_unit_t * u = info->unit_head;
|
||||
while(u) {
|
||||
if(u->evaluate_cb) u->evaluate_cb(u, t);
|
||||
if(u->evaluate_cb) {
|
||||
LV_PROFILER_DRAW_BEGIN_TAG("evaluate_cb");
|
||||
LV_PROFILER_DRAW_BEGIN_TAG(u->name);
|
||||
u->evaluate_cb(u, t);
|
||||
LV_PROFILER_DRAW_END_TAG(u->name);
|
||||
LV_PROFILER_DRAW_END_TAG("evaluate_cb");
|
||||
}
|
||||
u = u->next;
|
||||
}
|
||||
}
|
||||
@ -166,12 +178,19 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t)
|
||||
void lv_draw_wait_for_finish(void)
|
||||
{
|
||||
#if LV_USE_OS
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
lv_draw_unit_t * u = _draw_info.unit_head;
|
||||
while(u) {
|
||||
if(u->wait_for_finish_cb)
|
||||
if(u->wait_for_finish_cb) {
|
||||
LV_PROFILER_DRAW_BEGIN_TAG("wait_for_finish_cb");
|
||||
LV_PROFILER_DRAW_BEGIN_TAG(u->name);
|
||||
u->wait_for_finish_cb(u);
|
||||
LV_PROFILER_DRAW_END_TAG(u->name);
|
||||
LV_PROFILER_DRAW_END_TAG("wait_for_finish_cb");
|
||||
}
|
||||
u = u->next;
|
||||
}
|
||||
LV_PROFILER_DRAW_END;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -242,7 +261,11 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
|
||||
/*Let all draw units to pick draw tasks*/
|
||||
lv_draw_unit_t * u = _draw_info.unit_head;
|
||||
while(u) {
|
||||
LV_PROFILER_DRAW_BEGIN_TAG("dispatch_cb");
|
||||
LV_PROFILER_DRAW_BEGIN_TAG(u->name);
|
||||
int32_t taken_cnt = u->dispatch_cb(u, layer);
|
||||
LV_PROFILER_DRAW_END_TAG(u->name);
|
||||
LV_PROFILER_DRAW_END_TAG("dispatch_cb");
|
||||
if(taken_cnt != LV_DRAW_UNIT_IDLE) task_dispatched = true;
|
||||
u = u->next;
|
||||
}
|
||||
@ -254,21 +277,25 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer)
|
||||
|
||||
void lv_draw_dispatch_wait_for_request(void)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
#if LV_USE_OS
|
||||
lv_thread_sync_wait(&_draw_info.sync);
|
||||
#else
|
||||
while(!_draw_info.dispatch_req);
|
||||
_draw_info.dispatch_req = 0;
|
||||
#endif
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_draw_dispatch_request(void)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
#if LV_USE_OS
|
||||
lv_thread_sync_signal(&_draw_info.sync);
|
||||
#else
|
||||
_draw_info.dispatch_req = 1;
|
||||
#endif
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
uint32_t lv_draw_get_unit_count(void)
|
||||
@ -409,8 +436,10 @@ void lv_draw_layer_init(lv_layer_t * layer, lv_layer_t * parent_layer, lv_color_
|
||||
|
||||
void * lv_draw_layer_alloc_buf(lv_layer_t * layer)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
/*If the buffer of the layer is already allocated return it*/
|
||||
if(layer->draw_buf != NULL) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return layer->draw_buf->data;
|
||||
}
|
||||
|
||||
@ -423,6 +452,7 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer)
|
||||
|
||||
if(layer->draw_buf == NULL) {
|
||||
LV_LOG_WARN("Allocating layer buffer failed. Try later");
|
||||
LV_PROFILER_DRAW_END;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -433,6 +463,7 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer)
|
||||
lv_draw_buf_clear(layer->draw_buf, NULL);
|
||||
}
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
return layer->draw_buf->data;
|
||||
}
|
||||
|
||||
@ -494,6 +525,7 @@ static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check)
|
||||
*/
|
||||
static void lv_cleanup_task(lv_draw_task_t * t, lv_display_t * disp)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
/*If it was layer drawing free the layer too*/
|
||||
if(t->type == LV_DRAW_TASK_TYPE_LAYER) {
|
||||
lv_draw_image_dsc_t * draw_image_dsc = t->draw_dsc;
|
||||
@ -520,7 +552,11 @@ static void lv_cleanup_task(lv_draw_task_t * t, lv_display_t * disp)
|
||||
l2 = l2->next;
|
||||
}
|
||||
|
||||
if(disp->layer_deinit) disp->layer_deinit(disp, layer_drawn);
|
||||
if(disp->layer_deinit) {
|
||||
LV_PROFILER_DRAW_BEGIN_TAG("layer_deinit");
|
||||
disp->layer_deinit(disp, layer_drawn);
|
||||
LV_PROFILER_DRAW_END_TAG("layer_deinit");
|
||||
}
|
||||
lv_free(layer_drawn);
|
||||
}
|
||||
}
|
||||
@ -532,5 +568,5 @@ static void lv_cleanup_task(lv_draw_task_t * t, lv_display_t * disp)
|
||||
|
||||
lv_free(t->draw_dsc);
|
||||
lv_free(t);
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
@ -126,6 +126,8 @@ void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_
|
||||
return;
|
||||
}
|
||||
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
lv_area_t full;
|
||||
if(area == NULL) {
|
||||
draw_buf_get_full_area(draw_buf, &full);
|
||||
@ -133,6 +135,7 @@ void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_
|
||||
}
|
||||
|
||||
handlers->invalidate_cache_cb(draw_buf, area);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area)
|
||||
@ -145,6 +148,8 @@ void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * a
|
||||
return;
|
||||
}
|
||||
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
lv_area_t full;
|
||||
if(area == NULL) {
|
||||
draw_buf_get_full_area(draw_buf, &full);
|
||||
@ -152,11 +157,13 @@ void lv_draw_buf_flush_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * a
|
||||
}
|
||||
|
||||
handlers->flush_cache_cb(draw_buf, area);
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a)
|
||||
{
|
||||
LV_ASSERT_NULL(draw_buf);
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
const lv_image_header_t * header = &draw_buf->header;
|
||||
uint32_t stride = header->stride;
|
||||
@ -164,6 +171,7 @@ void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a)
|
||||
if(a == NULL) {
|
||||
uint8_t * buf = lv_draw_buf_goto_xy(draw_buf, 0, 0);
|
||||
lv_memzero(buf, header->h * stride);
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -174,9 +182,20 @@ void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a)
|
||||
a_draw_buf.y2 = draw_buf->header.h - 1;
|
||||
|
||||
lv_area_t a_clipped;
|
||||
if(!lv_area_intersect(&a_clipped, a, &a_draw_buf)) return;
|
||||
if(lv_area_get_width(&a_clipped) <= 0) return;
|
||||
if(lv_area_get_height(&a_clipped) <= 0) return;
|
||||
if(!lv_area_intersect(&a_clipped, a, &a_draw_buf)) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
if(lv_area_get_width(&a_clipped) <= 0) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
if(lv_area_get_height(&a_clipped) <= 0) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t * buf = lv_draw_buf_goto_xy(draw_buf, a_clipped.x1, a_clipped.y1);
|
||||
uint8_t bpp = lv_color_format_get_bpp(header->cf);
|
||||
@ -186,11 +205,13 @@ void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a)
|
||||
lv_memzero(buf, line_length);
|
||||
buf += stride;
|
||||
}
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
|
||||
const lv_draw_buf_t * src, const lv_area_t * src_area)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
uint8_t * dest_bufc;
|
||||
uint8_t * src_bufc;
|
||||
int32_t line_width;
|
||||
@ -213,6 +234,7 @@ void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
|
||||
if((src_area == NULL && line_width != src->header.w) || \
|
||||
(src_area != NULL && line_width != lv_area_get_width(src_area))) {
|
||||
LV_ASSERT_MSG(0, "Source and destination areas have different width");
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -241,6 +263,7 @@ void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
|
||||
dest_bufc += dest_stride;
|
||||
src_bufc += src_stride;
|
||||
}
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
lv_result_t lv_draw_buf_init(lv_draw_buf_t * draw_buf, uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride,
|
||||
@ -283,9 +306,13 @@ lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf,
|
||||
lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h,
|
||||
lv_color_format_t cf, uint32_t stride)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
lv_draw_buf_t * draw_buf = lv_malloc_zeroed(sizeof(lv_draw_buf_t));
|
||||
LV_ASSERT_MALLOC(draw_buf);
|
||||
if(draw_buf == NULL) return NULL;
|
||||
if(draw_buf == NULL) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return NULL;
|
||||
}
|
||||
if(stride == 0) stride = lv_draw_buf_width_to_stride(w, cf);
|
||||
|
||||
uint32_t size = _calculate_draw_buf_size(w, h, cf, stride);
|
||||
@ -296,6 +323,7 @@ lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, u
|
||||
LV_LOG_WARN("No memory: %"LV_PRIu32"x%"LV_PRIu32", cf: %d, stride: %"LV_PRIu32", %"LV_PRIu32"Byte, ",
|
||||
w, h, cf, stride, size);
|
||||
lv_free(draw_buf);
|
||||
LV_PROFILER_DRAW_END;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -309,6 +337,7 @@ lv_draw_buf_t * lv_draw_buf_create_ex(const lv_draw_buf_handlers_t * handlers, u
|
||||
draw_buf->unaligned_data = buf;
|
||||
draw_buf->data_size = size;
|
||||
draw_buf->handlers = handlers;
|
||||
LV_PROFILER_DRAW_END;
|
||||
return draw_buf;
|
||||
}
|
||||
|
||||
@ -319,9 +348,13 @@ lv_draw_buf_t * lv_draw_buf_dup(const lv_draw_buf_t * draw_buf)
|
||||
|
||||
lv_draw_buf_t * lv_draw_buf_dup_ex(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
const lv_image_header_t * header = &draw_buf->header;
|
||||
lv_draw_buf_t * new_buf = lv_draw_buf_create_ex(handlers, header->w, header->h, header->cf, header->stride);
|
||||
if(new_buf == NULL) return NULL;
|
||||
if(new_buf == NULL) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_buf->header.flags = draw_buf->header.flags;
|
||||
new_buf->header.flags |= LV_IMAGE_FLAGS_MODIFIABLE | LV_IMAGE_FLAGS_ALLOCATED;
|
||||
@ -331,6 +364,7 @@ lv_draw_buf_t * lv_draw_buf_dup_ex(const lv_draw_buf_handlers_t * handlers, cons
|
||||
|
||||
/*Copy image data*/
|
||||
lv_memcpy(new_buf->data, draw_buf->data, size);
|
||||
LV_PROFILER_DRAW_END;
|
||||
return new_buf;
|
||||
}
|
||||
|
||||
@ -338,6 +372,7 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
|
||||
uint32_t stride)
|
||||
{
|
||||
if(draw_buf == NULL) return NULL;
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
/*If color format is unknown, keep using the original color format.*/
|
||||
if(cf == LV_COLOR_FORMAT_UNKNOWN) cf = draw_buf->header.cf;
|
||||
@ -347,6 +382,7 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
|
||||
|
||||
if(size > draw_buf->data_size) {
|
||||
LV_LOG_TRACE("Draw buf too small for new shape");
|
||||
LV_PROFILER_DRAW_END;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -355,6 +391,7 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
|
||||
draw_buf->header.h = h;
|
||||
draw_buf->header.stride = stride;
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
return draw_buf;
|
||||
}
|
||||
|
||||
@ -362,6 +399,7 @@ void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf)
|
||||
{
|
||||
LV_ASSERT_NULL(draw_buf);
|
||||
if(draw_buf == NULL) return;
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
if(draw_buf->header.flags & LV_IMAGE_FLAGS_ALLOCATED) {
|
||||
LV_ASSERT_NULL(draw_buf->handlers);
|
||||
@ -373,6 +411,7 @@ void lv_draw_buf_destroy(lv_draw_buf_t * draw_buf)
|
||||
else {
|
||||
LV_LOG_ERROR("draw buffer is not allocated, ignored");
|
||||
}
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
void * lv_draw_buf_goto_xy(const lv_draw_buf_t * buf, uint32_t x, uint32_t y)
|
||||
@ -397,12 +436,14 @@ lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride)
|
||||
LV_ASSERT_NULL(src->data);
|
||||
if(src == NULL) return LV_RESULT_INVALID;
|
||||
if(src->data == NULL) return LV_RESULT_INVALID;
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
const lv_image_header_t * header = &src->header;
|
||||
uint32_t w = header->w;
|
||||
uint32_t h = header->h;
|
||||
|
||||
if(!lv_draw_buf_has_flag(src, LV_IMAGE_FLAGS_MODIFIABLE)) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
|
||||
@ -410,19 +451,24 @@ lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride)
|
||||
if(stride == 0) stride = lv_draw_buf_width_to_stride(w, header->cf);
|
||||
|
||||
/*Check if stride already match*/
|
||||
if(header->stride == stride) return LV_RESULT_OK;
|
||||
if(header->stride == stride) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return LV_RESULT_OK;
|
||||
}
|
||||
|
||||
/*Calculate the minimal stride allowed from bpp*/
|
||||
uint32_t bpp = lv_color_format_get_bpp(header->cf);
|
||||
uint32_t min_stride = (w * bpp + 7) >> 3;
|
||||
if(stride < min_stride) {
|
||||
LV_LOG_WARN("New stride is too small. min: %" LV_PRId32, min_stride);
|
||||
LV_PROFILER_DRAW_END;
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
|
||||
/*Check if buffer has enough space. */
|
||||
uint32_t new_size = _calculate_draw_buf_size(w, h, header->cf, stride);
|
||||
if(new_size > src->data_size) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
|
||||
@ -451,6 +497,7 @@ lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride)
|
||||
|
||||
src->header.stride = stride;
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
return LV_RESULT_OK;
|
||||
}
|
||||
|
||||
@ -464,6 +511,7 @@ lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf)
|
||||
LV_LOG_WARN("draw buf is not modifiable: 0x%04x", draw_buf->header.flags);
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
/*Premultiply color with alpha, do case by case by judging color format*/
|
||||
lv_color_format_t cf = draw_buf->header.cf;
|
||||
@ -529,6 +577,7 @@ lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf)
|
||||
|
||||
draw_buf->header.flags |= LV_IMAGE_FLAGS_PREMULTIPLIED;
|
||||
|
||||
LV_PROFILER_DRAW_END;
|
||||
return LV_RESULT_OK;
|
||||
}
|
||||
|
||||
|
@ -3285,6 +3285,19 @@
|
||||
#define LV_PROFILER_CACHE 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Enable event profiler*/
|
||||
#ifndef LV_PROFILER_EVENT
|
||||
#ifdef LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_PROFILER_EVENT
|
||||
#define LV_PROFILER_EVENT CONFIG_LV_PROFILER_EVENT
|
||||
#else
|
||||
#define LV_PROFILER_EVENT 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_PROFILER_EVENT 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** 1: Enable Monkey test */
|
||||
|
@ -250,6 +250,91 @@ void lv_event_mark_deleted(void * target)
|
||||
}
|
||||
}
|
||||
|
||||
const char * lv_event_get_code_name(lv_event_code_t code)
|
||||
{
|
||||
#define ENUM_CASE(x) case LV_##x: return #x
|
||||
|
||||
switch(code) {
|
||||
/** Input device events*/
|
||||
ENUM_CASE(EVENT_PRESSED);
|
||||
ENUM_CASE(EVENT_PRESSING);
|
||||
ENUM_CASE(EVENT_PRESS_LOST);
|
||||
ENUM_CASE(EVENT_SHORT_CLICKED);
|
||||
ENUM_CASE(EVENT_LONG_PRESSED);
|
||||
ENUM_CASE(EVENT_LONG_PRESSED_REPEAT);
|
||||
ENUM_CASE(EVENT_CLICKED);
|
||||
ENUM_CASE(EVENT_RELEASED);
|
||||
ENUM_CASE(EVENT_SCROLL_BEGIN);
|
||||
ENUM_CASE(EVENT_SCROLL_THROW_BEGIN);
|
||||
ENUM_CASE(EVENT_SCROLL_END);
|
||||
ENUM_CASE(EVENT_SCROLL);
|
||||
ENUM_CASE(EVENT_GESTURE);
|
||||
ENUM_CASE(EVENT_KEY);
|
||||
ENUM_CASE(EVENT_ROTARY);
|
||||
ENUM_CASE(EVENT_FOCUSED);
|
||||
ENUM_CASE(EVENT_DEFOCUSED);
|
||||
ENUM_CASE(EVENT_LEAVE);
|
||||
ENUM_CASE(EVENT_HIT_TEST);
|
||||
ENUM_CASE(EVENT_INDEV_RESET);
|
||||
|
||||
/** Drawing events*/
|
||||
ENUM_CASE(EVENT_COVER_CHECK);
|
||||
ENUM_CASE(EVENT_REFR_EXT_DRAW_SIZE);
|
||||
ENUM_CASE(EVENT_DRAW_MAIN_BEGIN);
|
||||
ENUM_CASE(EVENT_DRAW_MAIN);
|
||||
ENUM_CASE(EVENT_DRAW_MAIN_END);
|
||||
ENUM_CASE(EVENT_DRAW_POST_BEGIN);
|
||||
ENUM_CASE(EVENT_DRAW_POST);
|
||||
ENUM_CASE(EVENT_DRAW_POST_END);
|
||||
ENUM_CASE(EVENT_DRAW_TASK_ADDED);
|
||||
|
||||
/** Special events*/
|
||||
ENUM_CASE(EVENT_VALUE_CHANGED);
|
||||
ENUM_CASE(EVENT_INSERT);
|
||||
ENUM_CASE(EVENT_REFRESH);
|
||||
ENUM_CASE(EVENT_READY);
|
||||
ENUM_CASE(EVENT_CANCEL);
|
||||
|
||||
/** Other events*/
|
||||
ENUM_CASE(EVENT_CREATE);
|
||||
ENUM_CASE(EVENT_DELETE);
|
||||
ENUM_CASE(EVENT_CHILD_CHANGED);
|
||||
ENUM_CASE(EVENT_CHILD_CREATED);
|
||||
ENUM_CASE(EVENT_CHILD_DELETED);
|
||||
ENUM_CASE(EVENT_SCREEN_UNLOAD_START);
|
||||
ENUM_CASE(EVENT_SCREEN_LOAD_START);
|
||||
ENUM_CASE(EVENT_SCREEN_LOADED);
|
||||
ENUM_CASE(EVENT_SCREEN_UNLOADED);
|
||||
ENUM_CASE(EVENT_SIZE_CHANGED);
|
||||
ENUM_CASE(EVENT_STYLE_CHANGED);
|
||||
ENUM_CASE(EVENT_LAYOUT_CHANGED);
|
||||
ENUM_CASE(EVENT_GET_SELF_SIZE);
|
||||
|
||||
/** Events of optional LVGL components*/
|
||||
ENUM_CASE(EVENT_INVALIDATE_AREA);
|
||||
ENUM_CASE(EVENT_RESOLUTION_CHANGED);
|
||||
ENUM_CASE(EVENT_COLOR_FORMAT_CHANGED);
|
||||
ENUM_CASE(EVENT_REFR_REQUEST);
|
||||
ENUM_CASE(EVENT_REFR_START);
|
||||
ENUM_CASE(EVENT_REFR_READY);
|
||||
ENUM_CASE(EVENT_RENDER_START);
|
||||
ENUM_CASE(EVENT_RENDER_READY);
|
||||
ENUM_CASE(EVENT_FLUSH_START);
|
||||
ENUM_CASE(EVENT_FLUSH_FINISH);
|
||||
ENUM_CASE(EVENT_FLUSH_WAIT_START);
|
||||
ENUM_CASE(EVENT_FLUSH_WAIT_FINISH);
|
||||
|
||||
ENUM_CASE(EVENT_VSYNC);
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#undef EVENT_ENUM_CASE
|
||||
|
||||
return "EVENT_UNKNOWN";
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -213,6 +213,13 @@ void lv_event_stop_processing(lv_event_t * e);
|
||||
*/
|
||||
uint32_t lv_event_register_id(void);
|
||||
|
||||
/**
|
||||
* Get the name of an event code.
|
||||
* @param code the event code
|
||||
* @return the name of the event code as a string
|
||||
*/
|
||||
const char * lv_event_get_code_name(lv_event_code_t code);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
@ -165,6 +165,18 @@ extern "C" {
|
||||
#define LV_PROFILER_TIMER_END_TAG(tag)
|
||||
#endif
|
||||
|
||||
#if LV_USE_PROFILER && LV_PROFILER_EVENT
|
||||
#define LV_PROFILER_EVENT_BEGIN LV_PROFILER_BEGIN
|
||||
#define LV_PROFILER_EVENT_END LV_PROFILER_END
|
||||
#define LV_PROFILER_EVENT_BEGIN_TAG(tag) LV_PROFILER_BEGIN_TAG(tag)
|
||||
#define LV_PROFILER_EVENT_END_TAG(tag) LV_PROFILER_END_TAG(tag)
|
||||
#else
|
||||
#define LV_PROFILER_EVENT_BEGIN
|
||||
#define LV_PROFILER_EVENT_END
|
||||
#define LV_PROFILER_EVENT_BEGIN_TAG(tag)
|
||||
#define LV_PROFILER_EVENT_END_TAG(tag)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
@ -322,7 +322,11 @@ static bool lv_timer_exec(lv_timer_t * timer)
|
||||
timer->last_run = lv_tick_get();
|
||||
LV_TRACE_TIMER("calling timer callback: %p", *((void **)&timer->timer_cb));
|
||||
|
||||
if(timer->timer_cb && original_repeat_count != 0) timer->timer_cb(timer);
|
||||
if(timer->timer_cb && original_repeat_count != 0) {
|
||||
LV_PROFILER_TIMER_BEGIN_TAG("timer_cb");
|
||||
timer->timer_cb(timer);
|
||||
LV_PROFILER_TIMER_END_TAG("timer_cb");
|
||||
}
|
||||
|
||||
if(!state.timer_deleted) {
|
||||
LV_TRACE_TIMER("timer callback %p finished", *((void **)&timer->timer_cb));
|
||||
|
Loading…
x
Reference in New Issue
Block a user