Skip to content

Commit

Permalink
arm64/pinephone: Fix missing pixels in Frame Buffer Driver
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lupyuen authored and xiaoxiang781216 committed Dec 30, 2022
1 parent 75631e6 commit 991fd3d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions boards/arm64/a64/pinephone/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
47 changes: 47 additions & 0 deletions boards/arm64/a64/pinephone/src/pinephone_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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,
Expand Down Expand Up @@ -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
*
Expand Down

0 comments on commit 991fd3d

Please sign in to comment.