]> git.sur5r.net Git - u-boot/commitdiff
dm: video: correctly clean background in 16bit mode
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Thu, 8 Feb 2018 20:47:10 +0000 (21:47 +0100)
committerAnatolij Gustschin <agust@denx.de>
Tue, 6 Mar 2018 09:01:40 +0000 (10:01 +0100)
In 16 bit mode we have to copy two bytes per pixels repeatedly and not
four. Otherwise we will see a striped pattern.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/video/video-uclass.c

index dcaceed42c4e66821133fad83136c9aaf1b78b69..9a980ea3a1d571450c5e346265899b51fba556ae 100644 (file)
@@ -91,14 +91,26 @@ void video_clear(struct udevice *dev)
 {
        struct video_priv *priv = dev_get_uclass_priv(dev);
 
-       if (priv->bpix == VIDEO_BPP32) {
+       switch (priv->bpix) {
+       case VIDEO_BPP16: {
+               u16 *ppix = priv->fb;
+               u16 *end = priv->fb + priv->fb_size;
+
+               while (ppix < end)
+                       *ppix++ = priv->colour_bg;
+               break;
+       }
+       case VIDEO_BPP32: {
                u32 *ppix = priv->fb;
                u32 *end = priv->fb + priv->fb_size;
 
                while (ppix < end)
                        *ppix++ = priv->colour_bg;
-       } else {
+               break;
+       }
+       default:
                memset(priv->fb, priv->colour_bg, priv->fb_size);
+               break;
        }
 }