diff --git a/src/draw/lv_draw.c b/src/draw/lv_draw.c index 0981f67d5..b4cb7cc8a 100644 --- a/src/draw/lv_draw.c +++ b/src/draw/lv_draw.c @@ -253,7 +253,7 @@ bool lv_draw_dispatch_layer(lv_display_t * disp, lv_layer_t * layer) lv_draw_unit_t * u = _draw_info.unit_head; while(u) { int32_t taken_cnt = u->dispatch_cb(u, layer); - if(taken_cnt >= 0) render_running = true; + if(taken_cnt != LV_DRAW_UNIT_IDLE) render_running = true; u = u->next; } } diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index 9e430ab01..14a3af2d0 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -27,6 +27,7 @@ extern "C" { * DEFINES *********************/ #define LV_DRAW_UNIT_NONE 0 +#define LV_DRAW_UNIT_IDLE -1 /*The draw unit is idle, new dispatching might be requested to try again*/ /********************** * TYPEDEFS diff --git a/src/draw/nxp/pxp/lv_draw_pxp.c b/src/draw/nxp/pxp/lv_draw_pxp.c index 521c6d508..6a4250e00 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp.c +++ b/src/draw/nxp/pxp/lv_draw_pxp.c @@ -319,11 +319,11 @@ static int32_t _pxp_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer) lv_draw_task_t * t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_PXP); if(t == NULL || t->preferred_draw_unit_id != DRAW_UNIT_ID_PXP) - return -1; + return LV_DRAW_UNIT_IDLE; void * buf = lv_draw_layer_alloc_buf(layer); if(buf == NULL) - return -1; + return LV_DRAW_UNIT_IDLE; t->state = LV_DRAW_TASK_STATE_IN_PROGRESS; draw_pxp_unit->base_unit.target_layer = layer; diff --git a/src/draw/nxp/vglite/lv_draw_vglite.c b/src/draw/nxp/vglite/lv_draw_vglite.c index 9d2e1d142..ee2e6c78b 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite.c +++ b/src/draw/nxp/vglite/lv_draw_vglite.c @@ -285,11 +285,11 @@ static int32_t _vglite_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer) lv_draw_task_t * t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_VGLITE); if(t == NULL || t->preferred_draw_unit_id != DRAW_UNIT_ID_VGLITE) - return -1; + return LV_DRAW_UNIT_IDLE; void * buf = lv_draw_layer_alloc_buf(layer); if(buf == NULL) - return -1; + return LV_DRAW_UNIT_IDLE; t->state = LV_DRAW_TASK_STATE_IN_PROGRESS; draw_vglite_unit->base_unit.target_layer = layer; diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d.c b/src/draw/renesas/dave2d/lv_draw_dave2d.c index 379e90b54..79e590912 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d.c @@ -349,7 +349,6 @@ static int32_t lv_draw_dave2d_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_DAVE2D); } - /* Return 0 is no selection, some tasks can be supported by other units. */ if(t == NULL) { #if (0 == D2_RENDER_EACH_OPERATION) if(false == _lv_ll_is_empty(&_ll_Dave2D_Tasks)) { @@ -357,12 +356,12 @@ static int32_t lv_draw_dave2d_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * dave2d_execute_dlist_and_flush(); } #endif - return -1; /*Couldn't start rendering*/ + return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/ } void * buf = lv_draw_layer_alloc_buf(layer); if(buf == NULL) { - return -1; /*Couldn't start rendering*/ + return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/ } #if (0 == D2_RENDER_EACH_OPERATION) diff --git a/src/draw/sw/lv_draw_sw.c b/src/draw/sw/lv_draw_sw.c index 6bf3563bd..60fa6dfbd 100644 --- a/src/draw/sw/lv_draw_sw.c +++ b/src/draw/sw/lv_draw_sw.c @@ -372,13 +372,13 @@ static int32_t dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer) t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_SW); if(t == NULL) { LV_PROFILER_END; - return -1; /*Couldn't start rendering*/ + return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/ } void * buf = lv_draw_layer_alloc_buf(layer); if(buf == NULL) { LV_PROFILER_END; - return -1; /*Couldn't start rendering*/ + return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/ } t->state = LV_DRAW_TASK_STATE_IN_PROGRESS; diff --git a/src/draw/vg_lite/lv_draw_vg_lite.c b/src/draw/vg_lite/lv_draw_vg_lite.c index 6d16e2dbd..be30fbd6b 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite.c +++ b/src/draw/vg_lite/lv_draw_vg_lite.c @@ -172,17 +172,17 @@ static int32_t draw_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer) /* Return 0 is no selection, some tasks can be supported by other units. */ if(!t || t->preferred_draw_unit_id != VG_LITE_DRAW_UNIT_ID) { lv_vg_lite_finish(u); - return -1; + return LV_DRAW_UNIT_IDLE; } /* Return if target buffer format is not supported. */ if(!lv_vg_lite_is_dest_cf_supported(layer->color_format)) { - return -1; + return LV_DRAW_UNIT_IDLE; } void * buf = lv_draw_layer_alloc_buf(layer); if(!buf) { - return -1; + return LV_DRAW_UNIT_IDLE; } t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;