diff --git a/src/draw/vg_lite/lv_draw_vg_lite_arc.c b/src/draw/vg_lite/lv_draw_vg_lite_arc.c index 1b932e05b0..4a4ed6a492 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_arc.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_arc.c @@ -83,6 +83,8 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d return; } + LV_PROFILER_BEGIN; + lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32); lv_vg_lite_path_set_quality(path, VG_LITE_HIGH); lv_vg_lite_path_set_bonding_box_area(path, &clip_area); @@ -160,6 +162,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_lite_path, @@ -167,6 +170,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d &matrix, VG_LITE_BLEND_SRC_OVER, color)); + LV_PROFILER_END_TAG("vg_lite_draw"); if(dsc->img_src) { vg_lite_buffer_t src_buf; @@ -174,6 +178,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d if(lv_vg_lite_buffer_open_image(&src_buf, &decoder_dsc, dsc->img_src, false)) { vg_lite_matrix_t path_matrix; vg_lite_identity(&path_matrix); + LV_PROFILER_BEGIN_TAG("vg_lite_draw_pattern"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern( &u->target_buffer, vg_lite_path, @@ -186,11 +191,13 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d 0, color, VG_LITE_FILTER_BI_LINEAR)); + LV_PROFILER_END_TAG("vg_lite_draw_pattern"); lv_vg_lite_push_image_decoder_dsc(draw_unit, &decoder_dsc); } } lv_vg_lite_path_drop(u, path); + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_border.c b/src/draw/vg_lite/lv_draw_vg_lite_border.c index 757e2ea226..a4e8daf61d 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_border.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_border.c @@ -57,6 +57,8 @@ void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc return; } + LV_PROFILER_BEGIN; + int32_t w = lv_area_get_width(coords); int32_t h = lv_area_get_height(coords); int32_t r_out = dsc->radius; @@ -97,6 +99,7 @@ void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_lite_path, @@ -104,8 +107,10 @@ void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc &matrix, VG_LITE_BLEND_SRC_OVER, color)); + LV_PROFILER_END_TAG("vg_lite_draw"); lv_vg_lite_path_drop(u, path); + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c b/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c index c9e00c4d3d..e5cc008978 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c @@ -62,6 +62,8 @@ void lv_draw_vg_lite_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_sh lv_area_t draw_area; if(!_lv_area_intersect(&draw_area, &shadow_area, draw_unit->clip_area)) return; + LV_PROFILER_BEGIN; + lv_draw_border_dsc_t border_dsc; lv_draw_border_dsc_init(&border_dsc); border_dsc.width = 3; @@ -88,6 +90,7 @@ void lv_draw_vg_lite_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_sh lv_draw_vg_lite_fill(draw_unit, &fill_dsc, &core_area); } } + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_fill.c b/src/draw/vg_lite/lv_draw_vg_lite_fill.c index 459fd47fbd..e8ed46837b 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_fill.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_fill.c @@ -57,6 +57,8 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * return; } + LV_PROFILER_BEGIN; + vg_lite_matrix_t matrix; vg_lite_identity(&matrix); lv_vg_lite_matrix_multiply(&matrix, &u->global_matrix); @@ -92,6 +94,7 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * } else { /* normal fill */ vg_lite_color_t color = lv_vg_lite_color(dsc->color, dsc->opa, true); + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_lite_path, @@ -99,9 +102,12 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * &matrix, VG_LITE_BLEND_SRC_OVER, color)); + LV_PROFILER_END_TAG("vg_lite_draw"); } lv_vg_lite_path_drop(u, path); + + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_img.c b/src/draw/vg_lite/lv_draw_vg_lite_img.c index bd91046baf..816aca1f35 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_img.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_img.c @@ -69,9 +69,12 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * return; } + LV_PROFILER_BEGIN; + vg_lite_buffer_t src_buf; lv_image_decoder_dsc_t decoder_dsc; if(!lv_vg_lite_buffer_open_image(&src_buf, &decoder_dsc, dsc->src, no_cache)) { + LV_PROFILER_END; return; } @@ -107,6 +110,8 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * /* rect is used to crop the pixel-aligned padding area */ vg_lite_rectangle_t rect; lv_vg_lite_rect(&rect, &src_area); + + LV_PROFILER_BEGIN_TAG("vg_lite_blit_rect"); LV_VG_LITE_CHECK_ERROR(vg_lite_blit_rect( &u->target_buffer, &src_buf, @@ -115,6 +120,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * lv_vg_lite_blend_mode(dsc->blend_mode), color, filter)); + LV_PROFILER_END_TAG("vg_lite_blit_rect"); } else { lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_S16); @@ -132,6 +138,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * vg_lite_matrix_t path_matrix; vg_lite_identity(&path_matrix); + LV_PROFILER_BEGIN_TAG("vg_lite_draw_pattern"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern( &u->target_buffer, vg_lite_path, @@ -144,11 +151,13 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * 0, color, filter)); + LV_PROFILER_END_TAG("vg_lite_draw_pattern"); lv_vg_lite_path_drop(u, path); } lv_vg_lite_push_image_decoder_dsc(draw_unit, &decoder_dsc); + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_label.c b/src/draw/vg_lite/lv_draw_vg_lite_label.c index 536dfda9d0..2f1b0853f3 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_label.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_label.c @@ -65,6 +65,8 @@ void lv_draw_vg_lite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t { if(dsc->opa <= LV_OPA_MIN) return; + LV_PROFILER_BEGIN; + #if LV_USE_FREETYPE static bool is_init = false; if(!is_init) { @@ -74,6 +76,7 @@ void lv_draw_vg_lite_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t #endif /* LV_USE_FREETYPE */ lv_draw_label_iterate_characters(draw_unit, dsc, coords, draw_letter_cb); + LV_PROFILER_END; } /********************** @@ -140,6 +143,8 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d return; } + LV_PROFILER_BEGIN; + lv_area_t image_area = *dsc->letter_coords; vg_lite_matrix_t matrix; @@ -166,6 +171,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d /* rect is used to crop the pixel-aligned padding area */ vg_lite_rectangle_t rect; lv_vg_lite_rect(&rect, &src_area); + LV_PROFILER_BEGIN_TAG("vg_lite_blit_rect"); LV_VG_LITE_CHECK_ERROR(vg_lite_blit_rect( &u->target_buffer, &src_buf, @@ -174,6 +180,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d VG_LITE_BLEND_SRC_OVER, color, VG_LITE_FILTER_LINEAR)); + LV_PROFILER_END_TAG("vg_lite_blit_rect"); } else { lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_S16); @@ -191,6 +198,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d vg_lite_matrix_t path_matrix; vg_lite_identity(&path_matrix); + LV_PROFILER_BEGIN_TAG("vg_lite_draw_pattern"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern( &u->target_buffer, vg_lite_path, @@ -203,6 +211,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d color, color, VG_LITE_FILTER_LINEAR)); + LV_PROFILER_END_TAG("vg_lite_draw_pattern"); lv_vg_lite_path_drop(u, path); } @@ -212,6 +221,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d * Later, use the font cache for management to improve efficiency. */ lv_vg_lite_finish(&u->base_unit); + LV_PROFILER_END; } #if LV_USE_FREETYPE @@ -224,6 +234,8 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_ return; } + LV_PROFILER_BEGIN; + /* vg-lite bounding_box will crop the pixels on the edge, so +1px is needed here */ path_clip_area.x2++; path_clip_area.y2++; @@ -249,6 +261,7 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_ vg_lite_matrix_t result; if(!lv_vg_lite_matrix_inverse(&result, &matrix)) { LV_LOG_ERROR("no inverse matrix"); + LV_PROFILER_END; return; } @@ -269,13 +282,19 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_ LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_lite_path, VG_LITE_FILL_NON_ZERO, &matrix, VG_LITE_BLEND_SRC_OVER, lv_vg_lite_color(dsc->color, dsc->opa, true))); + LV_PROFILER_END_TAG("vg_lite_draw"); + + LV_PROFILER_END; } static void vg_lite_outline_push(const lv_freetype_outline_event_param_t * param) { + LV_PROFILER_BEGIN; lv_vg_lite_path_t * outline = param->outline; LV_ASSERT_NULL(outline); @@ -304,10 +323,12 @@ static void vg_lite_outline_push(const lv_freetype_outline_event_param_t * param LV_ASSERT(false); break; } + LV_PROFILER_END; } static void freetype_outline_event_cb(lv_event_t * e) { + LV_PROFILER_BEGIN; lv_event_code_t code = lv_event_get_code(e); lv_freetype_outline_event_param_t * param = lv_event_get_param(e); switch(code) { @@ -324,6 +345,7 @@ static void freetype_outline_event_cb(lv_event_t * e) LV_LOG_WARN("unknown event code: %d", code); break; } + LV_PROFILER_END; } #endif /* LV_USE_FREETYPE */ diff --git a/src/draw/vg_lite/lv_draw_vg_lite_layer.c b/src/draw/vg_lite/lv_draw_vg_lite_layer.c index 9476c6c023..8252656272 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_layer.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_layer.c @@ -48,12 +48,15 @@ void lv_draw_vg_lite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t if(layer->draw_buf == NULL) return; + LV_PROFILER_BEGIN; + /* The GPU output should already be premultiplied RGB */ layer->draw_buf->header.flags |= LV_IMAGE_FLAGS_PREMULTIPLIED; lv_draw_image_dsc_t new_draw_dsc = *draw_dsc; new_draw_dsc.src = layer->draw_buf; lv_draw_vg_lite_img(draw_unit, &new_draw_dsc, coords, true); + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_line.c b/src/draw/vg_lite/lv_draw_vg_lite_line.c index 26d9d9f4a3..d0328b3b07 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_line.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_line.c @@ -69,6 +69,8 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * return; /*Fully clipped, nothing to do*/ } + LV_PROFILER_BEGIN; + lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; int32_t dash_width = dsc->dash_width; @@ -193,6 +195,7 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_lite_path, @@ -200,8 +203,11 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * &matrix, VG_LITE_BLEND_SRC_OVER, color)); + LV_PROFILER_END_TAG("vg_lite_draw"); lv_vg_lite_path_drop(u, path); + + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c b/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c index ef9b7658a0..a7cbda0cbc 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c @@ -48,6 +48,8 @@ void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_re return; } + LV_PROFILER_BEGIN; + lv_draw_sw_mask_radius_param_t param; lv_draw_sw_mask_radius_init(¶m, &dsc->area, dsc->radius, false); @@ -85,6 +87,8 @@ void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_re lv_free(mask_buf); lv_draw_sw_mask_free_param(¶m); + + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_triangle.c b/src/draw/vg_lite/lv_draw_vg_lite_triangle.c index 6dd90d7c48..ef7b8042b4 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_triangle.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_triangle.c @@ -54,6 +54,8 @@ void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle is_common = _lv_area_intersect(&clip_area, &tri_area, draw_unit->clip_area); if(!is_common) return; + LV_PROFILER_BEGIN; + lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_FP32); @@ -85,6 +87,7 @@ void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle } else { /* normal fill */ vg_lite_color_t color = lv_vg_lite_color(dsc->bg_color, dsc->bg_opa, true); + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_lite_path, @@ -92,9 +95,12 @@ void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle &matrix, VG_LITE_BLEND_SRC_OVER, color)); + LV_PROFILER_END_TAG("vg_lite_draw"); } lv_vg_lite_path_drop(u, path); + + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_draw_vg_lite_vector.c b/src/draw/vg_lite/lv_draw_vg_lite_vector.c index 355bcf79e9..f8183a8a1a 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_vector.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_vector.c @@ -55,7 +55,9 @@ void lv_draw_vg_lite_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_tas if(layer->draw_buf == NULL) return; + LV_PROFILER_BEGIN; _lv_vector_for_each_destroy_tasks(dsc->task_list, task_draw_cb, draw_unit); + LV_PROFILER_END; } /********************** @@ -75,6 +77,7 @@ static vg_lite_color_t lv_color32_to_vg(lv_color32_t color, lv_opa_t opa) static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vector_draw_dsc_t * dsc) { + LV_PROFILER_BEGIN; lv_draw_vg_lite_unit_t * u = ctx; LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); @@ -84,7 +87,10 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec vg_lite_color_t c = lv_color32_to_vg(dsc->fill_dsc.color, LV_OPA_COVER); vg_lite_rectangle_t rect; lv_vg_lite_rect(&rect, &dsc->scissor_area); + LV_PROFILER_BEGIN_TAG("vg_lite_clear"); LV_VG_LITE_CHECK_ERROR(vg_lite_clear(&u->target_buffer, &rect, c)); + LV_PROFILER_END_TAG("vg_lite_clear"); + LV_PROFILER_END; return; } @@ -115,6 +121,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec switch(dsc->fill_dsc.style) { case LV_VECTOR_DRAW_STYLE_SOLID: { /* normal draw shape */ + LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( &u->target_buffer, vg_path, @@ -122,6 +129,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec &matrix, blend, vg_color)); + LV_PROFILER_END_TAG("vg_lite_draw"); } break; case LV_VECTOR_DRAW_STYLE_PATTERN: { @@ -141,6 +149,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec vg_lite_color_t recolor = lv_vg_lite_color(dsc->fill_dsc.img_dsc.recolor, dsc->fill_dsc.img_dsc.recolor_opa, true); + LV_PROFILER_BEGIN_TAG("vg_lite_draw_pattern"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern( &u->target_buffer, vg_path, @@ -153,6 +162,8 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec recolor, vg_color, VG_LITE_FILTER_BI_LINEAR)); + LV_PROFILER_END_TAG("vg_lite_draw_pattern"); + lv_vg_lite_push_image_decoder_dsc(&u->base_unit, &decoder_dsc); } } @@ -195,6 +206,8 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec /* disable scissor */ lv_vg_lite_disable_scissor(); + + LV_PROFILER_END; } static void lv_matrix_to_vg(vg_lite_matrix_t * dest, const lv_matrix_t * src) @@ -218,6 +231,7 @@ static vg_lite_quality_t lv_quality_to_vg(lv_vector_path_quality_t quality) static void lv_path_to_vg(lv_vg_lite_path_t * dest, const lv_vector_path_t * src) { + LV_PROFILER_BEGIN; lv_vg_lite_path_set_quality(dest, lv_quality_to_vg(src->quality)); /* init bounds */ @@ -281,6 +295,7 @@ static void lv_path_to_vg(lv_vg_lite_path_t * dest, const lv_vector_path_t * src lv_vg_lite_path_end(dest); lv_vg_lite_path_set_bonding_box(dest, min_x, min_y, max_x, max_y); + LV_PROFILER_END; } static vg_lite_blend_t lv_blend_to_vg(lv_vector_blend_t blend) diff --git a/src/draw/vg_lite/lv_vg_lite_path.c b/src/draw/vg_lite/lv_vg_lite_path.c index 40be97b4e9..dc405e8926 100644 --- a/src/draw/vg_lite/lv_vg_lite_path.c +++ b/src/draw/vg_lite/lv_vg_lite_path.c @@ -80,6 +80,7 @@ void lv_vg_lite_path_deinit(struct _lv_draw_vg_lite_unit_t * unit) lv_vg_lite_path_t * lv_vg_lite_path_create(vg_lite_format_t data_format) { + LV_PROFILER_BEGIN; lv_vg_lite_path_t * path = lv_malloc_zeroed(sizeof(lv_vg_lite_path_t)); LV_ASSERT_MALLOC(path); path->format_len = lv_vg_lite_path_format_len(data_format); @@ -91,17 +92,20 @@ lv_vg_lite_path_t * lv_vg_lite_path_create(vg_lite_format_t data_format) NULL, 0, 0, 0, 0) == VG_LITE_SUCCESS); + LV_PROFILER_END; return path; } void lv_vg_lite_path_destroy(lv_vg_lite_path_t * path) { + LV_PROFILER_BEGIN; LV_ASSERT_NULL(path); if(path->base.path != NULL) { lv_free(path->base.path); path->base.path = NULL; } lv_free(path); + LV_PROFILER_END; } lv_vg_lite_path_t * lv_vg_lite_path_get(struct _lv_draw_vg_lite_unit_t * unit, vg_lite_format_t data_format) @@ -205,6 +209,8 @@ bool lv_vg_lite_path_update_bonding_box(lv_vg_lite_path_t * path) return false; } + LV_PROFILER_BEGIN; + lv_vg_lite_path_bounds_t bounds; /* init bounds */ @@ -219,6 +225,8 @@ bool lv_vg_lite_path_update_bonding_box(lv_vg_lite_path_t * path) /* set bounds */ lv_vg_lite_path_set_bonding_box(path, bounds.min_x, bounds.min_y, bounds.max_x, bounds.max_y); + LV_PROFILER_END; + return true; } @@ -323,6 +331,7 @@ void lv_vg_lite_path_append_rect( float w, float h, float rx, float ry) { + LV_PROFILER_BEGIN; const float half_w = w * 0.5f; const float half_h = h * 0.5f; @@ -339,12 +348,15 @@ void lv_vg_lite_path_append_rect( lv_vg_lite_path_line_to(path, x + w, y + h); lv_vg_lite_path_line_to(path, x, y + h); lv_vg_lite_path_close(path); + LV_PROFILER_END; return; } /*circle*/ if(math_equal(rx, half_w) && math_equal(ry, half_h)) { - return lv_vg_lite_path_append_circle(path, x + (w * 0.5f), y + (h * 0.5f), rx, ry); + lv_vg_lite_path_append_circle(path, x + (w * 0.5f), y + (h * 0.5f), rx, ry); + LV_PROFILER_END; + return; } /*rounded rectangle*/ @@ -360,6 +372,7 @@ void lv_vg_lite_path_append_rect( lv_vg_lite_path_line_to(path, x, y + ry); lv_vg_lite_path_cubic_to(path, x, y + ry - hry, x + rx - hrx, y, x + rx, y); lv_vg_lite_path_close(path); + LV_PROFILER_END; } void lv_vg_lite_path_append_circle( @@ -367,6 +380,7 @@ void lv_vg_lite_path_append_circle( float cx, float cy, float rx, float ry) { + LV_PROFILER_BEGIN; /* https://learn.microsoft.com/zh-cn/xamarin/xamarin-forms/user-interface/graphics/skiasharp/curves/beziers */ float rx_kappa = rx * PATH_KAPPA; float ry_kappa = ry * PATH_KAPPA; @@ -377,6 +391,7 @@ void lv_vg_lite_path_append_circle( lv_vg_lite_path_cubic_to(path, cx - rx_kappa, cy + ry, cx - rx, cy + ry_kappa, cx - rx, cy); lv_vg_lite_path_cubic_to(path, cx - rx, cy - ry_kappa, cx - rx_kappa, cy - ry, cx, cy - ry); lv_vg_lite_path_close(path); + LV_PROFILER_END; } void lv_vg_lite_path_append_arc_right_angle(lv_vg_lite_path_t * path, @@ -384,6 +399,7 @@ void lv_vg_lite_path_append_arc_right_angle(lv_vg_lite_path_t * path, float center_x, float center_y, float end_x, float end_y) { + LV_PROFILER_BEGIN; float dx1 = center_x - start_x; float dy1 = center_y - start_y; float dx2 = end_x - center_x; @@ -395,6 +411,7 @@ void lv_vg_lite_path_append_arc_right_angle(lv_vg_lite_path_t * path, start_x - c * dy1, start_y + c * dx1, end_x - c * dy2, end_y + c * dx2, end_x, end_y); + LV_PROFILER_END; } void lv_vg_lite_path_append_arc(lv_vg_lite_path_t * path, @@ -404,9 +421,12 @@ void lv_vg_lite_path_append_arc(lv_vg_lite_path_t * path, float sweep, bool pie) { + LV_PROFILER_BEGIN; /* just circle */ if(sweep >= 360.0f || sweep <= -360.0f) { - return lv_vg_lite_path_append_circle(path, cx, cy, radius, radius); + lv_vg_lite_path_append_circle(path, cx, cy, radius, radius); + LV_PROFILER_END; + return; } start_angle = MATH_RADIANS(start_angle); @@ -466,6 +486,8 @@ void lv_vg_lite_path_append_arc(lv_vg_lite_path_t * path, if(pie) { lv_vg_lite_path_close(path); } + + LV_PROFILER_END; } uint8_t lv_vg_lite_vlc_op_arg_len(uint8_t vlc_op) diff --git a/src/draw/vg_lite/lv_vg_lite_utils.c b/src/draw/vg_lite/lv_vg_lite_utils.c index eba139cf11..802daf2828 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.c +++ b/src/draw/vg_lite/lv_vg_lite_utils.c @@ -651,7 +651,9 @@ bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_ds if(LV_COLOR_FORMAT_IS_INDEXED(decoded->header.cf)) { uint32_t palette_size = LV_COLOR_INDEXED_PALETTE_SIZE(decoded->header.cf); + LV_PROFILER_BEGIN_TAG("vg_lite_set_CLUT"); LV_VG_LITE_CHECK_ERROR(vg_lite_set_CLUT(palette_size, (vg_lite_uint32_t *)decoded->data)); + LV_PROFILER_END_TAG("vg_lite_set_CLUT"); } lv_vg_lite_buffer_from_draw_buf(buffer, decoded); @@ -897,6 +899,8 @@ void lv_vg_lite_draw_linear_grad( LV_ASSERT_NULL(area); LV_ASSERT_NULL(grad); + LV_PROFILER_BEGIN; + LV_ASSERT(grad->dir != LV_GRAD_DIR_NONE); vg_lite_uint32_t colors[VLC_MAX_GRADIENT_STOPS]; @@ -920,7 +924,10 @@ void lv_vg_lite_draw_linear_grad( LV_VG_LITE_CHECK_ERROR(vg_lite_init_grad(&gradient)); LV_VG_LITE_CHECK_ERROR(vg_lite_set_grad(&gradient, cnt, colors, stops)); + + LV_PROFILER_BEGIN_TAG("vg_lite_update_grad"); LV_VG_LITE_CHECK_ERROR(vg_lite_update_grad(&gradient)); + LV_PROFILER_END_TAG("vg_lite_update_grad"); vg_lite_matrix_t * grad_matrix = vg_lite_get_grad_matrix(&gradient); vg_lite_identity(grad_matrix); @@ -934,6 +941,7 @@ void lv_vg_lite_draw_linear_grad( vg_lite_scale(lv_area_get_width(area) / 256.0f, 1, grad_matrix); } + LV_PROFILER_BEGIN_TAG("vg_lite_draw_grad"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_grad( buffer, path, @@ -941,8 +949,10 @@ void lv_vg_lite_draw_linear_grad( (vg_lite_matrix_t *)matrix, &gradient, blend)); + LV_PROFILER_END_TAG("vg_lite_draw_grad"); LV_VG_LITE_CHECK_ERROR(vg_lite_clear_grad(&gradient)); + LV_PROFILER_END; } void lv_vg_lite_matrix_multiply(vg_lite_matrix_t * matrix, const vg_lite_matrix_t * mult) @@ -1048,20 +1058,24 @@ void lv_vg_lite_disable_scissor(void) void lv_vg_lite_flush(lv_draw_unit_t * draw_unit) { + LV_PROFILER_BEGIN; lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; u->flush_count++; if(u->flush_count < LV_VG_LITE_FLUSH_MAX_COUNT) { /* Do not flush too often */ + LV_PROFILER_END; return; } LV_VG_LITE_CHECK_ERROR(vg_lite_flush()); u->flush_count = 0; + LV_PROFILER_END; } void lv_vg_lite_finish(lv_draw_unit_t * draw_unit) { + LV_PROFILER_BEGIN; lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; LV_VG_LITE_CHECK_ERROR(vg_lite_finish()); @@ -1069,6 +1083,7 @@ void lv_vg_lite_finish(lv_draw_unit_t * draw_unit) /* Clear image decoder dsc reference */ lv_vg_lite_clear_image_decoder_dsc(draw_unit); u->flush_count = 0; + LV_PROFILER_END; } /********************** diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h index ca4372bb13..e78c73b9b4 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.h +++ b/src/draw/vg_lite/lv_vg_lite_utils.h @@ -18,6 +18,8 @@ extern "C" { #if LV_USE_DRAW_VG_LITE +#include "../../misc/lv_profiler.h" + #include #if LV_USE_VG_LITE_THORVG #include "../../others/vg_lite_tvg/vg_lite.h"