diff --git a/docs/porting/display.md b/docs/porting/display.md index 719a2343c..78438ba2e 100644 --- a/docs/porting/display.md +++ b/docs/porting/display.md @@ -109,6 +109,7 @@ It can be used if the display controller can refresh only areas with specific he This way the buffers used in `lv_disp_draw_buf_t` can be smaller to hold only the required number of bits for the given area size. Note that rendering with `set_px_cb` is slower than normal rendering. - `monitor_cb` A callback function that tells how many pixels were refreshed and in how much time. Called when the last chunk is rendered and sent to the display. - `clean_dcache_cb` A callback for cleaning any caches related to the display. +- `render_start_cb` A callback function that notifies the display driver that rendering has started. It also could be used to wait for VSYNC to start rendering. It's useful if rendering is faster than a VSYNC period. LVGL has built-in support to several GPUs (see `lv_conf.h`) but if something else is required these functions can be used to make LVGL use a GPU: - `gpu_fill_cb` fill an area in the memory with a color. diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index ba59ce90f..2cef6ef28 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -519,6 +519,11 @@ static void lv_refr_areas(void) } } + /*Notify the display driven rendering has started*/ + if(disp_refr->driver->render_start_cb) { + disp_refr->driver->render_start_cb(disp_refr->driver); + } + disp_refr->driver->draw_buf->last_area = 0; disp_refr->driver->draw_buf->last_part = 0; disp_refr->rendering_in_progress = true; diff --git a/src/hal/lv_hal_disp.h b/src/hal/lv_hal_disp.h index 61f25c9ba..75ddd869f 100644 --- a/src/hal/lv_hal_disp.h +++ b/src/hal/lv_hal_disp.h @@ -133,6 +133,9 @@ typedef struct _lv_disp_drv_t { /** OPTIONAL: called when driver parameters are updated */ void (*drv_update_cb)(struct _lv_disp_drv_t * disp_drv); + /** OPTIONAL: called when start rendering */ + void (*render_start_cb)(struct _lv_disp_drv_t * disp_drv); + /** On CHROMA_KEYED images this color will be transparent. * `LV_COLOR_CHROMA_KEY` by default. (lv_conf.h)*/ lv_color_t color_chroma_key;