Skip to contentSkip to conversation

vidconsole: refactoring and support for wider fonts

PATCH Superseded Dzmitry Sankouski 4 participants 23 messages Dec 26, 2022 – Feb 13, 2023 Framebuffer layer

v1 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

cover vidconsole: refactoring and support for wider fonts

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

This patch series aims to add wider fonts for devices with high ppi.

Add 16x32 ter font from linux, and allow font size configuration. Use new font in starqltechn board.

Note: Only tested with 32BPP configuration. 8BPP and 16BPP testing may needed. I cannot do it, because I don't have such devices.

Dzmitry Sankouski (5):
video console: unite normal and rotated files video console: refactoring and optimization video console: add support for fonts wider than 1 byte video console: add 16x32 ter font from linux video console: remove unused 4x6 font

 configs/starqltechn_defconfig                 |    1 +
 drivers/video/Kconfig                         |   25 +-
 drivers/video/Makefile                        |    3 +-
 drivers/video/console_normal.c                |  178 --
 .../{console_rotate.c => console_simple.c}    |  497 ++--
 include/video_font.h                          |    6 +-
 include/video_font_4x6.h                      | 2153 -----------------
 include/video_font_data.h                     |    2 +
 include/video_font_ter16x32.h                 | 2068 ++++++++++++++++
 9 files changed, 2361 insertions(+), 2572 deletions(-)
 delete mode 100644 drivers/video/console_normal.c
 rename drivers/video/{console_rotate.c => console_simple.c} (53%)
 delete mode 100644 include/video_font_4x6.h
 create mode 100644 include/video_font_ter16x32.h
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/5 video console: unite normal and rotated files

Put video console driver code in one file.

---
 drivers/video/Kconfig                         |   8 +-
 drivers/video/Makefile                        |   3 +-
 drivers/video/console_normal.c                | 178 ------------------
 .../{console_rotate.c => console_simple.c}    | 166 ++++++++++++++++
 4 files changed, 171 insertions(+), 184 deletions(-)
 delete mode 100644 drivers/video/console_normal.c
 rename drivers/video/{console_rotate.c => console_simple.c} (75%)
drivers/video/Kconfig +4 -4
index c841b99bb3..bc7f20cf64 100644
@@ -124,17 +124,17 @@ config VIDEO_MIPI_DSI
 	  The MIPI Display Serial Interface (MIPI DSI) defines a high-speed
 	  serial interface between a host processor and a display module.
 
-config CONSOLE_NORMAL
+config VIDEO_CONSOLE
 	bool "Support a simple text console"
 	default y
 	help
 	  Support drawing text on the frame buffer console so that it can be
-	  used as a console. Rotation is not supported by this driver (see
-	  CONFIG_CONSOLE_ROTATION for that). A built-in 8x16 font is used
-	  for the display.
+	  used as a console. See CONFIG_CONSOLE_ROTATION for rotation support.
+	  A built-in 8x16 font is used for the display.
 
 config CONSOLE_ROTATION
 	bool "Support rotated displays"
+	depends on VIDEO_CONSOLE
 	help
 	  Sometimes, for example if the display is mounted in portrait
 	  mode or even if it's mounted landscape but rotated by 180degree,
drivers/video/Makefile +1 -2
index 40a871d638..75decf707d 100644
@@ -7,8 +7,7 @@ ifdef CONFIG_DM
 obj-$(CONFIG_BACKLIGHT) += backlight-uclass.o
 obj-$(CONFIG_BACKLIGHT_GPIO) += backlight_gpio.o
 obj-$(CONFIG_BACKLIGHT_PWM) += pwm_backlight.o
-obj-$(CONFIG_CONSOLE_NORMAL) += console_normal.o
-obj-$(CONFIG_CONSOLE_ROTATION) += console_rotate.o
+obj-$(CONFIG_VIDEO_CONSOLE) += console_simple.o
 obj-$(CONFIG_CONSOLE_TRUETYPE) += console_truetype.o fonts/
 obj-$(CONFIG_DISPLAY) += display-uclass.o
 obj-$(CONFIG_VIDEO_MIPI_DSI) += dsi-host-uclass.o
drivers/video/console_normal.c deleted +0 -178

178 lines not on this page · raw message

drivers/video/console_simple.c renamed from drivers/video/console_rotate.c +166 -0

175 lines not on this page · raw message

Signature · 1 line
2.30.2
#2 lore raw

Re: [PATCH 1/5] video console: unite normal and rotated files

Hi Dzmitry,

Quoted 2 lines · Dzmitry Sankouski

Put video console driver code in one file.

This isn't quite true as we still have TrueType.

Also, what combine them?

Quoted 10 lines
---
 drivers/video/Kconfig                         |   8 +-
 drivers/video/Makefile                        |   3 +-
 drivers/video/console_normal.c                | 178 ------------------
 .../{console_rotate.c => console_simple.c}    | 166 ++++++++++++++++
 4 files changed, 171 insertions(+), 184 deletions(-)
 delete mode 100644 drivers/video/console_normal.c
 rename drivers/video/{console_rotate.c => console_simple.c} (75%)

Regards,
Simon

#3 lore raw

Re: [PATCH 1/5] video console: unite normal and rotated files

I'll reword the commit description. Files contain similar logic, and common code may be extracted after putting it together.

пт, 30 дек. 2022 г. в 01:41, Simon Glass <[email protected]>:

Quoted 24 lines

Hi Dzmitry,

Quoted 2 lines · Dzmitry Sankouski

Put video console driver code in one file.

This isn't quite true as we still have TrueType.

Also, what combine them?

Quoted 10 lines
---
 drivers/video/Kconfig                         |   8 +-
 drivers/video/Makefile                        |   3 +-
 drivers/video/console_normal.c                | 178 ------------------
 .../{console_rotate.c => console_simple.c}    | 166 ++++++++++++++++
 4 files changed, 171 insertions(+), 184 deletions(-)
 delete mode 100644 drivers/video/console_normal.c
 rename drivers/video/{console_rotate.c => console_simple.c} (75%)

Regards,
Simon

#4 lore raw

PATCH 2/5 video console: refactoring and optimization

In reply to Dzmitry Sankouski

- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

---
 drivers/video/console_simple.c | 508 ++++++++++++---------------------
 1 file changed, 184 insertions(+), 324 deletions(-)
drivers/video/console_simple.c +184 -324
index a4b3cfe3d8..20087a30af 100644
@@ -3,6 +3,7 @@
  * Copyright (c) 2015 Google, Inc
  * (C) Copyright 2015
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
+ * (C) Copyright 2023 Dzmitry Sankouski <[email protected]>
  */
 
 #include <common.h>
@@ -11,46 +12,137 @@
 #include <video_console.h>
 #include <video_font.h>		/* Get font data, width and height */
 
-static int console_normal_set_row(struct udevice *dev, uint row, int clr)
+#define FLIPPED_DIRECTION 1
+#define NORMAL_DIRECTION 0
+
+static int check_bpix_support(int bpix)
+{
+	switch (bpix) {
+	case VIDEO_BPP8:
+		if (IS_ENABLED(CONFIG_VIDEO_BPP8))
+			return 0;
+	case VIDEO_BPP16:
+		if (IS_ENABLED(CONFIG_VIDEO_BPP16))
+			return 0;
+	case VIDEO_BPP32:
+		if (IS_ENABLED(CONFIG_VIDEO_BPP32))
+			return 0;
+	default:
+		return -ENOSYS;
+	}
+}
+
+static inline int fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, bool go_down)
+{
+	u8 *dst_byte = *dstp;
+
+	if (pbytes == 4) {
+		u32 *dst = *dstp;
+		*dst = value;
+	}
+	if (pbytes == 2) {
+		u16 *dst = *dstp;
+		*dst = value;
+	}
+	if (pbytes == 1) {
+		u8 *dst = *dstp;
+		*dst = value;
+	}
+	if (go_down)
+		*dstp = dst_byte - pbytes;
+	else
+		*dstp = dst_byte + pbytes;
+	return 0;
+}
+
+#if (CONFIG_IS_ENABLED(CONSOLE_ROTATION))
+static int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_priv,
+				  bool direction)
 {
-	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
-	void *line, *end;
-	int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
 	int ret;
-	int i;
+	void *dst;
+	u8 mask = 0x80;
 
-	line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
-	switch (vid_priv->bpix) {
-	case VIDEO_BPP8:
-		if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-			uint8_t *dst = line;
+	ret = check_bpix_support(vid_priv->bpix);
+	if (ret)
+		return ret;
 
-			for (i = 0; i < pixels; i++)
-				*dst++ = clr;
-			end = dst;
-			break;
-		}
-	case VIDEO_BPP16:
-		if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-			uint16_t *dst = line;
+	for (int col = 0; col < VIDEO_FONT_WIDTH; col++) {
+		dst = *line;
+		for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+			u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?
+						vid_priv->colour_fg :
+						vid_priv->colour_bg;
 
-			for (i = 0; i < pixels; i++)
-				*dst++ = clr;
-			end = dst;
-			break;
+			ret = fill_pixel_and_goto_next(&dst,
+						       value,
+						       VNBYTES(vid_priv->bpix),
+						       direction
+			);
 		}
-	case VIDEO_BPP32:
-		if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-			uint32_t *dst = line;
+		if (direction)
+			*line += vid_priv->line_length;
+		else
+			*line -= vid_priv->line_length;
+		mask >>= 1;
+	}
+	return ret;
+}
+#endif
 
-			for (i = 0; i < pixels; i++)
-				*dst++ = clr;
-			end = dst;
-			break;
+static int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv,
+				bool direction)
+{
+	int ret;
+	void *dst;
+
+	ret = check_bpix_support(vid_priv->bpix);
+	if (ret)
+		return ret;
+	for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+		dst = *line;
+		uchar bits = pfont[row];
+
+		for (int i = 0; i < VIDEO_FONT_WIDTH; i++) {
+			u32 value = (bits & 0x80) ?
+				vid_priv->colour_fg :
+				vid_priv->colour_bg;
+
+			ret = fill_pixel_and_goto_next(&dst,
+						       value,
+						       VNBYTES(vid_priv->bpix),
+						       direction
+			);
+			bits <<= 1;
 		}
-	default:
-		return -ENOSYS;
+		if (direction)
+			*line -= vid_priv->line_length;
+		else
+			*line += vid_priv->line_length;
 	}
+	return ret;
+}
+
+static int console_set_row(struct udevice *dev, uint row, int clr)
+{
+	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
+	void *line, *dst, *end;
+	int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
+	int ret;
+	int i;
+	int pbytes;
+
+	ret = check_bpix_support(vid_priv->bpix);
+	if (ret)
+		return ret;
+
+	line = vid_priv->fb + row * VIDEO_FONT_HEIGHT * vid_priv->line_length;
+	dst = line;
+	pbytes = VNBYTES(vid_priv->bpix);
+	for (i = 0; i < pixels; i++)
+		fill_pixel_and_goto_next(&dst, clr, pbytes, NORMAL_DIRECTION);
+	end = dst;
+
 	ret = vidconsole_sync_copy(dev, line, end);
 	if (ret)
 		return ret;
@@ -58,8 +150,8 @@ static int console_normal_set_row(struct udevice *dev, uint row, int clr)
 	return 0;
 }
 
-static int console_normal_move_rows(struct udevice *dev, uint rowdst,
-				     uint rowsrc, uint count)
+static int console_move_rows(struct udevice *dev, uint rowdst,
+			     uint rowsrc, uint count)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
 	void *dst;
@@ -77,70 +169,30 @@ static int console_normal_move_rows(struct udevice *dev, uint rowdst,
 	return 0;
 }
 
-static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
-				  char ch)
+static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)
 {
 	struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
 	struct udevice *vid = dev->parent;
 	struct video_priv *vid_priv = dev_get_uclass_priv(vid);
-	int i, row;
-	void *start;
-	void *line;
-	int ret;
+	int pbytes = VNBYTES(vid_priv->bpix);
+	int x, linenum, ret;
+	void *start, *line;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 
-	start = vid_priv->fb + y * vid_priv->line_length +
-		VID_TO_PIXEL(x_frac) * VNBYTES(vid_priv->bpix);
+	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
+		return -EAGAIN;
+	linenum = y;
+	x = VID_TO_PIXEL(x_frac);
+	start = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes;
 	line = start;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
 
-	for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
-		unsigned int idx = (u8)ch * VIDEO_FONT_HEIGHT + row;
-		uchar bits = video_fontdata[idx];
-
-		switch (vid_priv->bpix) {
-		case VIDEO_BPP8:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-				uint8_t *dst = line;
+	ret = fill_char_vertically(pfont, &line, vid_priv, NORMAL_DIRECTION);
+	if (ret)
+		return ret;
 
-				for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
-					*dst++ = (bits & 0x80) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-					bits <<= 1;
-				}
-				break;
-			}
-		case VIDEO_BPP16:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-				uint16_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
-					*dst++ = (bits & 0x80) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-					bits <<= 1;
-				}
-				break;
-			}
-		case VIDEO_BPP32:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-				uint32_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
-					*dst++ = (bits & 0x80) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-					bits <<= 1;
-				}
-				break;
-			}
-		default:
-			return -ENOSYS;
-		}
-		line += vid_priv->line_length;
-	}
 	ret = vidconsole_sync_copy(dev, start, line);
 	if (ret)
 		return ret;
@@ -148,7 +200,7 @@ static int console_normal_putc_xy(struct udevice *dev, uint x_frac, uint y,
 	return VID_TO_POS(VIDEO_FONT_WIDTH);
 }
 
-static int console_normal_probe(struct udevice *dev)
+static int console_probe(struct udevice *dev)
 {
 	struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
 	struct udevice *vid_dev = dev->parent;
@@ -162,25 +214,25 @@ static int console_normal_probe(struct udevice *dev)
 	return 0;
 }
 
-struct vidconsole_ops console_normal_ops = {
-	.putc_xy	= console_normal_putc_xy,
-	.move_rows	= console_normal_move_rows,
-	.set_row	= console_normal_set_row,
+struct vidconsole_ops console_ops = {
+	.putc_xy	= console_putc_xy,
+	.move_rows	= console_move_rows,
+	.set_row	= console_set_row,
 };
 
 U_BOOT_DRIVER(vidconsole_normal) = {
 	.name	= "vidconsole0",
 	.id	= UCLASS_VIDEO_CONSOLE,
-	.ops	= &console_normal_ops,
-	.probe	= console_normal_probe,
+	.ops	= &console_ops,
+	.probe	= console_probe,
 };
 
-#if defined(CONFIG_CONSOLE_ROTATION)
+#if (CONFIG_IS_ENABLED(CONSOLE_ROTATION))
 static int console_set_row_1(struct udevice *dev, uint row, int clr)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
 	int pbytes = VNBYTES(vid_priv->bpix);
-	void *start, *line;
+	void *start, *dst, *line;
 	int i, j;
 	int ret;
 
@@ -188,34 +240,9 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr)
 		(row + 1) * VIDEO_FONT_HEIGHT * pbytes;
 	line = start;
 	for (j = 0; j < vid_priv->ysize; j++) {
-		switch (vid_priv->bpix) {
-		case VIDEO_BPP8:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-				uint8_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-					*dst++ = clr;
-				break;
-			}
-		case VIDEO_BPP16:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-				uint16_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-					*dst++ = clr;
-				break;
-			}
-		case VIDEO_BPP32:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-				uint32_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-					*dst++ = clr;
-				break;
-			}
-		default:
-			return -ENOSYS;
-		}
+		dst = line;
+		for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
+			fill_pixel_and_goto_next(&dst, clr, pbytes, NORMAL_DIRECTION);
 		line += vid_priv->line_length;
 	}
 	ret = vidconsole_sync_copy(dev, start, line);
@@ -226,7 +253,7 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr)
 }
 
 static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc,
-			       uint count)
+				   uint count)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
 	int pbytes = VNBYTES(vid_priv->bpix);
@@ -241,7 +268,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc,
 
 	for (j = 0; j < vid_priv->ysize; j++) {
 		ret = vidconsole_memmove(dev, dst, src,
-					 VIDEO_FONT_HEIGHT * pbytes * count);
+					VIDEO_FONT_HEIGHT * pbytes * count);
 		if (ret)
 			return ret;
 		src += vid_priv->line_length;
@@ -256,60 +283,22 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch)
 	struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
 	struct udevice *vid = dev->parent;
 	struct video_priv *vid_priv = dev_get_uclass_priv(vid);
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 	int pbytes = VNBYTES(vid_priv->bpix);
-	int i, col, x, linenum, ret;
-	int mask = 0x80;
+	int x, linenum, ret;
 	void *start, *line;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 
+	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
+		return -EAGAIN;
 	linenum = VID_TO_PIXEL(x_frac) + 1;
 	x = y + 1;
 	start = vid_priv->fb + linenum * vid_priv->line_length - x * pbytes;
 	line = start;
-	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
-		return -EAGAIN;
 
-	for (col = 0; col < VIDEO_FONT_HEIGHT; col++) {
-		switch (vid_priv->bpix) {
-		case VIDEO_BPP8:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-				uint8_t *dst = line;
+	ret = fill_char_horizontally(pfont, &line, vid_priv, FLIPPED_DIRECTION);
+	if (ret)
+		return ret;
 
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
-					*dst-- = (pfont[i] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-				}
-				break;
-			}
-		case VIDEO_BPP16:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-				uint16_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
-					*dst-- = (pfont[i] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-				}
-				break;
-			}
-		case VIDEO_BPP32:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-				uint32_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
-					*dst-- = (pfont[i] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-				}
-				break;
-			}
-		default:
-			return -ENOSYS;
-		}
-		line += vid_priv->line_length;
-		mask >>= 1;
-	}
 	/* We draw backwards from 'start, so account for the first line */
 	ret = vidconsole_sync_copy(dev, start - vid_priv->line_length, line);
 	if (ret)
@@ -322,44 +311,18 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch)
 static int console_set_row_2(struct udevice *dev, uint row, int clr)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
-	void *start, *line, *end;
+	void *start, *line, *dst, *end;
 	int pixels = VIDEO_FONT_HEIGHT * vid_priv->xsize;
 	int i, ret;
+	int pbytes = VNBYTES(vid_priv->bpix);
 
 	start = vid_priv->fb + vid_priv->ysize * vid_priv->line_length -
 		(row + 1) * VIDEO_FONT_HEIGHT * vid_priv->line_length;
 	line = start;
-	switch (vid_priv->bpix) {
-	case VIDEO_BPP8:
-		if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-			uint8_t *dst = line;
-
-			for (i = 0; i < pixels; i++)
-				*dst++ = clr;
-			end = dst;
-			break;
-		}
-	case VIDEO_BPP16:
-		if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-			uint16_t *dst = line;
-
-			for (i = 0; i < pixels; i++)
-				*dst++ = clr;
-			end = dst;
-			break;
-		}
-	case VIDEO_BPP32:
-		if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-			uint32_t *dst = line;
-
-			for (i = 0; i < pixels; i++)
-				*dst++ = clr;
-			end = dst;
-			break;
-		}
-	default:
-		return -ENOSYS;
-	}
+	dst = line;
+	for (i = 0; i < pixels; i++)
+		fill_pixel_and_goto_next(&dst, clr, pbytes, NORMAL_DIRECTION);
+	end = dst;
 	ret = vidconsole_sync_copy(dev, start, end);
 	if (ret)
 		return ret;
@@ -392,8 +355,9 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
 	struct udevice *vid = dev->parent;
 	struct video_priv *vid_priv = dev_get_uclass_priv(vid);
 	int pbytes = VNBYTES(vid_priv->bpix);
-	int i, row, x, linenum, ret;
+	int linenum, x, ret;
 	void *start, *line;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -402,52 +366,10 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
 	start = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes;
 	line = start;
 
-	for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {
-		unsigned int idx = (u8)ch * VIDEO_FONT_HEIGHT + row;
-		uchar bits = video_fontdata[idx];
-
-		switch (vid_priv->bpix) {
-		case VIDEO_BPP8:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-				uint8_t *dst = line;
+	ret = fill_char_vertically(pfont, &line, vid_priv, FLIPPED_DIRECTION);
+	if (ret)
+		return ret;
 
-				for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
-					*dst-- = (bits & 0x80) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-					bits <<= 1;
-				}
-				break;
-			}
-		case VIDEO_BPP16:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-				uint16_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
-					*dst-- = (bits & 0x80) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-					bits <<= 1;
-				}
-				break;
-			}
-		case VIDEO_BPP32:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-				uint32_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_WIDTH; i++) {
-					*dst-- = (bits & 0x80) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-					bits <<= 1;
-				}
-				break;
-			}
-		default:
-			return -ENOSYS;
-		}
-		line -= vid_priv->line_length;
-	}
 	/* Add 4 bytes to allow for the first pixel writen */
 	ret = vidconsole_sync_copy(dev, start + 4, line);
 	if (ret)
@@ -460,40 +382,15 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr)
 {
 	struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent);
 	int pbytes = VNBYTES(vid_priv->bpix);
-	void *start, *line;
+	void *start, *dst, *line;
 	int i, j, ret;
 
 	start = vid_priv->fb + row * VIDEO_FONT_HEIGHT * pbytes;
 	line = start;
 	for (j = 0; j < vid_priv->ysize; j++) {
-		switch (vid_priv->bpix) {
-		case VIDEO_BPP8:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-				uint8_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-					*dst++ = clr;
-				break;
-			}
-		case VIDEO_BPP16:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-				uint16_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-					*dst++ = clr;
-				break;
-			}
-		case VIDEO_BPP32:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-				uint32_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
-					*dst++ = clr;
-				break;
-			}
-		default:
-			return -ENOSYS;
-		}
+		dst = line;
+		for (i = 0; i < VIDEO_FONT_HEIGHT; i++)
+			fill_pixel_and_goto_next(&dst, clr, pbytes, NORMAL_DIRECTION);
 		line += vid_priv->line_length;
 	}
 	ret = vidconsole_sync_copy(dev, start, line);
@@ -517,7 +414,7 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc,
 
 	for (j = 0; j < vid_priv->ysize; j++) {
 		ret = vidconsole_memmove(dev, dst, src,
-					 VIDEO_FONT_HEIGHT * pbytes * count);
+					VIDEO_FONT_HEIGHT * pbytes * count);
 		if (ret)
 			return ret;
 		src += vid_priv->line_length;
@@ -532,58 +429,21 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch)
 	struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev);
 	struct udevice *vid = dev->parent;
 	struct video_priv *vid_priv = dev_get_uclass_priv(vid);
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 	int pbytes = VNBYTES(vid_priv->bpix);
-	int i, col, x, ret;
-	int mask = 0x80;
+	int linenum, x, ret;
 	void *start, *line;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
-	x = vid_priv->ysize - VID_TO_PIXEL(x_frac) - 1;
-	start = vid_priv->fb + x * vid_priv->line_length + y * pbytes;
+	x = y;
+	linenum = vid_priv->ysize - VID_TO_PIXEL(x_frac) - 1;
+	start = vid_priv->fb + linenum * vid_priv->line_length + y * pbytes;
 	line = start;
-	for (col = 0; col < VIDEO_FONT_HEIGHT; col++) {
-		switch (vid_priv->bpix) {
-		case VIDEO_BPP8:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP8)) {
-				uint8_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
-					*dst++ = (pfont[i] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-				}
-				break;
-			}
-		case VIDEO_BPP16:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP16)) {
-				uint16_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
-					*dst++ = (pfont[i] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-				}
-				break;
-			}
-		case VIDEO_BPP32:
-			if (IS_ENABLED(CONFIG_VIDEO_BPP32)) {
-				uint32_t *dst = line;
-
-				for (i = 0; i < VIDEO_FONT_HEIGHT; i++) {
-					*dst++ = (pfont[i] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-				}
-				break;
-			}
-		default:
-			return -ENOSYS;
-		}
-		line -= vid_priv->line_length;
-		mask >>= 1;
-	}
+
+	ret = fill_char_horizontally(pfont, &line, vid_priv, NORMAL_DIRECTION);
+	if (ret)
+		return ret;
 	/* Add a line to allow for the first pixels writen */
 	ret = vidconsole_sync_copy(dev, start + vid_priv->line_length, line);
 	if (ret)
Signature · 1 line
2.30.2
#5 lore raw

Re: [PATCH 2/5] video console: refactoring and optimization

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

---
 drivers/video/console_simple.c | 508 ++++++++++++---------------------
 1 file changed, 184 insertions(+), 324 deletions(-)

This looks like a nice tidy up.

Is there a code-size or performance penalty with this? E.g. with CONFIG_CONSOLE_ROTATION disabled

Please can you comment the functions property so we know what they do?

Regards,
Simon

#6 lore raw

Re: [PATCH 2/5] video console: refactoring and optimization

Regarding code-size there's a gain with CONFIG_CONSOLE_ROTATION enabled, and penalty with disabled:

New:
CONFIG_VIDEO_CONSOLE=y
CONFIG_CONSOLE_ROTATION=y

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
108208  drivers/video/console_simple.o

CONFIG_VIDEO_CONSOLE=y
# CONFIG_CONSOLE_ROTATION is not set

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
53848   drivers/video/console_simple.o

Old:

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_normal.o
44728   drivers/video/console_normal.o
dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_rotate.o
85424   drivers/video/console_rotate.o

In theory, there should be a small performance penalty for the if (direction) statement -
for every row, and for each pixel. For an 8x16 font, it'll be 144 if statements.

I'll comment on functions in the next patch versions.

пт, 30 дек. 2022 г. в 01:41, Simon Glass <[email protected]>:

Quoted 25 lines

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

---
 drivers/video/console_simple.c | 508 ++++++++++++---------------------
 1 file changed, 184 insertions(+), 324 deletions(-)

This looks like a nice tidy up.

Is there a code-size or performance penalty with this? E.g. with CONFIG_CONSOLE_ROTATION disabled

Please can you comment the functions property so we know what they do?

Regards,
Simon

#7 lore raw

Re: [PATCH 2/5] video console: refactoring and optimization

Hi Dzmitry,

Quoted 21 lines · Dzmitry Sankouski

Regarding code-size there's a gain with CONFIG_CONSOLE_ROTATION enabled, and penalty with disabled:

New:
CONFIG_VIDEO_CONSOLE=y
CONFIG_CONSOLE_ROTATION=y

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
108208  drivers/video/console_simple.o

CONFIG_VIDEO_CONSOLE=y
# CONFIG_CONSOLE_ROTATION is not set

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
53848   drivers/video/console_simple.o

Old:

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_normal.o
44728   drivers/video/console_normal.o
dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_rotate.o
85424   drivers/video/console_rotate.o
Quoted 5 lines

In theory, there should be a small performance penalty for the if (direction) statement -
for every row, and for each pixel. For an 8x16 font, it'll be 144 if statements.

I'll comment on functions in the next patch versions.

To check this, use:

buildman -b <branch> <board>

to build each commit, then

buildman -b <branch> <board> -sS

You can add -B for function bloat and --step 0 to diff just the first and last commits.

- Simon

Quoted 27 lines

пт, 30 дек. 2022 г. в 01:41, Simon Glass <[email protected]>:

Quoted 25 lines

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

---
 drivers/video/console_simple.c | 508 ++++++++++++---------------------
 1 file changed, 184 insertions(+), 324 deletions(-)

This looks like a nice tidy up.

Is there a code-size or performance penalty with this? E.g. with CONFIG_CONSOLE_ROTATION disabled

Please can you comment the functions property so we know what they do?

Regards,
Simon

#8 lore raw

Re: [PATCH 2/5] video console: refactoring and optimization

For version 3 patches:

Summary of 8 commits for 1232 boards (4 threads, 1 job per thread) 01: video console: unite normal and rotated files
02: video console: refactoring and optimization
sandbox: (for 1/7 boards) all -64.0 text -64.0
03: video console: add support for fonts wider than 1 byte
04: video console: add select font logic to vidconsole uclass driver
sandbox: (for 1/7 boards) all +288.0 data +32.0 text +256.0
05: video console: allow font size configuration at runtime
sandbox: (for 1/7 boards) all +1208.0 data +64.0 rodata +96.0 text +1048.0
06: video console: add 12x22 Sun font from linux
07: video console: add 16x32 Terminus font from linux
08: video console: add 12x22 console simple font test
sandbox: (for 1/7 boards) all +13152.0 data +11336.0 rodata +256.0
text +1560.0
(no errors to report)

ср, 4 янв. 2023 г. в 23:02, Simon Glass <[email protected]>:

Quoted 72 lines

Hi Dzmitry,

Quoted 21 lines · Dzmitry Sankouski

Regarding code-size there's a gain with CONFIG_CONSOLE_ROTATION enabled, and penalty with disabled:

New:
CONFIG_VIDEO_CONSOLE=y
CONFIG_CONSOLE_ROTATION=y

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
108208  drivers/video/console_simple.o

CONFIG_VIDEO_CONSOLE=y
# CONFIG_CONSOLE_ROTATION is not set

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_simple.o
53848   drivers/video/console_simple.o

Old:

dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_normal.o
44728   drivers/video/console_normal.o
dzmitry@debian:~/side/u-boot$ du --bytes drivers/video/console_rotate.o
85424   drivers/video/console_rotate.o
Quoted 5 lines

In theory, there should be a small performance penalty for the if (direction) statement -
for every row, and for each pixel. For an 8x16 font, it'll be 144 if statements.

I'll comment on functions in the next patch versions.

To check this, use:

buildman -b <branch> <board>

to build each commit, then

buildman -b <branch> <board> -sS

You can add -B for function bloat and --step 0 to diff just the first and last commits.

- Simon

Quoted 27 lines

пт, 30 дек. 2022 г. в 01:41, Simon Glass <[email protected]>:

Quoted 25 lines

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

- get rid of code duplications in switch across bpp values
- extract common pixel fill logic in two functions one per horizontal and vertical filling
- rearrange statements in put_xy* methods in unified way
- replace types - uint*_t to u*

---
 drivers/video/console_simple.c | 508 ++++++++++++---------------------
 1 file changed, 184 insertions(+), 324 deletions(-)

This looks like a nice tidy up.

Is there a code-size or performance penalty with this? E.g. with CONFIG_CONSOLE_ROTATION disabled

Please can you comment the functions property so we know what they do?

Regards,
Simon

#9 lore raw

PATCH 3/5 video console: add support for fonts wider than 1 byte

In reply to Dzmitry Sankouski

Devices with high ppi may benefit from wider fonts.

Current width implementation is limited by 1 byte, i.e. 8 bits. New version iterates VIDEO_FONT_BYTE_WIDTH times, to process all width bytes, thus allowing fonts wider than 1 byte.

---
 drivers/video/console_simple.c | 79 ++++++++++++++++++----------------
 include/video_font_4x6.h       |  2 +
 include/video_font_data.h      |  2 +
 3 files changed, 47 insertions(+), 36 deletions(-)
drivers/video/console_simple.c +43 -36
index 20087a30af..3ae1fbdc89 100644
@@ -61,30 +61,32 @@ static int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *
 {
 	int ret;
 	void *dst;
-	u8 mask = 0x80;
-
+	u8 mask;
 	ret = check_bpix_support(vid_priv->bpix);
 	if (ret)
 		return ret;
 
-	for (int col = 0; col < VIDEO_FONT_WIDTH; col++) {
-		dst = *line;
-		for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
-			u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?
-						vid_priv->colour_fg :
-						vid_priv->colour_bg;
-
-			ret = fill_pixel_and_goto_next(&dst,
-						       value,
-						       VNBYTES(vid_priv->bpix),
-						       direction
-			);
+	for (int col = 0; col < VIDEO_FONT_BYTE_WIDTH; col++) {
+		mask = 0x80;
+		for (int bit = 0; bit < 8; bit++) {
+			dst = *line;
+			for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+				u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?
+							vid_priv->colour_fg :
+							vid_priv->colour_bg;
+
+				ret = fill_pixel_and_goto_next(&dst,
+							       value,
+							       VNBYTES(vid_priv->bpix),
+							       direction
+				);
+			}
+			if (direction)
+				*line += vid_priv->line_length;
+			else
+				*line -= vid_priv->line_length;
+			mask >>= 1;
 		}
-		if (direction)
-			*line += vid_priv->line_length;
-		else
-			*line -= vid_priv->line_length;
-		mask >>= 1;
 	}
 	return ret;
 }
@@ -101,24 +103,29 @@ static int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vi
 		return ret;
 	for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
 		dst = *line;
-		uchar bits = pfont[row];
-
-		for (int i = 0; i < VIDEO_FONT_WIDTH; i++) {
-			u32 value = (bits & 0x80) ?
-				vid_priv->colour_fg :
-				vid_priv->colour_bg;
-
-			ret = fill_pixel_and_goto_next(&dst,
-						       value,
-						       VNBYTES(vid_priv->bpix),
-						       direction
-			);
-			bits <<= 1;
+		uchar bits;
+
+		for (int i = 0; i < VIDEO_FONT_BYTE_WIDTH; i++) {
+			bits = pfont[i];
+			for (int bit = 0; bit < 8; bit++) {
+				u32 value = (bits & 0x80) ?
+					vid_priv->colour_fg :
+					vid_priv->colour_bg;
+
+				ret = fill_pixel_and_goto_next(&dst,
+							       value,
+							       VNBYTES(vid_priv->bpix),
+							       direction
+				);
+				bits <<= 1;
+			}
 		}
 		if (direction)
 			*line -= vid_priv->line_length;
 		else
 			*line += vid_priv->line_length;
+
+		pfont += VIDEO_FONT_BYTE_WIDTH;
 	}
 	return ret;
 }
@@ -177,7 +184,7 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int x, linenum, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -286,7 +293,7 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int x, linenum, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -357,7 +364,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int linenum, x, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -432,7 +439,7 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int linenum, x, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
include/video_font_4x6.h +2 -0
index c7e6351b64..f1eb2af861 100644
@@ -43,7 +43,9 @@ __END__;
 
 #define VIDEO_FONT_CHARS	256
 #define VIDEO_FONT_WIDTH	4
+#define VIDEO_FONT_BYTE_WIDTH	VIDEO_FONT_WIDTH / 8 + (VIDEO_FONT_WIDTH % 8 > 0)
 #define VIDEO_FONT_HEIGHT	6
+#define VIDEO_FONT_CHAR_PIXEL_DATA_SIZE	VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
include/video_font_data.h +2 -0
index 6e64198d1a..6a575e6d15 100644
@@ -11,7 +11,9 @@
 
 #define VIDEO_FONT_CHARS	256
 #define VIDEO_FONT_WIDTH	8
+#define VIDEO_FONT_BYTE_WIDTH	VIDEO_FONT_WIDTH / 8 + (VIDEO_FONT_WIDTH % 8 > 0)
 #define VIDEO_FONT_HEIGHT	16
+#define VIDEO_FONT_CHAR_PIXEL_DATA_SIZE	VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
 static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = {
Signature · 1 line
2.30.2
#10 lore raw

Re: [PATCH 3/5] video console: add support for fonts wider than 1 byte

Hi Dzmitry,

Quoted 114 lines · Dzmitry Sankouski

Devices with high ppi may benefit from wider fonts.

Current width implementation is limited by 1 byte, i.e. 8 bits. New version iterates VIDEO_FONT_BYTE_WIDTH times, to process all width bytes, thus allowing fonts wider than 1 byte.

---
 drivers/video/console_simple.c | 79 ++++++++++++++++++----------------
 include/video_font_4x6.h       |  2 +
 include/video_font_data.h      |  2 +
 3 files changed, 47 insertions(+), 36 deletions(-)
drivers/video/console_simple.c +39 -32
index 20087a30af..3ae1fbdc89 100644
@@ -61,30 +61,32 @@ static int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *
 {
        int ret;
        void *dst;
-       u8 mask = 0x80;
-
+       u8 mask;
        ret = check_bpix_support(vid_priv->bpix);
        if (ret)
                return ret;
 
-       for (int col = 0; col < VIDEO_FONT_WIDTH; col++) {
-               dst = *line;
-               for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
-                       u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?
-                                               vid_priv->colour_fg :
-                                               vid_priv->colour_bg;
-
-                       ret = fill_pixel_and_goto_next(&dst,
-                                                      value,
-                                                      VNBYTES(vid_priv->bpix),
-                                                      direction
-                       );
+       for (int col = 0; col < VIDEO_FONT_BYTE_WIDTH; col++) {
+               mask = 0x80;
+               for (int bit = 0; bit < 8; bit++) {
+                       dst = *line;
+                       for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+                               u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?
+                                                       vid_priv->colour_fg :
+                                                       vid_priv->colour_bg;
+
+                               ret = fill_pixel_and_goto_next(&dst,
+                                                              value,
+                                                              VNBYTES(vid_priv->bpix),
+                                                              direction
+                               );
+                       }
+                       if (direction)
+                               *line += vid_priv->line_length;
+                       else
+                               *line -= vid_priv->line_length;
+                       mask >>= 1;
                }
-               if (direction)
-                       *line += vid_priv->line_length;
-               else
-                       *line -= vid_priv->line_length;
-               mask >>= 1;
        }
        return ret;
 }
@@ -101,24 +103,29 @@ static int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vi
                return ret;
        for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
                dst = *line;
-               uchar bits = pfont[row];
-
-               for (int i = 0; i < VIDEO_FONT_WIDTH; i++) {
-                       u32 value = (bits & 0x80) ?
-                               vid_priv->colour_fg :
-                               vid_priv->colour_bg;
-
-                       ret = fill_pixel_and_goto_next(&dst,
-                                                      value,
-                                                      VNBYTES(vid_priv->bpix),
-                                                      direction
-                       );
-                       bits <<= 1;
+               uchar bits;
+
+               for (int i = 0; i < VIDEO_FONT_BYTE_WIDTH; i++) {
+                       bits = pfont[i];
+                       for (int bit = 0; bit < 8; bit++) {
+                               u32 value = (bits & 0x80) ?
+                                       vid_priv->colour_fg :
+                                       vid_priv->colour_bg;
+
+                               ret = fill_pixel_and_goto_next(&dst,
+                                                              value,
+                                                              VNBYTES(vid_priv->bpix),
+                                                              direction
+                               );
+                               bits <<= 1;
+                       }
                }
                if (direction)
                        *line -= vid_priv->line_length;
                else
                        *line += vid_priv->line_length;
+
+               pfont += VIDEO_FONT_BYTE_WIDTH;
        }
        return ret;
 }

drivers/video/console_simple.c static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch) · line 187

Quoted 5 lines
drivers/video/console_simple.c +1 -1
@@ -177,7 +184,7 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)
        int pbytes = VNBYTES(vid_priv->bpix);
        int x, linenum, ret;
        void *start, *line;
-       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;

Too long :-) How about VIDEO_FONT_PIXEL_BYTES ?

Quoted 35 lines
drivers/video/console_simple.c +3 -3
        if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
                return -EAGAIN;
@@ -286,7 +293,7 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch)
        int pbytes = VNBYTES(vid_priv->bpix);
        int x, linenum, ret;
        void *start, *line;
-       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
        if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
                return -EAGAIN;
@@ -357,7 +364,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
        int pbytes = VNBYTES(vid_priv->bpix);
        int linenum, x, ret;
        void *start, *line;
-       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
        if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
                return -EAGAIN;
@@ -432,7 +439,7 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch)
        int pbytes = VNBYTES(vid_priv->bpix);
        int linenum, x, ret;
        void *start, *line;
-       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+       uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
        if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
                return -EAGAIN;
include/video_font_4x6.h +0 -0
index c7e6351b64..f1eb2af861 100644

include/video_font_4x6.h __END__; · line 46

Quoted 4 lines
include/video_font_4x6.h +1 -0
@@ -43,7 +43,9 @@ __END__;
 
 #define VIDEO_FONT_CHARS       256
 #define VIDEO_FONT_WIDTH       4
+#define VIDEO_FONT_BYTE_WIDTH  VIDEO_FONT_WIDTH / 8 + (VIDEO_FONT_WIDTH % 8 > 0)

Please add brackets around the whole thing.

Quoted 20 lines
include/video_font_4x6.h +1 -0
 #define VIDEO_FONT_HEIGHT      6
+#define VIDEO_FONT_CHAR_PIXEL_DATA_SIZE        VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH
 #define VIDEO_FONT_SIZE                (VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
include/video_font_data.h +2 -1
index 6e64198d1a..6a575e6d15 100644
@@ -11,7 +11,9 @@
 
 #define VIDEO_FONT_CHARS       256
 #define VIDEO_FONT_WIDTH       8
+#define VIDEO_FONT_BYTE_WIDTH  VIDEO_FONT_WIDTH / 8 + (VIDEO_FONT_WIDTH % 8 > 0)
 #define VIDEO_FONT_HEIGHT      16
+#define VIDEO_FONT_CHAR_PIXEL_DATA_SIZE        VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH
 #define VIDEO_FONT_SIZE                (VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
 static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = {
--
Quoted 2 lines

2.30.2

Can you also please add some tests to video.c for this. Also this should have support for console_rotate.c too.

Regards,
Simon

#11 lore raw

Re: [PATCH 3/5] video console: add support for fonts wider than 1 byte

In reply to Dzmitry Sankouski

On Mon, 26 Dec 2022 22:49:27 +0300
Dzmitry Sankouski <[email protected]> wrote:

Hi Dzmitry,

Quoted 5 lines

Devices with high ppi may benefit from wider fonts.

Current width implementation is limited by 1 byte, i.e. 8 bits. New version iterates VIDEO_FONT_BYTE_WIDTH times, to process all width bytes, thus allowing fonts wider than 1 byte.

In general I think this is probably better than my version, not only because it unifies rotated and normal consoles.
Some minor/stylistic comments below.

Quoted 28 lines
---
 drivers/video/console_simple.c | 79 ++++++++++++++++++----------------
 include/video_font_4x6.h       |  2 +
 include/video_font_data.h      |  2 +
 3 files changed, 47 insertions(+), 36 deletions(-)
drivers/video/console_simple.c +1 -7
index 20087a30af..3ae1fbdc89 100644
@@ -61,30 +61,32 @@ static int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *
 {
 	int ret;
 	void *dst;
-	u8 mask = 0x80;
-
+	u8 mask;
 	ret = check_bpix_support(vid_priv->bpix);
 	if (ret)
 		return ret;
 
-	for (int col = 0; col < VIDEO_FONT_WIDTH; col++) {
-		dst = *line;
-		for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
-			u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?
-						vid_priv->colour_fg :

drivers/video/console_simple.c static int fill_char_horizontally(uchar *pfont, void **line, struct video_priv * · line 71

Quoted 10 lines
drivers/video/console_simple.c +3 -7
-						vid_priv->colour_bg;
-
-			ret = fill_pixel_and_goto_next(&dst,
-						       value,
-						       VNBYTES(vid_priv->bpix),
-						       direction
-			);
+	for (int col = 0; col < VIDEO_FONT_BYTE_WIDTH; col++) {
+		mask = 0x80;
+		for (int bit = 0; bit < 8; bit++) {

I think it's cleaner to collapse this:

	for (int col = 0; col < VIDEO_FONT_WIDTH; col++) {
		if ((col % 8) == 0)
			mask = 0x80;

...

drivers/video/console_simple.c static int fill_char_horizontally(uchar *pfont, void **line, struct video_priv * · line 74

Quoted 3 lines
drivers/video/console_simple.c +3 -0
+			dst = *line;
+			for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+				u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH + col] & mask) ?

... and use (col / 8) here.

Quoted 35 lines
drivers/video/console_simple.c +14 -13
+							vid_priv->colour_fg :
+							vid_priv->colour_bg;
+
+				ret = fill_pixel_and_goto_next(&dst,
+							       value,
+							       VNBYTES(vid_priv->bpix),
+							       direction
+				);
+			}
+			if (direction)
+				*line += vid_priv->line_length;
+			else
+				*line -= vid_priv->line_length;
+			mask >>= 1;
 		}
-		if (direction)
-			*line += vid_priv->line_length;
-		else
-			*line -= vid_priv->line_length;
-		mask >>= 1;
 	}
 	return ret;
 }
@@ -101,24 +103,29 @@ static int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vi
 		return ret;
 	for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
 		dst = *line;
-		uchar bits = pfont[row];
-
-		for (int i = 0; i < VIDEO_FONT_WIDTH; i++) {
-			u32 value = (bits & 0x80) ?
-				vid_priv->colour_fg :
-				vid_priv->colour_bg;
-
-			ret = fill_pixel_and_goto_next(&dst,

drivers/video/console_simple.c static int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vi · line 110

Quoted 10 lines
drivers/video/console_simple.c +5 -5
-						       value,
-						       VNBYTES(vid_priv->bpix),
-						       direction
-			);
-			bits <<= 1;
+		uchar bits;
+
+		for (int i = 0; i < VIDEO_FONT_BYTE_WIDTH; i++) {
+			bits = pfont[i];
+			for (int bit = 0; bit < 8; bit++) {

Same as above, those two loops should become one.

Quoted 62 lines
drivers/video/console_simple.c +17 -4
+				u32 value = (bits & 0x80) ?
+					vid_priv->colour_fg :
+					vid_priv->colour_bg;
+
+				ret = fill_pixel_and_goto_next(&dst,
+							       value,
+							       VNBYTES(vid_priv->bpix),
+							       direction
+				);
+				bits <<= 1;
+			}
 		}
 		if (direction)
 			*line -= vid_priv->line_length;
 		else
 			*line += vid_priv->line_length;
+
+		pfont += VIDEO_FONT_BYTE_WIDTH;
 	}
 	return ret;
 }
@@ -177,7 +184,7 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int x, linenum, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -286,7 +293,7 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int x, linenum, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -357,7 +364,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int linenum, x, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
@@ -432,7 +439,7 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch)
 	int pbytes = VNBYTES(vid_priv->bpix);
 	int linenum, x, ret;
 	void *start, *line;
-	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+	uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_DATA_SIZE;
 
 	if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
 		return -EAGAIN;
include/video_font_4x6.h +0 -0
index c7e6351b64..f1eb2af861 100644

include/video_font_4x6.h __END__; · line 46

Quoted 4 lines
include/video_font_4x6.h +1 -0
@@ -43,7 +43,9 @@ __END__;
 
 #define VIDEO_FONT_CHARS	256
 #define VIDEO_FONT_WIDTH	4
+#define VIDEO_FONT_BYTE_WIDTH	VIDEO_FONT_WIDTH / 8 + (VIDEO_FONT_WIDTH % 8 > 0)

I think the canonical way for rounding up is:

	((VIDEO_FONT_WIDTH + 7) / 8)

And as Simon said: you need parentheses, otherwise it failed for me with a width of 12 (sun12x22 font).

include/video_font_4x6.h __END__; · line 48

Quoted 2 lines
include/video_font_4x6.h +1 -0
 #define VIDEO_FONT_HEIGHT	6
+#define VIDEO_FONT_CHAR_PIXEL_DATA_SIZE	VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH

Those two new lines do not contain any specific data, so can be moved to console_simple.c.

Quoted 8 lines
include/video_font_4x6.h +0 -0
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
 static unsigned char video_fontdata[VIDEO_FONT_SIZE] = {
include/video_font_data.h +0 -0
index 6e64198d1a..6a575e6d15 100644

include/video_font_data.h line 16

Quoted 6 lines
include/video_font_data.h +2 -0
@@ -11,7 +11,9 @@
 
 #define VIDEO_FONT_CHARS	256
 #define VIDEO_FONT_WIDTH	8
+#define VIDEO_FONT_BYTE_WIDTH	VIDEO_FONT_WIDTH / 8 + (VIDEO_FONT_WIDTH % 8 > 0)
 #define VIDEO_FONT_HEIGHT	16
+#define VIDEO_FONT_CHAR_PIXEL_DATA_SIZE	VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH

same here, remove from here and use one copy in console_simple.c.

Cheers,
Andre

Quoted 3 lines
include/video_font_data.h +0 -0
 #define VIDEO_FONT_SIZE		(VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT)
 
 static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = {
#12 lore raw

PATCH 4/5 video console: add 16x32 ter font from linux

In reply to Dzmitry Sankouski

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

Add 16x32 ter font from linux, and allow font size configuration. Set 16x32 font for starqltechn board.

---
 configs/starqltechn_defconfig |    1 +
 drivers/video/Kconfig         |   23 +
 include/video_font.h          |    6 +-
 include/video_font_ter16x32.h | 2068 +++++++++++++++++++++++++++++++++
 4 files changed, 2096 insertions(+), 2 deletions(-)
 create mode 100644 include/video_font_ter16x32.h
configs/starqltechn_defconfig +1 -0
index 59fc9ab151..9e9ca33089 100644
@@ -12,6 +12,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTDELAY=5
 CONFIG_CMD_BOOTMENU=y
 CONFIG_DM_KEYBOARD=y
+CONFIG_VIDEO_FONT_16x32=y
 CONFIG_USE_PREBOOT=y
 CONFIG_SAVE_PREV_BL_FDT_ADDR=n
 CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR=n
drivers/video/Kconfig +23 -0
index bc7f20cf64..3d531e69dc 100644
@@ -15,6 +15,29 @@ config VIDEO
 	  through this.
 
 if VIDEO
+choice
+	prompt "Video font size"
+	default VIDEO_FONT_8x16
+
+config VIDEO_FONT_4X6
+	bool "4 x 6 font size"
+	help
+	  Font for video console driver, 4 x 6 pixels.
+	  Provides character bitmap data in header file.
+
+config VIDEO_FONT_8x16
+	bool "8 x 16 font size"
+	help
+	  Font for video console driver, 8 x 16 pixels
+	  Provides character bitmap data in header file.
+
+config VIDEO_FONT_16x32
+	bool "16 x 32 font size"
+	help
+	  Font for video console driver, 16 x 32 pixels
+	  Provides character bitmap data in header file.
+
+endchoice
 
 config VIDEO_LOGO
 	bool "Show the U-Boot logo on the display"
include/video_font.h +4 -2
index 5e23f70f85..86685bfaf1 100644
@@ -7,10 +7,12 @@
 #ifndef _VIDEO_FONT_
 #define _VIDEO_FONT_
 
-#ifdef CONFIG_VIDEO_FONT_4X6
+#if defined(CONFIG_VIDEO_FONT_4X6)
 #include <video_font_4x6.h>
-#else
+#elif defined(CONFIG_VIDEO_FONT_8x16)
 #include <video_font_data.h>
+#elif defined(CONFIG_VIDEO_FONT_16x32)
+#include <video_font_ter16x32.h>
 #endif
 
 #endif /* _VIDEO_FONT_ */
include/video_font_ter16x32.h new file +2068 -0

2,068 lines not on this page · raw message

Signature · 1 line
2.30.2
#13 lore raw

Re: [PATCH 4/5] video console: add 16x32 ter font from linux

Hi Dzmitry,

Quoted 5 lines · Dzmitry Sankouski

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

Add 16x32 ter font from linux, and allow font size configuration.

That second bit should really be in a separate (previous) commit.

Quoted 1 line

Set 16x32 font for starqltechn board.

This should be in the next commit.

Quoted 9 lines
---
 configs/starqltechn_defconfig |    1 +
 drivers/video/Kconfig         |   23 +
 include/video_font.h          |    6 +-
 include/video_font_ter16x32.h | 2068 +++++++++++++++++++++++++++++++++
 4 files changed, 2096 insertions(+), 2 deletions(-)
 create mode 100644 include/video_font_ter16x32.h

Can we test this? With truetype we actually allow multiple fonts to be built, so we can select one at runtime.

Regards,
Simon

#14 lore raw

Re: [PATCH 4/5] video console: add 16x32 ter font from linux

I tested on qemu q35 with RUFSCRIPT, CANTORAONE font, it uses RUFSCRIPT, and works fine.
Not sure how to switch it on runtime, though.

пт, 30 дек. 2022 г. в 01:41, Simon Glass <[email protected]>:

Quoted 31 lines

Hi Dzmitry,

Quoted 5 lines · Dzmitry Sankouski

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

Add 16x32 ter font from linux, and allow font size configuration.

That second bit should really be in a separate (previous) commit.

Quoted 1 line

Set 16x32 font for starqltechn board.

This should be in the next commit.

Quoted 9 lines
---
 configs/starqltechn_defconfig |    1 +
 drivers/video/Kconfig         |   23 +
 include/video_font.h          |    6 +-
 include/video_font_ter16x32.h | 2068 +++++++++++++++++++++++++++++++++
 4 files changed, 2096 insertions(+), 2 deletions(-)
 create mode 100644 include/video_font_ter16x32.h

Can we test this? With truetype we actually allow multiple fonts to be built, so we can select one at runtime.

Regards,
Simon

#15 lore raw

Re: [PATCH 4/5] video console: add 16x32 ter font from linux

Hi Dzmitry,

Quoted 4 lines · Dzmitry Sankouski

I tested on qemu q35 with RUFSCRIPT, CANTORAONE font, it uses RUFSCRIPT, and works fine.
Not sure how to switch it on runtime, though.

It is nice to use automated tests where we can.

You could add a way to select the font by moving the font info out of hard-coded C defines and into a struct, allowing an array of fonts.

Regards,
Simon

Quoted 35 lines

пт, 30 дек. 2022 г. в 01:41, Simon Glass <[email protected]>:

Quoted 31 lines

Hi Dzmitry,

Quoted 5 lines · Dzmitry Sankouski

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

Add 16x32 ter font from linux, and allow font size configuration.

That second bit should really be in a separate (previous) commit.

Quoted 1 line

Set 16x32 font for starqltechn board.

This should be in the next commit.

Quoted 9 lines
---
 configs/starqltechn_defconfig |    1 +
 drivers/video/Kconfig         |   23 +
 include/video_font.h          |    6 +-
 include/video_font_ter16x32.h | 2068 +++++++++++++++++++++++++++++++++
 4 files changed, 2096 insertions(+), 2 deletions(-)
 create mode 100644 include/video_font_ter16x32.h

Can we test this? With truetype we actually allow multiple fonts to be built, so we can select one at runtime.

Regards,
Simon

#16 lore raw

PATCH 5/5 video console: remove unused 4x6 font

In reply to Dzmitry Sankouski

Remove video_font_4x6.h file because it's unused.

---
 drivers/video/Kconfig    |    6 -
 include/video_font.h     |    4 +-
 include/video_font_4x6.h | 2155 --------------------------------------
 3 files changed, 1 insertion(+), 2164 deletions(-)
 delete mode 100644 include/video_font_4x6.h
drivers/video/Kconfig +0 -6
index 3d531e69dc..b6a9934243 100644
@@ -19,12 +19,6 @@ choice
 	prompt "Video font size"
 	default VIDEO_FONT_8x16
 
-config VIDEO_FONT_4X6
-	bool "4 x 6 font size"
-	help
-	  Font for video console driver, 4 x 6 pixels.
-	  Provides character bitmap data in header file.
-
 config VIDEO_FONT_8x16
 	bool "8 x 16 font size"
 	help
include/video_font.h +1 -3
index 86685bfaf1..05a9fc288f 100644
@@ -7,9 +7,7 @@
 #ifndef _VIDEO_FONT_
 #define _VIDEO_FONT_
 
-#if defined(CONFIG_VIDEO_FONT_4X6)
-#include <video_font_4x6.h>
-#elif defined(CONFIG_VIDEO_FONT_8x16)
+#if defined(CONFIG_VIDEO_FONT_8x16)
 #include <video_font_data.h>
 #elif defined(CONFIG_VIDEO_FONT_16x32)
 #include <video_font_ter16x32.h>
include/video_font_4x6.h deleted +0 -2155

2,155 lines not on this page · raw message

Signature · 1 line
2.30.2
#17 lore raw

Re: [PATCH 5/5] video console: remove unused 4x6 font

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

Remove video_font_4x6.h file because it's unused.

---
 drivers/video/Kconfig    |    6 -
 include/video_font.h     |    4 +-
 include/video_font_4x6.h | 2155 --------------------------------------
 3 files changed, 1 insertion(+), 2164 deletions(-)
 delete mode 100644 include/video_font_4x6.h

I do think this is useful, e.g. on small displays. How about adding a Kconfig for it instead?

Regards,
Simon

#18 lore raw

Re: [PATCH 5/5] video console: remove unused 4x6 font

ok

пт, 30 дек. 2022 г. в 01:40, Simon Glass <[email protected]>:

Quoted 21 lines

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

Remove video_font_4x6.h file because it's unused.

---
 drivers/video/Kconfig    |    6 -
 include/video_font.h     |    4 +-
 include/video_font_4x6.h | 2155 --------------------------------------
 3 files changed, 1 insertion(+), 2164 deletions(-)
 delete mode 100644 include/video_font_4x6.h

I do think this is useful, e.g. on small displays. How about adding a Kconfig for it instead?

Regards,
Simon

#19 lore raw

Re: [PATCH 5/5] video console: remove unused 4x6 font

Quoted 21 lines · On Wed, 11 Jan 2023 20:05:11 +0300 Dzmitry Sankouski <[email protected]>…

ok

пт, 30 дек. 2022 г. в 01:40, Simon Glass <[email protected]>:

Quoted 18 lines

Hi Dzmitry,

Quoted 11 lines · Dzmitry Sankouski

Remove video_font_4x6.h file because it's unused.

---
 drivers/video/Kconfig    |    6 -
 include/video_font.h     |    4 +-
 include/video_font_4x6.h | 2155 --------------------------------------
 3 files changed, 1 insertion(+), 2164 deletions(-)
 delete mode 100644 include/video_font_4x6.h

I do think this is useful, e.g. on small displays. How about adding a Kconfig for it instead?

You can cherry-pick this patch for the conversion:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Cheers,
Andre

#20 lore raw
In reply to Dzmitry Sankouski
Quoted 10 lines

From: Dzmitry Sankouski <[email protected]>
Date: Mon, 26 Dec 2022 22:49:24 +0300

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

This patch series aims to add wider fonts for devices with high ppi.

Add 16x32 ter font from linux, and allow font size configuration. Use new font in starqltechn board.

There was a patchset related to this earlier this year that is still in limbo:

https://patchwork.ozlabs.org/project/uboot/list/?series=280178

No idea which is the better approach.

#21 lore raw

+Andre Przywara for comment

Quoted 18 lines · Mark Kettenis
Quoted 11 lines

From: Dzmitry Sankouski <[email protected]>
Date: Mon, 26 Dec 2022 22:49:24 +0300

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

This patch series aims to add wider fonts for devices with high ppi.

Add 16x32 ter font from linux, and allow font size configuration. Use new font in starqltechn board.

There was a patchset related to this earlier this year that is still in limbo:

https://patchwork.ozlabs.org/project/uboot/list/?series=280178

No idea which is the better approach.

#22 lore raw
In reply to Mark Kettenis

This patchset adds wider fonts only for normal console.

пт, 30 дек. 2022 г. в 02:02, Mark Kettenis <[email protected]>:

Quoted 18 lines
Quoted 11 lines

From: Dzmitry Sankouski <[email protected]>
Date: Mon, 26 Dec 2022 22:49:24 +0300

Modern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.

This patch series aims to add wider fonts for devices with high ppi.

Add 16x32 ter font from linux, and allow font size configuration. Use new font in starqltechn board.

There was a patchset related to this earlier this year that is still in limbo:

https://patchwork.ozlabs.org/project/uboot/list/?series=280178

No idea which is the better approach.