At present we clear many more bytes than we should on 16bpp and 32bpp
displays. The number of pixels to clear is currently calculated as the
line length (in bytes) multiplied by the number of lines to clear. This
is only correct for 8bpp displays.

Correct the calculation to use the number of text columns multiplied by
the width of each character multiplied by the number of lines to clear.

Signed-off-by: Simon Glass <s...@chromium.org>
---

Changes in v4: None
Changes in v3: None

 drivers/video/console_normal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 89a55dd11df..744345d58e4 100644
--- a/drivers/video/console_normal.c
+++ b/drivers/video/console_normal.c
@@ -16,9 +16,10 @@
 
 static int console_normal_set_row(struct udevice *dev, uint row, int clr)
 {
+       struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
        struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
        void *line;
-       int pixels = VIDEO_FONT_HEIGHT * vid_priv->line_length;
+       int pixels = VIDEO_FONT_HEIGHT * vc_priv->cols * VIDEO_FONT_WIDTH;
        int i;
 
        line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
-- 
2.11.0.483.g087da7b7c-goog

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to