1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

feat(draw): add lv_draw_get_dependent_count

This commit is contained in:
Gabor Kiss-Vamosi 2023-11-26 23:01:37 +01:00
parent 950cebf971
commit 26e0f44a36
2 changed files with 33 additions and 0 deletions

View File

@ -309,6 +309,28 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
return NULL;
}
uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check)
{
if(t_check == NULL) return 0;
if(t_check->next == NULL) return 0;
LV_PROFILER_BEGIN;
uint32_t cnt = 0;
lv_draw_task_t * t = t_check->next;
while(t) {
if((t->state == LV_DRAW_TASK_STATE_QUEUED || t->state == LV_DRAW_TASK_STATE_WAITING) &&
_lv_area_is_on(&t_check->area, &t->area)) {
cnt++;
}
t = t->next;
}
LV_PROFILER_END;
return cnt;
}
lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area)
{
lv_display_t * disp = _lv_refr_get_disp_refreshing();

View File

@ -240,6 +240,17 @@ void lv_draw_dispatch_request(void);
*/
lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_task_t * t_prev, uint8_t draw_unit_id);
/**
* Tell how many draw task are waiting to be drawn on the area of `t_check`.
* It can be used to determine if a GPU shall combine many draw tasks in to one or not.
* If a lot of tasks are waiting for the current ones it makes sense to draw them one-by-one
* to not block the dependent tasks' rendering
* @param t_check the task whose dependent tasks shall be counted
* @return number of tasks depending on `t_check`
*/
uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check);
/**
* Create a new layer on a parent layer
* @param parent_layer the parent layer to which the layer will be merged when it's rendered