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

Simon Glass sjg at chromium.org
Sat Apr 1 18:05:41 UTC 2017


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 at chromium.org>
Acked-by: Anatolij Gustschin <agust at 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 --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;
-- 
2.12.2.564.g063fe858b8-goog



More information about the U-Boot mailing list