drivers/lcd_framebuffer: Optimize updateearea for the full screan case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-07-01 08:19:30 +08:00 committed by Petro Karashchenko
parent 9a4f494da2
commit 881902d2cd
1 changed files with 62 additions and 47 deletions

View File

@ -164,19 +164,17 @@ static int lcdfb_updateearea(FAR struct fb_vtable_s *vtable,
{
FAR struct lcdfb_dev_s *priv = (FAR struct lcdfb_dev_s *)vtable;
FAR struct lcd_planeinfo_s *pinfo = &priv->pinfo;
FAR uint8_t *run;
FAR uint8_t *run = priv->fbmem;
fb_coord_t row;
fb_coord_t startx;
fb_coord_t endx;
fb_coord_t width;
fb_coord_t starty;
fb_coord_t endy;
fb_coord_t startx = 0;
fb_coord_t endx = priv->xres - 1;
fb_coord_t width = priv->xres;
fb_coord_t starty = 0;
fb_coord_t endy = priv->yres - 1;
int ret;
DEBUGASSERT(area != NULL);
DEBUGASSERT(area->w >= 1);
DEBUGASSERT(area->h >= 1);
if (area != NULL)
{
/* Clip to fit in the framebuffer */
startx = area->x;
@ -203,8 +201,9 @@ static int lcdfb_updateearea(FAR struct fb_vtable_s *vtable,
endy = priv->yres - 1;
}
/* If the display uses a value of BPP < 8, then we may have to extend the
* rectangle on the left so that it is byte aligned. Works for BPP={1,2,4}
/* If the display uses a value of BPP < 8, then we may have to extend
* the rectangle on the left so that it is byte aligned. Works for
* BPP={1,2,4}
*/
if (pinfo->bpp < 8)
@ -219,6 +218,22 @@ static int lcdfb_updateearea(FAR struct fb_vtable_s *vtable,
run = priv->fbmem + starty * priv->stride;
run += (startx * pinfo->bpp + 7) >> 3;
}
/* Update the whole screen? */
if (startx == 0 && endx == priv->xres - 1 &&
starty == 0 && endy == priv->yres - 1)
{
/* Yes, LCD driver support putarea callback? */
if (pinfo->putarea != NULL)
{
/* Yes, go the fast path */
return pinfo->putarea(pinfo->dev, starty, endy, startx, endx, run);
}
}
for (row = starty; row <= endy; row++)
{