From 05bb8d9504cde83944d558eec833c952d8c84de2 Mon Sep 17 00:00:00 2001 From: Martin Stumpf Date: Thu, 17 Oct 2024 10:25:17 +0200 Subject: [PATCH] lvgl: add `frame_incomplete` information to `display_write` In frames with multiple writes (officially supported through `CONFIG_LV_Z_VDB_SIZE`) the display needs to be signalled that the current frame is over and the content should be displayed. This allows displays to present the UI without tearing artifacts. Signed-off-by: Martin Stumpf --- doc/releases/release-notes-4.1.rst | 3 +++ modules/lvgl/lvgl_display.c | 2 ++ modules/lvgl/lvgl_display_mono.c | 13 ++++++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index f0db5e8cbd9..cd207e67a7e 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -282,6 +282,9 @@ Trusted Firmware-M LVGL **** +* Added ``frame_incomplete`` support to indicate whether a write is the last + write of the frame (:github:`81250`) + Tests and Samples ***************** diff --git a/modules/lvgl/lvgl_display.c b/modules/lvgl/lvgl_display.c index 604cd0078d8..39f3da1f795 100644 --- a/modules/lvgl/lvgl_display.c +++ b/modules/lvgl/lvgl_display.c @@ -25,6 +25,7 @@ void lvgl_flush_thread_entry(void *arg1, void *arg2, void *arg3) k_msgq_get(&flush_queue, &flush, K_FOREVER); data = (struct lvgl_disp_data *)flush.disp_drv->user_data; + flush.desc.frame_incomplete = !lv_disp_flush_is_last(flush.disp_drv); display_write(data->display_dev, flush.x, flush.y, &flush.desc, flush.buf); @@ -132,6 +133,7 @@ void lvgl_flush_display(struct lvgl_display_flush *request) struct lvgl_disp_data *data = (struct lvgl_disp_data *)request->disp_drv->user_data; + request->desc.frame_incomplete = !lv_disp_flush_is_last(request->disp_drv); display_write(data->display_dev, request->x, request->y, &request->desc, request->buf); lv_disp_flush_ready(request->disp_drv); diff --git a/modules/lvgl/lvgl_display_mono.c b/modules/lvgl/lvgl_display_mono.c index 07f84b7d19e..b6b76699627 100644 --- a/modules/lvgl/lvgl_display_mono.c +++ b/modules/lvgl/lvgl_display_mono.c @@ -14,7 +14,6 @@ void lvgl_flush_cb_mono(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color uint16_t h = area->y2 - area->y1 + 1; struct lvgl_disp_data *data = (struct lvgl_disp_data *)disp_drv->user_data; const struct device *display_dev = data->display_dev; - struct display_buffer_descriptor desc; const bool is_epd = data->cap.screen_info & SCREEN_INFO_EPD; const bool is_last = lv_disp_flush_is_last(disp_drv); @@ -29,10 +28,14 @@ void lvgl_flush_cb_mono(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color data->blanking_on = true; } - desc.buf_size = (w * h) / 8U; - desc.width = w; - desc.pitch = w; - desc.height = h; + struct display_buffer_descriptor desc = { + .buf_size = (w * h) / 8U, + .width = w, + .pitch = w, + .height = h, + .frame_incomplete = !is_last, + }; + display_write(display_dev, area->x1, area->y1, &desc, (void *)color_p); if (data->cap.screen_info & SCREEN_INFO_DOUBLE_BUFFER) { display_write(display_dev, area->x1, area->y1, &desc, (void *)color_p);