From 3002b31da23f9022fd8704fb9f520de9f1485e8d Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Wed, 5 Apr 2023 14:27:33 +0200
Subject: graphic_utils: add optional damage tracking
Annotate framebuffer updates with damage rectangles so drivers may
implement partial updates for displays with an integrated framebuffer.
This can speed up fbconsole.
Signed-off-by: Philipp Zabel
Link: https://lore.barebox.org/20230405122734.2348025-2-p.zabel@pengutronix.de
Signed-off-by: Sascha Hauer
---
lib/gui/graphic_utils.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
(limited to 'lib')
diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index 92f249e722..d91a7f3550 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -313,6 +313,12 @@ void gu_screen_blit_area(struct screen *sc, int startx, int starty, int width,
{
struct fb_info *info = sc->info;
int bpp = info->bits_per_pixel >> 3;
+ struct fb_rect rect = {
+ .x1 = startx,
+ .y1 = starty,
+ .x2 = startx + width,
+ .y2 = starty + height,
+ };
if (info->screen_base_shadow) {
int y;
@@ -325,14 +331,24 @@ void gu_screen_blit_area(struct screen *sc, int startx, int starty, int width,
fboff += sc->info->line_length;
}
}
+
+ fb_damage(info, &rect);
}
void gu_screen_blit(struct screen *sc)
{
struct fb_info *info = sc->info;
+ struct fb_rect rect = {
+ .x1 = 0,
+ .y1 = 0,
+ .x2 = info->xres,
+ .y2 = info->yres,
+ };
if (info->screen_base_shadow)
memcpy(info->screen_base, info->screen_base_shadow, sc->fbsize);
+
+ fb_damage(info, &rect);
}
void gu_fill_rectangle(struct screen *sc,
--
cgit v1.2.1