From 25876e822206b4146affb4cc58a5072af4d44f0f Mon Sep 17 00:00:00 2001 From: Qi Huang Date: Tue, 7 Apr 2020 01:00:56 +0000 Subject: [PATCH] apps/examples/lvgldemo: Update fb flush callback for LVGL V6.1.2 Signed-off-by: Qi Huang Change-Id: I72a6ff628f2ea2b0b505e444c84b266ba3a28d87 --- examples/lvgldemo/fbdev.c | 74 +++++++++++++++++++++------------------ examples/lvgldemo/fbdev.h | 9 ++--- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/examples/lvgldemo/fbdev.c b/examples/lvgldemo/fbdev.c index 2e6b53dfb..e462c60ad 100644 --- a/examples/lvgldemo/fbdev.c +++ b/examples/lvgldemo/fbdev.c @@ -171,8 +171,8 @@ int fbdev_init(void) * address mapping to make the memory accessible to the application. */ - state.fbmem = mmap(NULL, state.pinfo.fblen, PROT_READ|PROT_WRITE, - MAP_SHARED|MAP_FILE, state.fd, 0); + state.fbmem = mmap(NULL, state.pinfo.fblen, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_FILE, state.fd, 0); if (state.fbmem == MAP_FAILED) { int errcode = errno; @@ -205,12 +205,16 @@ int fbdev_init(void) * ****************************************************************************/ -void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, - FAR const lv_color_t *color_p) +void fbdev_flush(struct _disp_drv_t *disp_drv, const lv_area_t *area, + lv_color_t *color_p) { #ifdef CONFIG_LCD_UPDATE struct nxgl_rect_s rect; #endif + int32_t x1 = area->x1; + int32_t y1 = area->y1; + int32_t x2 = area->x2; + int32_t y2 = area->y2; int32_t act_x1; int32_t act_y1; int32_t act_x2; @@ -253,7 +257,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 8) { - uint8_t *fbp8 = (uint8_t*)state.fbmem; + uint8_t *fbp8 = (uint8_t *)state.fbmem; uint32_t x; uint32_t y; @@ -272,7 +276,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 16) { - uint16_t *fbp16 = (uint16_t*)state.fbmem; + uint16_t *fbp16 = (uint16_t *)state.fbmem; uint32_t x; uint32_t y; @@ -291,7 +295,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32) { - uint32_t *fbp32 = (uint32_t*)state.fbmem; + uint32_t *fbp32 = (uint32_t *)state.fbmem; uint32_t x; uint32_t y; @@ -318,7 +322,7 @@ void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, /* Tell the flushing is ready */ - lv_flush_ready(); + lv_disp_flush_ready(disp_drv); } /**************************************************************************** @@ -387,7 +391,7 @@ void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 8) { - uint8_t *fbp8 = (uint8_t*)state.fbmem; + uint8_t *fbp8 = (uint8_t *)state.fbmem; uint32_t x; uint32_t y; @@ -403,7 +407,7 @@ void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 16) { - uint16_t *fbp16 = (uint16_t*)state.fbmem; + uint16_t *fbp16 = (uint16_t *)state.fbmem; uint32_t x; uint32_t y; @@ -419,7 +423,7 @@ void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32) { - uint32_t *fbp32 = (uint32_t*)state.fbmem; + uint32_t *fbp32 = (uint32_t *)state.fbmem; uint32_t x; uint32_t y; @@ -508,58 +512,58 @@ void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, if (state.pinfo.bpp == 8) { - uint8_t *fbp8 = (uint8_t*)state.fbmem; + uint8_t *fbp8 = (uint8_t *)state.fbmem; uint32_t x; uint32_t y; for (y = act_y1; y <= act_y2; y++) { - for (x = act_x1; x <= act_x2; x++) - { - location = x + (y * state.vinfo.xres); - fbp8[location] = color_p->full; - color_p++; - } + for (x = act_x1; x <= act_x2; x++) + { + location = x + (y * state.vinfo.xres); + fbp8[location] = color_p->full; + color_p++; + } - color_p += x2 - act_x2; + color_p += x2 - act_x2; } } if (state.pinfo.bpp == 16) { - uint16_t *fbp16 = (uint16_t*)state.fbmem; + uint16_t *fbp16 = (uint16_t *)state.fbmem; uint32_t x; uint32_t y; for (y = act_y1; y <= act_y2; y++) { - for (x = act_x1; x <= act_x2; x++) - { - location = x + (y * state.vinfo.xres); - fbp16[location] = color_p->full; - color_p++; - } + for (x = act_x1; x <= act_x2; x++) + { + location = x + (y * state.vinfo.xres); + fbp16[location] = color_p->full; + color_p++; + } - color_p += x2 - act_x2; + color_p += x2 - act_x2; } } if (state.pinfo.bpp == 24 || state.pinfo.bpp == 32) { - uint32_t *fbp32 = (uint32_t*)state.fbmem; + uint32_t *fbp32 = (uint32_t *)state.fbmem; uint32_t x; uint32_t y; for (y = act_y1; y <= act_y2; y++) { - for (x = act_x1; x <= act_x2; x++) - { - location = x + (y * state.vinfo.xres); - fbp32[location] = color_p->full; - color_p++; - } + for (x = act_x1; x <= act_x2; x++) + { + location = x + (y * state.vinfo.xres); + fbp32[location] = color_p->full; + color_p++; + } - color_p += x2 - act_x2; + color_p += x2 - act_x2; } } diff --git a/examples/lvgldemo/fbdev.h b/examples/lvgldemo/fbdev.h index 0df0f349e..24446d3aa 100644 --- a/examples/lvgldemo/fbdev.h +++ b/examples/lvgldemo/fbdev.h @@ -53,14 +53,15 @@ extern "C" ****************************************************************************/ int fbdev_init(void); -void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, - FAR const lv_color_t *color_p); -void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color); +void fbdev_flush(struct _disp_drv_t *disp_drv, const lv_area_t *area, + lv_color_t *color_p); +void fbdev_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, + lv_color_t color); void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, FAR const lv_color_t *color_p); #ifdef __cplusplus -} /* extern "C" */ +} #endif #endif /*__APPS_EXAMPLES_LVGLDEMO_FBDEV_H */