From bc0650ba223e9a3fec757a6cabf675d1030b8253 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Tue, 7 Jun 2022 18:46:29 -0400 Subject: [PATCH 1/2] fbdev: update debug output --- lv_drivers/display/fbdev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lv_drivers/display/fbdev.c b/lv_drivers/display/fbdev.c index d0378bcb..cc49995b 100644 --- a/lv_drivers/display/fbdev.c +++ b/lv_drivers/display/fbdev.c @@ -121,7 +121,15 @@ void fbdev_init(lv_disp_drv_t* disp_drv) fbdev_set_resolution(disp_drv); dbg( - "%dx%d, %dbpp,xres_virtual=%d,yres_virtual=%dvinfo.xoffset=%d,vinfo.yoffset=%d\n" + "finfo: smem_len=%d, xpanstep=%d, ypanstep=%d, ywrapstep=%d, line_length=%d" + , finfo.smem_len + , finfo.xpanstep + , finfo.ypanstep + , finfo.ywrapstep + , finfo.line_length + ); + dbg( + "vinfo: %dx%d, %dbpp, xres_virtual=%d, yres_virtual=%d, xoffset=%d, yoffset=%d\n" , vinfo.xres , vinfo.yres , vinfo.bits_per_pixel From c1c9a6d57222fcb68591035e822e5e3f8049fd2c Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Tue, 7 Jun 2022 18:46:44 -0400 Subject: [PATCH 2/2] fbdev: implement 32 bit conversion to 16 bit display --- lv_drivers/display/fbdev.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lv_drivers/display/fbdev.c b/lv_drivers/display/fbdev.c index cc49995b..1f7c9e99 100644 --- a/lv_drivers/display/fbdev.c +++ b/lv_drivers/display/fbdev.c @@ -191,6 +191,25 @@ void fbdev_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color } /*16 bit per pixel*/ else if(vinfo.bits_per_pixel == 16) { +#if LV_COLOR_DEPTH == 32 + uint16_t * fbp16 = (uint16_t *)fbp; + int32_t y; + int32_t x; + for(y = act_y1; y <= act_y2; y++) { + for(x = act_x1; x <= act_x2; x++) { + location = (x + vinfo.xoffset) + (y + vinfo.yoffset) * finfo.line_length / 2; + fbp16[location] = (uint16_t)( + // R, and 3 bits from G + ((color_p->ch.red & 0xf8) | (color_p->ch.green >> 5)) << 8 + // 3 bits from G, and B + | ((color_p->ch.green & 0x1c) << 3) | (color_p->ch.blue >> 3) + ); + color_p++; + } + + color_p += area->x2 - act_x2; + } +#else uint16_t * fbp16 = (uint16_t *)fbp; int32_t y; for(y = act_y1; y <= act_y2; y++) { @@ -198,6 +217,7 @@ void fbdev_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color memcpy(&fbp16[location], (uint32_t *)color_p, (act_x2 - act_x1 + 1) * 2); color_p += w; } +#endif } /*8 bit per pixel*/ else if(vinfo.bits_per_pixel == 8) {