[PATCH 2/3] video: fbconsole: add optional damage tracking

Sascha Hauer sha at pengutronix.de
Wed Apr 5 04:13:56 PDT 2023


On Mon, Apr 03, 2023 at 02:18:43PM +0200, Philipp Zabel wrote:
> Annotate framebuffer updates with damage rectangles so drivers may
> implement partial updates for displays with an integrated framebuffer.
> 
> Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
> ---
>  drivers/video/fbconsole.c | 32 ++++++++++++++++++++++++++++----
>  1 file changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
> index 070378aa2352..25d7ea685ff6 100644
> --- a/drivers/video/fbconsole.c
> +++ b/drivers/video/fbconsole.c
> @@ -18,6 +18,7 @@ enum state_t {
>  struct fbc_priv {
>  	struct console_device cdev;
>  	struct fb_info *fb;
> +	struct fb_rect rect;
>  
>  	struct screen *sc;
>  
> @@ -60,9 +61,11 @@ static int fbc_tstc(struct console_device *cdev)
>  static void cls(struct fbc_priv *priv)
>  {
>  	void *buf = gui_screen_render_buffer(priv->sc);
> +	struct fb_info *fb = priv->fb;
>  
>  	memset(buf, 0, priv->fb->line_length * priv->fb->yres);
>  	gu_screen_blit(priv->sc);
> +	fb_damage(fb, &priv->rect);
>  }
>  
>  struct rgb {
> @@ -139,13 +142,20 @@ static void drawchar(struct fbc_priv *priv, int x, int y, int c)
>  static void video_invertchar(struct fbc_priv *priv, int x, int y)
>  {
>  	void *buf;
> +	struct fb_rect rect;
> +
> +	rect.x1 = x * priv->font->width;
> +	rect.y1 = y * priv->font->height;
> +	rect.x2 = rect.x1 + priv->font->width;
> +	rect.y2 = rect.y1 + priv->font->height;
>  
>  	buf = gui_screen_render_buffer(priv->sc);
>  
> -	gu_invert_area(priv->fb, buf, x * priv->font->width, y * priv->font->height,
> +	gu_invert_area(priv->fb, buf, rect.x1, rect.y1,
>  			priv->font->width, priv->font->height);
> -	gu_screen_blit_area(priv->sc, x * priv->font->width, y * priv->font->height,
> +	gu_screen_blit_area(priv->sc, rect.x1, rect.y1,
>  			priv->font->width, priv->font->height);
> +	fb_damage(priv->fb, &rect);

Does it make sense to call fb_damage() from gu_screen_blit_area() and
gu_screen_blit() instead?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list