video: Provide a way to clear part of the console
This is useful when the background colour must be written before text
is updated, to avoid strange display artifacts.
Add a function for this, using the existing code from the truetype
console.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 1b66a80..d304e92 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -142,6 +142,58 @@
return 0;
}
+int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
+ int yend, u32 colour)
+{
+ struct video_priv *priv = dev_get_uclass_priv(dev);
+ void *start, *line;
+ int pixels = xend - xstart;
+ int row, i, ret;
+
+ start = priv->fb + ystart * priv->line_length;
+ start += xstart * VNBYTES(priv->bpix);
+ line = start;
+ for (row = ystart; row < yend; row++) {
+ switch (priv->bpix) {
+ case VIDEO_BPP8: {
+ u8 *dst = line;
+
+ if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
+ for (i = 0; i < pixels; i++)
+ *dst++ = colour;
+ }
+ break;
+ }
+ case VIDEO_BPP16: {
+ u16 *dst = line;
+
+ if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
+ for (i = 0; i < pixels; i++)
+ *dst++ = colour;
+ }
+ break;
+ }
+ case VIDEO_BPP32: {
+ u32 *dst = line;
+
+ if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
+ for (i = 0; i < pixels; i++)
+ *dst++ = colour;
+ }
+ break;
+ }
+ default:
+ return -ENOSYS;
+ }
+ line += priv->line_length;
+ }
+ ret = video_sync_copy(dev, start, line);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
int video_fill(struct udevice *dev, u32 colour)
{
struct video_priv *priv = dev_get_uclass_priv(dev);