arm64/pinephone: Fix missing pixels in Frame Buffer Driver

This PR fixes the missing pixels in the rendered output of the Frame Buffer Driver for PINE64 PinePhone.

We fix this by copying the RAM Frame Buffer to itself on Frame Buffer Update `FBIO_UPDATE`, which will refresh the display correctly over DMA / Display Engine / Timing Controller TCON0.

### Modified Files

`boards/arm64/a64/pinephone/Kconfig`: Add requirement for Frame Buffer Update `FB_UPDATE` for PinePhone LCD Display

`boards/arm64/a64/pinephone/src/pinephone_display.c`: Implement Frame Buffer Update `FBIO_UPDATE` by copying the RAM Frame Buffer to itself
This commit is contained in:
Lee Lup Yuen 2022-12-29 08:12:40 +08:00 committed by Xiang Xiao
parent 75631e6169
commit 991fd3d887
2 changed files with 48 additions and 0 deletions

View File

@ -13,6 +13,7 @@ config PINEPHONE_LCD
select DRIVERS_VIDEO
select VIDEO_FB
select FB_OVERLAY
select FB_UPDATE
---help---
Select to enable support for LCD Display.

View File

@ -92,6 +92,9 @@ static int pinephone_getoverlayinfo(struct fb_vtable_s *vtable,
int overlayno,
struct fb_overlayinfo_s *oinfo);
static int pinephone_updatearea(struct fb_vtable_s *vtable,
const struct fb_area_s *area);
static int pinephone_settransp(struct fb_vtable_s *vtable,
const struct fb_overlayinfo_s *oinfo);
@ -117,6 +120,7 @@ static struct fb_vtable_s g_pinephone_vtable =
{
.getvideoinfo = pinephone_getvideoinfo,
.getplaneinfo = pinephone_getplaneinfo,
.updatearea = pinephone_updatearea,
.getoverlayinfo = pinephone_getoverlayinfo,
.settransp = pinephone_settransp,
.setchromakey = pinephone_setchromakey,
@ -465,6 +469,49 @@ static int pinephone_getoverlayinfo(struct fb_vtable_s *vtable,
return -EINVAL;
}
/****************************************************************************
* Name: pinephone_updatearea
*
* Description:
* Update the display when there is a change to the framebuffer. (ioctl
* Entrypoint: FBIO_UPDATE)
*
* Input Parameters:
* vtable - Framebuffer driver object
* area - Updated area of framebuffer
*
* Returned Value:
* Zero (OK) on success; a negated errno value is returned on any failure.
*
****************************************************************************/
static int pinephone_updatearea(struct fb_vtable_s *vtable,
const struct fb_area_s *area)
{
int i;
uint8_t *fb = (uint8_t *)g_pinephone_fb0;
const size_t fbsize = sizeof(g_pinephone_fb0);
DEBUGASSERT(vtable != NULL && vtable == &g_pinephone_vtable &&
area != NULL);
ginfo("vtable=%p, area=%p\n", vtable, area);
/* Copy the entire framebuffer to itself, to fix the missing pixels.
* Not sure why this works.
*/
for (i = 0; i < fbsize; i++)
{
/* Declare as volatile to prevent compiler optimization */
volatile uint8_t v = fb[i];
fb[i] = v;
}
return OK;
}
/****************************************************************************
* Name: pinephone_settransp
*