mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-17 22:28:17 +01:00
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>
This commit is contained in:
parent
820b5894c1
commit
50d562c01f
@ -126,7 +126,7 @@ int video_reserve(ulong *addrp)
|
|||||||
return 0;
|
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);
|
struct video_priv *priv = dev_get_uclass_priv(dev);
|
||||||
int ret;
|
int ret;
|
||||||
@ -138,7 +138,7 @@ int video_clear(struct udevice *dev)
|
|||||||
u16 *end = priv->fb + priv->fb_size;
|
u16 *end = priv->fb + priv->fb_size;
|
||||||
|
|
||||||
while (ppix < end)
|
while (ppix < end)
|
||||||
*ppix++ = priv->colour_bg;
|
*ppix++ = colour;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case VIDEO_BPP32:
|
case VIDEO_BPP32:
|
||||||
@ -147,11 +147,11 @@ int video_clear(struct udevice *dev)
|
|||||||
u32 *end = priv->fb + priv->fb_size;
|
u32 *end = priv->fb + priv->fb_size;
|
||||||
|
|
||||||
while (ppix < end)
|
while (ppix < end)
|
||||||
*ppix++ = priv->colour_bg;
|
*ppix++ = colour;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
memset(priv->fb, priv->colour_bg, priv->fb_size);
|
memset(priv->fb, colour, priv->fb_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size);
|
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);
|
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] = {
|
static const struct vid_rgb colours[VID_COLOUR_COUNT] = {
|
||||||
{ 0x00, 0x00, 0x00 }, /* black */
|
{ 0x00, 0x00, 0x00 }, /* black */
|
||||||
{ 0xc0, 0x00, 0x00 }, /* red */
|
{ 0xc0, 0x00, 0x00 }, /* red */
|
||||||
|
@ -185,13 +185,22 @@ u32 video_index_to_colour(struct video_priv *priv, unsigned int idx);
|
|||||||
int video_reserve(ulong *addrp);
|
int video_reserve(ulong *addrp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_clear() - Clear a device's frame buffer to background color.
|
* video_clear() - Clear a device's frame buffer to background colour.
|
||||||
*
|
*
|
||||||
* @dev: Device to clear
|
* @dev: Device to clear
|
||||||
* Return: 0
|
* Return: 0 on success
|
||||||
*/
|
*/
|
||||||
int video_clear(struct udevice *dev);
|
int video_clear(struct udevice *dev);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video_fill() - Fill a device's frame buffer to a colour.
|
||||||
|
*
|
||||||
|
* @dev: Device to fill
|
||||||
|
* @colour: Colour to use, in the frame buffer's format
|
||||||
|
* Return: 0 on success
|
||||||
|
*/
|
||||||
|
int video_fill(struct udevice *dev, u32 colour);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_sync() - Sync a device's frame buffer with its hardware
|
* video_sync() - Sync a device's frame buffer with its hardware
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user