diff mbox

[U-Boot,v5,04/19] dm: video: Correct line clearing code

Message ID 20170401180556.2416-5-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass April 1, 2017, 6:05 p.m. UTC
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 <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
---

Changes in v5: None
Changes in v4: None
Changes in v3: None

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

Patch

diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c
index 89a55dd11d..744345d58e 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;