aboutsummaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorSimon Glass2022-10-06 08:36:08 -0600
committerAnatolij Gustschin2022-10-30 20:01:40 +0100
commit50d562c01ff0a9f500ed9821a74e841d6f6dc133 (patch)
treeeeceaec92a479ba0646c40b94e25d3199679547f /drivers/video
parent820b5894c183c4b68798603f5a96412408e6b8cf (diff)
video: Allow filling the display with a colour
Generalise the video_clear() function to allow filling with a different colour. Tidy up the comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/video-uclass.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index b258a8a00fc..9f22da02528 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -126,7 +126,7 @@ int video_reserve(ulong *addrp)
return 0;
}
-int video_clear(struct udevice *dev)
+int video_fill(struct udevice *dev, u32 colour)
{
struct video_priv *priv = dev_get_uclass_priv(dev);
int ret;
@@ -138,7 +138,7 @@ int video_clear(struct udevice *dev)
u16 *end = priv->fb + priv->fb_size;
while (ppix < end)
- *ppix++ = priv->colour_bg;
+ *ppix++ = colour;
break;
}
case VIDEO_BPP32:
@@ -147,11 +147,11 @@ int video_clear(struct udevice *dev)
u32 *end = priv->fb + priv->fb_size;
while (ppix < end)
- *ppix++ = priv->colour_bg;
+ *ppix++ = colour;
break;
}
default:
- memset(priv->fb, priv->colour_bg, priv->fb_size);
+ memset(priv->fb, colour, priv->fb_size);
break;
}
ret = video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size);
@@ -161,6 +161,18 @@ int video_clear(struct udevice *dev)
return video_sync(dev, false);
}
+int video_clear(struct udevice *dev)
+{
+ struct video_priv *priv = dev_get_uclass_priv(dev);
+ int ret;
+
+ ret = video_fill(dev, priv->colour_bg);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static const struct vid_rgb colours[VID_COLOUR_COUNT] = {
{ 0x00, 0x00, 0x00 }, /* black */
{ 0xc0, 0x00, 0x00 }, /* red */