Now that we have a damage tracking API, let's populate damage done by
vidconsole drivers. We try to declare as little memory as damaged as
possible, with the exception of rotated screens that I couldn't get my
head wrapped around. On those, we revert to the old behavior and mark
the full screen as damaged on every update.
Signed-off-by: Alexander Graf
Reported-by: Da Xue
---
v1 -> v2:
- Fix ranges in truetype target
- Limit rotate to necessary damange
---
drivers/video/console_normal.c | 10 ++
drivers/video/console_rotate.c | 54
drivers/video/console_truetype.c | 15 +
3 files changed, 79 insertions(+)
diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 04f022491e..5b5586fd3e 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -57,6 +57,9 @@ static int console_normal_set_row(struct udevice *dev, uint
row, int clr)
if (ret)
return ret;
+ video_damage(dev->parent, 0, VIDEO_FONT_HEIGHT * row, vid_priv->xsize,
+VIDEO_FONT_HEIGHT);
+
return 0;
}
@@ -76,6 +79,9 @@ static int console_normal_move_rows(struct udevice *dev, uint
rowdst,
if (ret)
return ret;
+ video_damage(dev->parent, 0, VIDEO_FONT_HEIGHT * rowdst,
vid_priv->xsize,
+VIDEO_FONT_HEIGHT * count);
+
return 0;
}
@@ -143,6 +149,10 @@ static int console_normal_putc_xy(struct udevice *dev,
uint x_frac, uint y,
}
line += vid_priv->line_length;
}
+
+ video_damage(dev->parent, VID_TO_PIXEL(x_frac), y, VIDEO_FONT_WIDTH,
+VIDEO_FONT_HEIGHT);
+
ret = vidconsole_sync_copy(dev, start, line);
if (ret)
return ret;
diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c
index 36c8d0609d..56e20bb4f3 100644
--- a/drivers/video/console_rotate.c
+++ b/drivers/video/console_rotate.c
@@ -57,6 +57,12 @@ static int console_set_row_1(struct udevice *dev, uint row,
int clr)
if (ret)
return ret;
+ video_damage(dev->parent,
+vid_priv->xsize - ((row + 1) * VIDEO_FONT_HEIGHT),
+0,
+VIDEO_FONT_HEIGHT,
+vid_priv->ysize);
+
return 0;
}
@@ -83,6 +89,12 @@ static int console_move_rows_1(struct udevice *dev, uint
rowdst, uint rowsrc,
dst += vid_priv->line_length;
}
+ video_damage(dev->parent,
+vid_priv->xsize - ((rowdst + count) * VIDEO_FONT_HEIGHT),
+0,
+count * VIDEO_FONT_HEIGHT,
+vid_priv->ysize);
+
return 0;
}
@@ -150,6 +162,12 @@ static int console_putc_xy_1(struct udevice *dev, uint
x_frac, uint y, char ch)
if (ret)
return ret;
+ video_damage(dev->parent,
+vid_priv->xsize - y - VIDEO_FONT_HEIGHT - 1,
+linenum - 1,
+VIDEO_FONT_HEIGHT,
+VIDEO_FONT_WIDTH);
+
return VID_TO_POS(VIDEO_FONT_WIDTH);
}
@@ -199,6 +217,12 @@ static int console_set_row_2(struct udevice *dev, uint
row, int clr)
if (ret)
return ret;
+ video_damage(dev->parent,
+0,
+vid_priv->ysize - (row + 1) * VIDEO_FONT_HEIGHT,
+vid_priv->xsize,
+VIDEO_FONT_HEIGHT);
+
return 0;
}
@@ -218,6 +242,12 @@ static int console_move_rows_2(struct udevice *dev, uint
rowdst, uint rowsrc,
vidconsole_memmove(dev, dst, src,
VIDEO_FONT_HEIGHT * vid_priv->line_length * count);
+ video_damage(dev->parent,
+0,
+vid_priv->ysize - (rowdst + count) * VIDEO_FONT_HEIGHT,
+vid_priv->xsize,
+count * VIDEO_FONT_HEIGHT);
+
return 0;
}
@@ -288,6 +318,12 @@ static int console_putc_xy_2(struct udevice *dev, uint
x_frac, uint y, char ch)
if (ret)
return ret;
+ video_damage(dev->parent,
+x - VIDEO_FONT_WIDTH,
+linenum - VIDEO_FONT_HEIGHT + 1,
+VIDEO_FONT_WIDTH,
+VIDEO_FONT_HEIGHT);
+
return VID_TO_POS(VIDEO_FONT_WIDTH);
}
@@ -335,6 +371,12 @@ static int console_set_row_3(struct udevice *dev, uint
row, int clr)
if (ret)
return ret;
+ video_damage(dev->parent,
+row * VIDEO_FONT_HEIGHT,
+0,
+VIDEO_FONT_HEIGHT,
+vid_priv->ysize);
+
return 0;
}
@@ -359,6 +401,12 @@ static int console_move_rows_3(struct udevice *dev, uint
rowdst, uint rowsrc,
dst += vid_priv->line_length;
}
+ video_damage(dev->parent,