apps/examples/lvgldemo: Update fb flush callback for LVGL V6.1.2

Signed-off-by: Qi Huang <huangqi3@xiaomi.com>
Change-Id: I72a6ff628f2ea2b0b505e444c84b266ba3a28d87
This commit is contained in:
Qi Huang 2020-04-07 01:00:56 +00:00 committed by Alan Carvalho de Assis
parent 20f3db7317
commit 25876e8222
2 changed files with 44 additions and 39 deletions

View File

@ -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;
}
}

View File

@ -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 */