vidconsole: refactoring and support for wider fonts
v8 cover vidconsole: refactoring and support for wider fonts
Version 7 has vidconsole_get_font_size() function reworked to use driver ops.
Version 6 contains entire rebased patch series. New patch 'move vidconsole_get_font_size() to test.h' added.
Version 5 contain minor changes:
- move common functions to console-core.c file
- remove static keyword from shared functions
In version 4, only first patch sent, because review fixes to this would add large rebase & patch formatting overhead. When it'll receive reviewed tag, I'll resent entire rebased series.
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, 12x22 fonts from linux, and allow font size configuration.
There was significant changes in version 2:
- fix video tests failures
- add runtime font size configuration
- add test for 12x22 font
In version 3,
'video console: add select font logic to vidconsole uclass driver' patch was removed in favor of already merged patch 'video: Add font functions to the vidconsole API'
Changes in v8:
- fix build with disabled CONFIG_VIDEO_COPY
- add 12X22 font to sandox defconfig
Dzmitry Sankouski (10):
video console: refactoring and optimization
video console: add support for fonts wider than 1 byte video console: move 8x16 font data in named header video console: implement multiple fonts configuration video console: move vidconsole_get_font_size() logic to driver ops video console: allow font size configuration at runtime video console: add 12x22 Sun font from linux
video console: add 16x32 Terminus font from linux
video console: sandbox: add 12x22 font defconfigs
video console: add 12x22 console simple font test
cmd/Kconfig | 8 + cmd/Makefile | 2 +- cmd/font.c | 6 +- common/splash.c | 17 +- configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + drivers/video/Kconfig | 30 + drivers/video/Makefile | 6 + drivers/video/console_core.c | 212 + drivers/video/console_normal.c | 177 +- drivers/video/console_rotate.c | 371 +- drivers/video/console_truetype.c | 3 +- drivers/video/vidconsole-uclass.c | 11 + drivers/video/vidconsole_internal.h | 120 + include/video_console.h | 17 +- include/video_font.h | 31 +- include/video_font_4x6.h | 11 +- include/video_font_8x16.h | 4624 ++++++++++++++++++++ include/video_font_data.h | 4644 +------------------- include/video_font_sun12x22.h | 6158 +++++++++++++++++++++++++++ include/video_font_ter16x32.h | 2062 +++++++++ test/cmd/font.c | 13 +- test/dm/video.c | 41 + 23 files changed, 13518 insertions(+), 5048 deletions(-) create mode 100644 drivers/video/console_core.c create mode 100644 drivers/video/vidconsole_internal.h create mode 100644 include/video_font_8x16.h create mode 100644 include/video_font_sun12x22.h create mode 100644 include/video_font_ter16x32.h
Signature · 1 line
2.30.2
PATCH v8 3/10 video console: move 8x16 font data in named header
Consistent font data header names needed to add new fonts.
---
Changes in v8:
none
Changes in v7:
none
Changes in v6:
rebase only
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
N/A
Changes in v2:
N/A
include/video_font.h | 2 +-
include/{video_font_data.h => video_font_8x16.h} | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
rename include/{video_font_data.h => video_font_8x16.h} (99%)include/video_font.h +1 -1
@@ -10,7 +10,7 @@#ifdef CONFIG_VIDEO_FONT_4X6 #include <video_font_4x6.h> #else -#include <video_font_data.h> +#include <video_font_8x16.h> #endif #endif /* _VIDEO_FONT_ */
include/video_font_8x16.h renamed from include/video_font_data.h +2 -3
@@ -6,8 +6,8 @@* This file contains an 8x16 bitmap font for code page 437. */ -#ifndef _VIDEO_FONT_DATA_ -#define _VIDEO_FONT_DATA_ +#ifndef _VIDEO_FONT_8X16 +#define _VIDEO_FONT_8X16#define VIDEO_FONT_CHARS 256#define VIDEO_FONT_WIDTH 8
@@ -4623,7 +4623,6 @@ static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE] = {0x00 ,/* 00000000 */ 0x00 ,/* 00000000 */ 0x00, /* 00000000 */ - };#endif
Signature · 1 line
2.30.2
PATCH v8 2/10 video console: add support for fonts wider than 1 byte
In reply to Dzmitry SankouskiDevices 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.
---
Changes in v8:
none
Changes in v7:
none
Changes in v6:
rebase only
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
none
Changes in v2:
- replace TAIL_BIT_COUNT macro with c code
- rename refactoring
drivers/video/console_core.c | 84 ++++++++++++++++++----------- drivers/video/console_normal.c | 2 +- drivers/video/console_rotate.c | 6 +-- drivers/video/vidconsole_internal.h | 1 + 4 files changed, 59 insertions(+), 34 deletions(-)
drivers/video/console_core.c +54 -30
@@ -45,7 +45,7 @@ inline void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int steint fill_char_vertically (uchar *pfont,void **line,struct video_priv *vid_priv,bool direction) { -int step, line_step, pbytes, ret; +int step, line_step, pbytes, bitcount, width_remainder, ret;void *dst; ret =check_bpix_support (vid_priv->bpix);
@@ -61,23 +61,36 @@ int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv, line_step = vid_priv->line_length; } + width_remainder =VIDEO_FONT_WIDTH %8 ;for (int row =0 ; row <VIDEO_FONT_HEIGHT ; row++) { +uchar bits; + + bitcount =8 ; 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; - -fill_pixel_and_goto_next (&dst, - value, - pbytes, - step - ); - bits <<=1 ; +for (int col =0 ; col <VIDEO_FONT_BYTE_WIDTH ; col++) { +if (width_remainder) { +bool is_last_iteration = (VIDEO_FONT_BYTE_WIDTH - col ==1 ); + +if (is_last_iteration) + bitcount = width_remainder; + } + bits = pfont[col]; + +for (int bit =0 ; bit < bitcount; bit++) { +u32 value = (bits &0x80 ) ? + vid_priv->colour_fg : + vid_priv->colour_bg; + +fill_pixel_and_goto_next (&dst, + value, + pbytes, + step + ); + bits <<=1 ; + } } *line += line_step; + pfont +=VIDEO_FONT_BYTE_WIDTH ; }return ret; }
@@ -85,9 +98,9 @@ int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv,int fill_char_horizontally (uchar *pfont,void **line,struct video_priv *vid_priv,bool direction) { -int step, line_step, pbytes, ret; +int step, line_step, pbytes, bitcount =8 , width_remainder, ret;void *dst; -u8 mask =0x80 ; +u8 mask; ret =check_bpix_support (vid_priv->bpix);if (ret)
@@ -101,21 +114,32 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri step = pbytes; line_step = -vid_priv->line_length; } -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 ] & mask) ? - vid_priv->colour_fg : - vid_priv->colour_bg; - -fill_pixel_and_goto_next (&dst, - value, - pbytes, - step - ); + + width_remainder =VIDEO_FONT_WIDTH %8 ; +for (int col =0 ; col <VIDEO_FONT_BYTE_WIDTH ; col++) { + mask =0x80 ; +if (width_remainder) { +bool is_last_iteration = (VIDEO_FONT_BYTE_WIDTH - col ==1 ); + +if (is_last_iteration) + bitcount = width_remainder; + } +for (int bit =0 ; bit < bitcount; bit++) { + dst = *line; +for (int row =0 ; row <VIDEO_FONT_HEIGHT ; row++) { +u32 value = (pfont[row *VIDEO_FONT_BYTE_WIDTH ] & mask) ? + vid_priv->colour_fg : + vid_priv->colour_bg; + +fill_pixel_and_goto_next (&dst, + value, + pbytes, + step + ); + } + *line += line_step; + mask >>=1 ; } - *line += line_step; - mask >>=1 ; }return ret; }
drivers/video/console_normal.c +1 -1
@@ -67,7 +67,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_BYTES ;if (x_frac +VID_TO_POS (vc_priv->x_charsize) > vc_priv->xsize_frac)return -EAGAIN ;
drivers/video/console_rotate.c +3 -3
@@ -71,7 +71,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_BYTES ;if (x_frac +VID_TO_POS (vc_priv->x_charsize) > vc_priv->xsize_frac)return -EAGAIN ;
@@ -142,7 +142,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_BYTES ;if (x_frac +VID_TO_POS (vc_priv->x_charsize) > vc_priv->xsize_frac)return -EAGAIN ;
@@ -217,7 +217,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_BYTES ;if (x_frac +VID_TO_POS (vc_priv->x_charsize) > vc_priv->xsize_frac)return -EAGAIN ;
drivers/video/vidconsole_internal.h +1 -0
@@ -9,6 +9,7 @@#include <video_font.h> /* Get font data, width and height */ #define VIDEO_FONT_BYTE_WIDTH ((VIDEO_FONT_WIDTH / 8) + (VIDEO_FONT_WIDTH % 8 > 0)) +#define VIDEO_FONT_CHAR_PIXEL_BYTES (VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH)#define FLIPPED_DIRECTION 1#define NORMAL_DIRECTION 0
Signature · 1 line
2.30.2
PATCH v8 1/10 video console: refactoring and optimization
In reply to Dzmitry Sankouski- move common code to vidconsole_internal.h and console_core.c
- unite probe functions
- 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*
---
Changes in v8:
- fix build with disabled CONFIG_VIDEO_COPY
- add 12X22 font to sandox defconfig
- fix build with disabled CONFIG_VIDEO_COPY
Changes in v7:
none
Changes in v6:
none
Changes in v5:
- move common functions to console-core.c file
- remove static keyword from shared functions
Changes in v4:
- move common code to vidconsole_internal.h
- unite probe functions
Changes in v3:
none
Changes in v2:
none
drivers/video/Makefile | 6 + drivers/video/console_core.c | 141 +++++++++++++ drivers/video/console_normal.c | 150 ++++---------- drivers/video/console_rotate.c | 308 ++++------------------------ drivers/video/vidconsole_internal.h | 95 +++++++++ include/video_console.h | 3 + 6 files changed, 327 insertions(+), 376 deletions(-) create mode 100644 drivers/video/console_core.c create mode 100644 drivers/video/vidconsole_internal.h
drivers/video/Makefile +6 -0
@@ -9,6 +9,12 @@ 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 +ifdef CONFIG_CONSOLE_NORMAL +obj-y += console_core.o +else ifdef CONFIG_CONSOLE_ROTATION +obj-y += console_core.o +endif +obj-$(CONFIG_CONSOLE_ROTATION) += console_core.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_core.c new file +141 -0
141 lines not on this page · raw message
drivers/video/console_normal.c +38 -112
202 lines not on this page · raw message
drivers/video/console_rotate.c +44 -264
427 lines not on this page · raw message
drivers/video/vidconsole_internal.h new file +95 -0
95 lines not on this page · raw message
include/video_console.h +3 -0
@@ -340,6 +340,9 @@ int vidconsole_sync_copy(struct udevice *dev, void *from, void *to);int vidconsole_memmove (struct udevice *dev,void *dst,const void *src,int size);#else + +#include <string.h> +static inline int vidconsole_sync_copy (struct udevice *dev,void *from,void *to) {
Signature · 1 line
2.30.2
PATCH v8 6/10 video console: allow font size configuration at runtime
In reply to Dzmitry SankouskiAllow font size configuration at runtime for console_simple.c driver. This needed for unit testing different fonts.
Configuring is done by font command, also used for font selection in true type console.
---
Changes in v8:
none
Changes in v7:
- (&fonts[seq])->name
- fonts[seq].name
Changes in v6:
rebase only
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
- move 8x16 font patch extracted
- implement multiple fonts patch extracted
- add static modifiers, where needed
- remove list fonts operation
- put fontdata in local var
Changes in v2:
N/A
cmd/Kconfig | 8 ++++++++ cmd/Makefile | 2 +- drivers/video/Kconfig | 1 + drivers/video/console_core.c | 30 +++++++++++++++++++++++++++++ drivers/video/console_normal.c | 3 +++ drivers/video/console_rotate.c | 9 +++++++++ drivers/video/vidconsole_internal.h | 18 +++++++++++++++++ 7 files changed, 70 insertions(+), 1 deletion(-)
cmd/Kconfig +8 -0
@@ -2226,6 +2226,14 @@ config CMD_VIDCONSOLE The name 'lcdputs' is a bit of a misnomer, but so named because the video device is often an LCD. +config CMD_SELECT_FONT + bool "select font size" + depends on VIDEO + default n + help + Enabling this will provide 'font' command. + Allows font selection at runtime. + endmenu source "cmd/ti/Kconfig"
cmd/Makefile +1 -1
@@ -78,7 +78,7 @@ obj-$(CONFIG_CMD_EXT2) += ext2.o obj-$(CONFIG_CMD_FAT) += fat.o obj-$(CONFIG_CMD_FDT) += fdt.o obj-$(CONFIG_CMD_SQUASHFS) += sqfs.o -obj-$(CONFIG_CONSOLE_TRUETYPE) += font.o +obj-$(CONFIG_CMD_SELECT_FONT) += font.o obj-$(CONFIG_CMD_FLASH) += flash.o obj-$(CONFIG_CMD_FPGA) += fpga.o obj-$(CONFIG_CMD_FPGAD) += fpgad.o
drivers/video/Kconfig +1 -0
@@ -165,6 +165,7 @@ config CONSOLE_ROTATION config CONSOLE_TRUETYPE bool "Support a console that uses TrueType fonts" + select CMD_SELECT_FONT help TrueTrype fonts can provide outline-drawing capability rather than needing to provide a bitmap for each font and size that is needed.
drivers/video/console_core.c +30 -0
@@ -180,3 +180,33 @@ int console_probe(struct udevice *dev) {return console_set_font (dev, fonts); } + +const char *console_simple_get_font_size (struct udevice *dev,uint *sizep) +{ +struct console_simple_priv *priv =dev_get_priv (dev); + + *sizep = priv->fontdata->width; + +return priv->fontdata->name; +} + +int console_simple_get_font (struct udevice *dev,int seq,struct vidfont_info *info) +{ + info->name = fonts[seq].name; + +return 0 ; +} + +int console_simple_select_font (struct udevice *dev,const char *name,uint size) +{ +struct video_fontdata *font; + +for (font = fonts; font->name; font++) { +if (!strcmp (name, font->name)) { +console_set_font (dev, font); +return 0 ; + } + }; +printf ("no such font: %s, make sure it's name has <width>x<height> format\n" , name); +return -ENOENT ; +}
drivers/video/console_normal.c +3 -0
@@ -101,6 +101,9 @@ struct vidconsole_ops console_ops = { .putc_xy = console_putc_xy, .move_rows = console_move_rows, .set_row = console_set_row, + .get_font_size = console_simple_get_font_size, + .get_font = console_simple_get_font, + .select_font = console_simple_select_font, };U_BOOT_DRIVER (vidconsole_normal) = {
drivers/video/console_rotate.c +9 -0
@@ -262,18 +262,27 @@ struct vidconsole_ops console_ops_1 = { .putc_xy = console_putc_xy_1, .move_rows = console_move_rows_1, .set_row = console_set_row_1, + .get_font_size = console_simple_get_font_size, + .get_font = console_simple_get_font, + .select_font = console_simple_select_font, };struct vidconsole_ops console_ops_2 = { .putc_xy = console_putc_xy_2, .move_rows = console_move_rows_2, .set_row = console_set_row_2, + .get_font_size = console_simple_get_font_size, + .get_font = console_simple_get_font, + .select_font = console_simple_select_font, };struct vidconsole_ops console_ops_3 = { .putc_xy = console_putc_xy_3, .move_rows = console_move_rows_3, .set_row = console_set_row_3, + .get_font_size = console_simple_get_font_size, + .get_font = console_simple_get_font, + .select_font = console_simple_select_font, };U_BOOT_DRIVER (vidconsole_1) = {
drivers/video/vidconsole_internal.h +18 -0
@@ -100,3 +100,21 @@ int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_pri* @returns 0, if success, or else error code. */ int console_probe (struct udevice *dev); + +/** +* Internal function to be used in as ops. +* See details in video_console.h get_font_size function +**/ +const char *console_simple_get_font_size (struct udevice *dev,uint *sizep); + +/** +* Internal function to be used in as ops. +* See details in video_console.h get_font function +**/ +int console_simple_get_font (struct udevice *dev,int seq,struct vidfont_info *info); + +/** +* Internal function to be used in as ops. +* See details in video_console.h select_font function +**/ +int console_simple_select_font (struct udevice *dev,const char *name,uint size);
Signature · 1 line
2.30.2
PATCH v8 4/10 video console: implement multiple fonts configuration
In reply to Dzmitry SankouskiThis needed for unit testing different fonts.
Configured fonts are placed in an array of fonts. First font is selected by default upon console probe.
---
Changes in v8:
none
Changes in v7:
- place 8x16 font first in list as default
- &fonts[0] - fonts
Changes in v6:
rebase only
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
N/A
Changes in v2:
N/A
common/splash.c | 17 +++--- drivers/video/Kconfig | 15 ++++++ drivers/video/console_core.c | 81 +++++++++++++++++------------ drivers/video/console_normal.c | 32 +++++++----- drivers/video/console_rotate.c | 72 ++++++++++++++++--------- drivers/video/vidconsole_internal.h | 20 ++++--- include/video_font.h | 17 +++++- include/video_font_4x6.h | 11 ++-- include/video_font_8x16.h | 8 +-- include/video_font_data.h | 31 +++++++++++ 10 files changed, 207 insertions(+), 97 deletions(-) create mode 100644 include/video_font_data.h
common/splash.c +10 -7
@@ -127,6 +127,7 @@ void splash_get_pos(int *x, int *y)#include <dm.h> #include <video_console.h> #include <video_font.h> +#include <video_font_data.h> void splash_display_banner (void ) {
@@ -138,13 +139,15 @@ void splash_display_banner(void)if (ret)return ; -#ifdef CONFIG_VIDEO_LOGO - col =BMP_LOGO_WIDTH /VIDEO_FONT_WIDTH +1 ; - row =BMP_LOGO_HEIGHT /VIDEO_FONT_HEIGHT +1 ; -#else - col =0 ; - row =0 ; -#endif +if (IS_ENABLED (CONFIG_VIDEO_LOGO )) { +struct video_fontdata *fontdata = fonts; + + col =BMP_LOGO_WIDTH / fontdata->width +1 ; + row =BMP_LOGO_HEIGHT / fontdata->height +1 ; + }else { + col =0 ; + row =0 ; + }display_options_get_banner (false, buf,sizeof (buf));vidconsole_position_cursor (dev, col,1 );
drivers/video/Kconfig +15 -0
@@ -16,6 +16,21 @@ config VIDEO if VIDEO +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. + When selecting multiple fonts, you may want to enable CMD_SELECT_FONT too. + +config VIDEO_FONT_8X16 + bool "8 x 16 font size" + default y + help + Font for video console driver, 8 x 16 pixels + Provides character bitmap data in header file. + When selecting multiple fonts, you may want to enable CMD_SELECT_FONT too. + config VIDEO_LOGO bool "Show the U-Boot logo on the display" default y if !SPLASH_SCREEN
drivers/video/console_core.c +49 -32
135 lines not on this page · raw message
drivers/video/console_normal.c +20 -12
@@ -16,8 +16,10 @@static int console_set_row (struct udevice *dev,uint row,int clr) {struct video_priv *vid_priv =dev_get_uclass_priv (dev->parent); +struct console_simple_priv *priv =dev_get_priv (dev); +struct video_fontdata *fontdata = priv->fontdata;void *line, *dst, *end; -int pixels =VIDEO_FONT_HEIGHT * vid_priv->xsize; +int pixels = fontdata->height * vid_priv->xsize;int ret;int i;int pbytes;
@@ -26,7 +28,7 @@ static int console_set_row(struct udevice *dev, uint row, int clr)if (ret)return ret; - line = vid_priv->fb + row *VIDEO_FONT_HEIGHT * vid_priv->line_length; + line = vid_priv->fb + row * fontdata->height * vid_priv->line_length; dst = line; pbytes =VNBYTES (vid_priv->bpix);for (i =0 ; i < pixels; i++)
@@ -44,14 +46,16 @@ 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); +struct console_simple_priv *priv =dev_get_priv (dev); +struct video_fontdata *fontdata = priv->fontdata;void *dst;void *src;int size;int ret; - dst = vid_priv->fb + rowdst *VIDEO_FONT_HEIGHT * vid_priv->line_length; - src = vid_priv->fb + rowsrc *VIDEO_FONT_HEIGHT * vid_priv->line_length; - size =VIDEO_FONT_HEIGHT * vid_priv->line_length * count; + dst = vid_priv->fb + rowdst * fontdata->height * vid_priv->line_length; + src = vid_priv->fb + rowsrc * fontdata->height * vid_priv->line_length; + size = fontdata->height * vid_priv->line_length * count; ret =vidconsole_memmove (dev, dst, src, size);if (ret)return ret;
@@ -64,10 +68,13 @@ 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); +struct console_simple_priv *priv =dev_get_priv (dev); +struct video_fontdata *fontdata = priv->fontdata;int pbytes =VNBYTES (vid_priv->bpix);int x, linenum, ret;void *start, *line; -uchar *pfont = video_fontdata + (u8 )ch *VIDEO_FONT_CHAR_PIXEL_BYTES ; +uchar *pfont = fontdata->video_fontdata + + (u8 )ch * fontdata->char_pixel_bytes;if (x_frac +VID_TO_POS (vc_priv->x_charsize) > vc_priv->xsize_frac)return -EAGAIN ;
@@ -79,7 +86,7 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)if (x_frac +VID_TO_POS (vc_priv->x_charsize) > vc_priv->xsize_frac)return -EAGAIN ; - ret =fill_char_vertically (pfont, &line, vid_priv,NORMAL_DIRECTION ); + ret =fill_char_vertically (pfont, &line, vid_priv, fontdata,NORMAL_DIRECTION );if (ret)return ret;
@@ -87,7 +94,7 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch)if (ret)return ret; -return VID_TO_POS (VIDEO_FONT_WIDTH ); +return VID_TO_POS (fontdata->width); }struct vidconsole_ops console_ops = {
@@ -97,8 +104,9 @@ struct vidconsole_ops console_ops = { };U_BOOT_DRIVER (vidconsole_normal) = { - .name ="vidconsole0" , - .id =UCLASS_VIDEO_CONSOLE , - .ops = &console_ops, - .probe = console_probe, + .name ="vidconsole0" , + .id =UCLASS_VIDEO_CONSOLE , + .ops = &console_ops, + .probe = console_probe, + .priv_auto =sizeof (struct console_simple_priv ), };
drivers/video/console_rotate.c +48 -24
233 lines not on this page · raw message
drivers/video/vidconsole_internal.h +13 -7
@@ -6,14 +6,18 @@* (C) Copyright 2023 Dzmitry Sankouski <[email protected]> */ -#include <video_font.h> /* Get font data, width and height */ - -#define VIDEO_FONT_BYTE_WIDTH ((VIDEO_FONT_WIDTH / 8) + (VIDEO_FONT_WIDTH % 8 > 0)) -#define VIDEO_FONT_CHAR_PIXEL_BYTES (VIDEO_FONT_HEIGHT * VIDEO_FONT_BYTE_WIDTH) -#define FLIPPED_DIRECTION 1#define NORMAL_DIRECTION 0 +/** +* struct console_simple_priv - Private data for this driver +* +* @video_fontdata font graphical representation data +*/ +struct console_simple_priv { +struct video_fontdata *fontdata; +}; +/** * Checks if bits per pixel supported. *
@@ -41,6 +45,7 @@ void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step);* @param pfont a pointer to character font data. * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner * @param vid_priv driver private data. +* @fontdata font graphical representation data * @param direction controls character orientation. Can be normal or flipped. * When normal: When flipped: *|-----------------------------------------------|
@@ -59,7 +64,7 @@ void fill_pixel_and_goto_next(void **dstp, u32 value, int pbytes, int step);* @returns 0, if success, or else error code. */ int fill_char_vertically (uchar *pfont,void **line,struct video_priv *vid_priv, -bool direction); +struct video_fontdata *fontdata,bool direction);/** * Fills 1 character in framebuffer horizontally.
@@ -68,6 +73,7 @@ int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv,* @param pfont a pointer to character font data. * @param line a pointer to pointer to framebuffer. It's a point for upper left char corner * @param vid_priv driver private data. +* @fontdata font graphical representation data * @param direction controls character orientation. Can be normal or flipped. * When normal: When flipped: *|-----------------------------------------------|
@@ -84,7 +90,7 @@ int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv,* @returns 0, if success, or else error code. */ int fill_char_horizontally (uchar *pfont,void **line,struct video_priv *vid_priv, -bool direction); +struct video_fontdata *fontdata,bool direction);/** * console probe function.
include/video_font.h +15 -2
@@ -7,10 +7,23 @@#ifndef _VIDEO_FONT_#define _VIDEO_FONT_ -#ifdef CONFIG_VIDEO_FONT_4X6 +#include <video_font_data.h> + +#if defined(CONFIG_VIDEO_FONT_4X6 )#include <video_font_4x6.h> -#else +#endif +#if defined(CONFIG_VIDEO_FONT_8X16 )#include <video_font_8x16.h> #endif +static struct video_fontdata __maybe_unused fonts[] = { +#if defined(CONFIG_VIDEO_FONT_8X16 ) + FONT_ENTRY(8, 16, 8x16), +#endif +#if defined(CONFIG_VIDEO_FONT_4X6 ) + FONT_ENTRY(4, 6, 4x6), +#endif + {/* list terminator */ } +}; +#endif /* _VIDEO_FONT_ */
include/video_font_4x6.h +4 -7
@@ -38,15 +38,12 @@ __END__;MSBit to LSBit = left to right. */ -#ifndef _VIDEO_FONT_DATA_ -#define _VIDEO_FONT_DATA_ +#ifndef _VIDEO_FONT_4X6_ +#define _VIDEO_FONT_4X6_ -#define VIDEO_FONT_CHARS 256 -#define VIDEO_FONT_WIDTH 4 -#define VIDEO_FONT_HEIGHT 6 -#define VIDEO_FONT_SIZE (VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT) +#include <video_font_data.h> -static unsigned char video_fontdata[VIDEO_FONT_SIZE ] = { +static unsigned char video_fontdata_4x6[VIDEO_FONT_SIZE (256 ,4 ,6 )] = {/*{*/ /* Char 0: ' ' */
include/video_font_8x16.h +2 -6
@@ -9,13 +9,9 @@#ifndef _VIDEO_FONT_8X16#define _VIDEO_FONT_8X16 -#define VIDEO_FONT_CHARS 256 -#define VIDEO_FONT_WIDTH 8 -#define VIDEO_FONT_HEIGHT 16 -#define VIDEO_FONT_SIZE (VIDEO_FONT_CHARS * VIDEO_FONT_HEIGHT) - -static unsigned char __maybe_unused video_fontdata[VIDEO_FONT_SIZE ] = { +#include <video_font_data.h> +static unsigned char video_fontdata_8x16[VIDEO_FONT_SIZE (256 ,8 ,16 )] = {/* 0 0x00 '^@' */ 0x00 ,/* 00000000 */ 0x00, /* 00000000 */
include/video_font_data.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* (C) Copyright 2023 Dzmitry Sankouski <[email protected]> +*/ + +#ifndef _VIDEO_FONT_DATA_ +#define _VIDEO_FONT_DATA_ +#define VIDEO_FONT_BYTE_WIDTH (width) ((width / 8) + (width % 8 > 0)) +#define VIDEO_FONT_CHAR_PIXEL_BYTES (width, height) (height * VIDEO_FONT_BYTE_WIDTH(width)) +#define VIDEO_FONT_SIZE (chars, width, height) (chars * VIDEO_FONT_CHAR_PIXEL_BYTES(width, height)) + +struct video_fontdata { +const char *name; +int width; +int height; +int byte_width; +int char_pixel_bytes; +unsigned char *video_fontdata; +}; + +#define FONT_ENTRY (_font_width, _font_height, _width_x_height) \ +{ \ + .name = #_width_x_height, \ + .width = _font_width, \ + .height = _font_height, \ + .byte_width = VIDEO_FONT_BYTE_WIDTH(_font_width), \ + .char_pixel_bytes = VIDEO_FONT_CHAR_PIXEL_BYTES(_font_width, _font_height), \ + .video_fontdata = video_fontdata_##_width_x_height, \ +} + +#endif /* _VIDEO_FONT_DATA_ */
Signature · 1 line
2.30.2
PATCH v8 5/10 video console: move vidconsole_get_font_size() logic to driver ops
In reply to Dzmitry SankouskiSince multiple vidconsole drivers exists, vidconsole_get_font_size() implementation cannot longer live in vidconsole_uclass.c file.
Move current vidconsole_get_font_size logic to truetype driver ops.
---
Changes in v8:
none
Changes in v7:
N/A
Changes in v6:
N/A
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
N/A
Changes in v2:
N/A
cmd/font.c | 6 +++++- drivers/video/console_truetype.c | 3 ++- drivers/video/vidconsole-uclass.c | 11 +++++++++++ include/video_console.h | 14 ++++++++++++-- test/cmd/font.c | 13 +++++++------ 5 files changed, 37 insertions(+), 10 deletions(-)
cmd/font.c +5 -1
@@ -61,7 +61,11 @@ static int do_font_size(struct cmd_tbl *cmdtp, int flag, int argc,if (uclass_first_device_err (UCLASS_VIDEO_CONSOLE , &dev))return CMD_RET_FAILURE ; - font_name =vidconsole_get_font_size (dev, &size); + ret =vidconsole_get_font_size (dev, &font_name, &size); +if (ret) { +printf ("Failed (error %d)\n" , ret); +return CMD_RET_FAILURE ; + } size =dectoul (argv[1 ],NULL );
drivers/video/console_truetype.c +2 -1
@@ -724,7 +724,7 @@ static int truetype_select_font(struct udevice *dev, const char *name,return 0 ; } -const char *vidconsole_get_font_size (struct udevice *dev,uint *sizep) +const char *console_truetype_get_font_size (struct udevice *dev,uint *sizep) {struct console_tt_priv *priv =dev_get_priv (dev);struct console_tt_metrics *met = priv->cur_met;
@@ -773,6 +773,7 @@ struct vidconsole_ops console_truetype_ops = { .backspace = console_truetype_backspace, .entry_start = console_truetype_entry_start, .get_font = console_truetype_get_font, + .get_font_size = console_truetype_get_font_size, .select_font = truetype_select_font, };
drivers/video/vidconsole-uclass.c +11 -0
@@ -575,6 +575,17 @@ int vidconsole_get_font(struct udevice *dev, int seq,return ops->get_font (dev, seq, info); } +int vidconsole_get_font_size (struct udevice *dev,const char **name,uint *sizep) +{ +struct vidconsole_ops *ops =vidconsole_get_ops (dev); + +if (!ops->get_font_size) +return -ENOSYS ; + + *name = ops->get_font_size (dev, sizep); +return 0 ; +} +int vidconsole_select_font (struct udevice *dev,const char *name,uint size) {struct vidconsole_ops *ops =vidconsole_get_ops (dev);
include/video_console.h +12 -2
@@ -160,6 +160,15 @@ struct vidconsole_ops {int (*get_font)(struct udevice *dev,int seq,struct vidfont_info *info); +/** +* get_font_size() - get the current font name and size +* +* @dev: vidconsole device +* @sizep: Place to put the font size (nominal height in pixels) +* Returns: Current font name +*/ +const char *(*get_font_size)(struct udevice *dev,uint *sizep); +/** * select_font() - Select a particular font by name / size *
@@ -303,9 +312,10 @@ void vidconsole_list_fonts(struct udevice *dev);* * @dev: vidconsole device * @sizep: Place to put the font size (nominal height in pixels) -* Returns: Current font name +* @name: pointer to font name, a placeholder for result +* Return: 0 if OK, -ENOSYS if not implemented in driver */ -const char *vidconsole_get_font_size (struct udevice *dev,uint *sizep); +int vidconsole_get_font_size (struct udevice *dev,const char **name,uint *sizep);#ifdef CONFIG_VIDEO_COPY /**
test/cmd/font.c +7 -6
@@ -19,6 +19,7 @@static int font_test_base (struct unit_test_state *uts) {struct udevice *dev; +const char *name;int max_metrics;uint size;int ret;
@@ -32,8 +33,8 @@ static int font_test_base(struct unit_test_state *uts)ut_assert_nextline ("cantoraone_regular" );ut_assertok (ut_check_console_end (uts)); -ut_asserteq_str ("nimbus_sans_l_regular" , -vidconsole_get_font_size (dev, &size)); +ut_assertok (vidconsole_get_font_size (dev, &name, &size)); +ut_asserteq_str ("nimbus_sans_l_regular" , name);ut_asserteq (18 , size); max_metrics =1 ;
@@ -52,15 +53,15 @@ static int font_test_base(struct unit_test_state *uts)ut_assertok (ret);ut_assertok (ut_check_console_end (uts)); -ut_asserteq_str ("cantoraone_regular" , -vidconsole_get_font_size (dev, &size)); +ut_assertok (vidconsole_get_font_size (dev, &name, &size)); +ut_asserteq_str ("cantoraone_regular" , name);ut_asserteq (40 , size);ut_assertok (run_command ("font size 30" ,0 ));ut_assertok (ut_check_console_end (uts)); -ut_asserteq_str ("cantoraone_regular" , -vidconsole_get_font_size (dev, &size)); +ut_assertok (vidconsole_get_font_size (dev, &name, &size)); +ut_asserteq_str ("cantoraone_regular" , name);ut_asserteq (30 , size);return 0 ;
Signature · 1 line
2.30.2
PATCH v8 10/10 video console: add 12x22 console simple font test
In reply to Dzmitry SankouskiTests fonts wider than a byte.
---
Changes in v8:
none
Changes in v7:
none
Changes in v6:
- rebase
- move sandbox defconfig change to separate patch
- run savedefconfig
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v2:
N/A
none
test/dm/video.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
test/dm/video.c +41 -0
@@ -151,6 +151,8 @@ static int dm_test_video_text(struct unit_test_state *uts)ut_assertok (select_vidconsole (uts,"vidconsole0" ));ut_assertok (video_get_nologo (uts, &dev)); +ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con)); +ut_assertok (vidconsole_select_font (con,"8x16" ,0 ));ut_asserteq (46 ,compress_frame_buffer (uts, dev));ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con));
@@ -175,6 +177,42 @@ static int dm_test_video_text(struct unit_test_state *uts) }DM_TEST (dm_test_video_text,UT_TESTF_SCAN_PDATA |UT_TESTF_SCAN_FDT ); +static int dm_test_video_text_12x22 (struct unit_test_state *uts) +{ +struct udevice *dev, *con; +int i; + +#define WHITE 0xffff +#define SCROLL_LINES 100 + +ut_assertok (select_vidconsole (uts,"vidconsole0" )); +ut_assertok (video_get_nologo (uts, &dev)); +ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con)); +ut_assertok (vidconsole_select_font (con,"12x22" ,0 )); +ut_asserteq (46 ,compress_frame_buffer (uts, dev)); + +ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con)); +vidconsole_putc_xy (con,0 ,0 ,'a' ); +ut_asserteq (89 ,compress_frame_buffer (uts, dev)); + +vidconsole_putc_xy (con,0 ,0 ,' ' ); +ut_asserteq (46 ,compress_frame_buffer (uts, dev)); + +for (i =0 ; i <20 ; i++) +vidconsole_putc_xy (con,VID_TO_POS (i *8 ),0 ,' ' + i); +ut_asserteq (363 ,compress_frame_buffer (uts, dev)); + +vidconsole_set_row (con,0 ,WHITE ); +ut_asserteq (46 ,compress_frame_buffer (uts, dev)); + +for (i =0 ; i <20 ; i++) +vidconsole_putc_xy (con,VID_TO_POS (i *8 ),0 ,' ' + i); +ut_asserteq (363 ,compress_frame_buffer (uts, dev)); + +return 0 ; +} +DM_TEST (dm_test_video_text_12x22,UT_TESTF_SCAN_PDATA |UT_TESTF_SCAN_FDT ); +/* Test handling of special characters in the console */ static int dm_test_video_chars (struct unit_test_state *uts) {
@@ -184,6 +222,7 @@ static int dm_test_video_chars(struct unit_test_state *uts)ut_assertok (select_vidconsole (uts,"vidconsole0" ));ut_assertok (video_get_nologo (uts, &dev));ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con)); +ut_assertok (vidconsole_select_font (con,"8x16" ,0 ));vidconsole_put_string (con, test_string);ut_asserteq (466 ,compress_frame_buffer (uts, dev));
@@ -201,6 +240,7 @@ static int dm_test_video_ansi(struct unit_test_state *uts)ut_assertok (select_vidconsole (uts,"vidconsole0" ));ut_assertok (video_get_nologo (uts, &dev));ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con)); +ut_assertok (vidconsole_select_font (con,"8x16" ,0 ));/* reference clear: */ video_clear (con->parent);
@@ -249,6 +289,7 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot,ut_assertok (video_get_nologo (uts, &dev));ut_assertok (uclass_get_device (UCLASS_VIDEO_CONSOLE ,0 , &con)); +ut_assertok (vidconsole_select_font (con,"8x16" ,0 ));ut_asserteq (46 ,compress_frame_buffer (uts, dev));/* Check display wrap */
Signature · 1 line
2.30.2
PATCH v8 9/10 video console: sandbox: add 12x22 font defconfigs
In reply to Dzmitry SankouskiAdd 12x22 font in order to write a test for it.
---
Changes in v8:
- add 12X22 font in sandbox_flattree_defconfig for tests
Changes in v7:
none
Changes in v6:
N/A
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
N/A
Changes in v2:
N/A
configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/sandbox_defconfig +1 -0
@@ -298,6 +298,7 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_ETHER=y CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y +CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y CONFIG_CONSOLE_ROTATION=y CONFIG_CONSOLE_TRUETYPE=y
configs/sandbox_flattree_defconfig +1 -0
@@ -206,6 +206,7 @@ CONFIG_USB=y CONFIG_USB_EMUL=y CONFIG_USB_KEYBOARD=y CONFIG_VIDEO=y +CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_CONSOLE_ROTATION=y CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y
Signature · 1 line
2.30.2
PATCH v8 7/10 video console: add 12x22 Sun font from linux
In reply to Dzmitry SankouskiModern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.
---
Changes in v8:
none
Changes in v7:
none
Changes in v6:
rebase only
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
none
Changes in v2:
N/A
drivers/video/Kconfig | 7 + include/video_font.h | 6 + include/video_font_sun12x22.h | 6158 +++++++++++++++++++++++++++++++++ 3 files changed, 6171 insertions(+) create mode 100644 include/video_font_sun12x22.h
drivers/video/Kconfig +7 -0
@@ -31,6 +31,13 @@ config VIDEO_FONT_8X16 Provides character bitmap data in header file. When selecting multiple fonts, you may want to enable CMD_SELECT_FONT too. +config VIDEO_FONT_SUN12X22 + bool "12 x 22 font size" + help + Font for video console driver, 12 x 22 pixels + Provides character bitmap data in header file. + When selecting multiple fonts, you may want to enable CMD_SELECT_FONT too. + config VIDEO_LOGO bool "Show the U-Boot logo on the display" default y if !SPLASH_SCREEN
include/video_font.h +6 -0
@@ -15,6 +15,9 @@#if defined(CONFIG_VIDEO_FONT_8X16 )#include <video_font_8x16.h> #endif +#if defined(CONFIG_VIDEO_FONT_SUN12X22 ) +#include <video_font_sun12x22.h> +#endif static struct video_fontdata __maybe_unused fonts[] = {#if defined(CONFIG_VIDEO_FONT_8X16 )
@@ -22,6 +25,9 @@ static struct video_fontdata __maybe_unused fonts[] = {#endif #if defined(CONFIG_VIDEO_FONT_4X6 ) FONT_ENTRY(4, 6, 4x6), +#endif +#if defined(CONFIG_VIDEO_FONT_SUN12X22 ) + FONT_ENTRY(12, 22, 12x22),#endif {/* list terminator */ } };
include/video_font_sun12x22.h new file +6158 -0
2,969 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.30.2
Part of the diff is not shown here. View the raw message.
PATCH v8 8/10 video console: add 16x32 Terminus font from linux
In reply to Dzmitry SankouskiModern mobile phones typically have high pixel density. Bootmenu is hardly readable on those with 8x16 font.
---
Changes in v8:
none
Changes in v7:
none
Changes in v6:
rebase only
Changes in v5:
N/A
Changes in v4:
N/A
Changes in v3:
none
Changes in v2:
- edit for runtime configuration
drivers/video/Kconfig | 7 + include/video_font.h | 6 + include/video_font_ter16x32.h | 2062 +++++++++++++++++++++++++++++++++ 3 files changed, 2075 insertions(+) create mode 100644 include/video_font_ter16x32.h
drivers/video/Kconfig +7 -0
@@ -38,6 +38,13 @@ config VIDEO_FONT_SUN12X22 Provides character bitmap data in header file. When selecting multiple fonts, you may want to enable CMD_SELECT_FONT too. +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. + When selecting multiple fonts, you may want to enable CMD_SELECT_FONT too. + config VIDEO_LOGO bool "Show the U-Boot logo on the display" default y if !SPLASH_SCREEN
include/video_font.h +6 -0
@@ -18,6 +18,9 @@#if defined(CONFIG_VIDEO_FONT_SUN12X22 )#include <video_font_sun12x22.h> #endif +#if defined(CONFIG_VIDEO_FONT_16X32 ) +#include <video_font_ter16x32.h> +#endif static struct video_fontdata __maybe_unused fonts[] = {#if defined(CONFIG_VIDEO_FONT_8X16 )
@@ -28,6 +31,9 @@ static struct video_fontdata __maybe_unused fonts[] = {#endif #if defined(CONFIG_VIDEO_FONT_SUN12X22 ) FONT_ENTRY(12, 22, 12x22), +#endif +#if defined(CONFIG_VIDEO_FONT_16X32 ) + FONT_ENTRY(16, 32, 16x32),#endif {/* list terminator */ } };
include/video_font_ter16x32.h new file +2062 -0
2,062 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH v8 04/10] video console: implement multiple fonts configuration
In reply to Dzmitry SankouskiOn Tue, 7 Mar 2023 13:21:14 +0300
Dzmitry Sankouski [email protected] wrote:
...
Quoted 10 lines
common/splash.c +0
-6@@ -138,13 +139,15 @@ void splash_display_banner(void)if (ret)return ; -#ifdef CONFIG_VIDEO_LOGO - col =BMP_LOGO_WIDTH /VIDEO_FONT_WIDTH +1 ; - row =BMP_LOGO_HEIGHT /VIDEO_FONT_HEIGHT +1 ; -#else - col =0 ; - row =0 ;
common/splash.c void splash_display_banner(void) · line 150
Quoted 10 lines
common/splash.c +9
-1-#endif +if (IS_ENABLED (CONFIG_VIDEO_LOGO )) { +struct video_fontdata *fontdata = fonts; + + col =BMP_LOGO_WIDTH / fontdata->width +1 ; + row =BMP_LOGO_HEIGHT / fontdata->height +1 ; + }else { + col =0 ; + row =0 ; + }
there was another build error for boards with CONFIG_VIDEO_LOGO disabled:
https://source.denx.de/u-boot/custodians/u-boot-video/-/jobs/589501#L1430
I changed this to
void splash_display_banner(void)
{
+ struct video_fontdata __maybe_unused *fontdata = fonts;
struct udevice *dev;
char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
int col, row, ret;
@@ -138,9 +140,9 @@ void splash_display_banner(void)
if (ret)
return;-#ifdef CONFIG_VIDEO_LOGO
- col = BMP_LOGO_WIDTH / VIDEO_FONT_WIDTH + 1;
- row = BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT + 1;
+#if IS_ENABLED(CONFIG_VIDEO_LOGO)
+ col = BMP_LOGO_WIDTH / fontdata->width + 1;
+ row = BMP_LOGO_HEIGHT / fontdata->height + 1;
#else
col = 0;
row = 0;--
Anatolij
Re: [PATCH v8 04/10] video console: implement multiple fonts configuration
вт, 7 мар. 2023 г. в 18:22, Anatolij Gustschin <[email protected]>:
(...)
Quoted 19 lines
there was another build error for boards with
CONFIG_VIDEO_LOGOdisabled:https://source.denx.de/u-boot/custodians/u-boot-video/-/jobs/589501#L1430
I changed this to
void
splash_display_banner(void)
{common/splash.c +1
-1+struct video_fontdata __maybe_unused *fontdata = fonts;struct udevice *dev;char buf[DISPLAY_OPTIONS_BANNER_LENGTH ];int col, row, ret;@@ -138,9 +140,9 @@ void splash_display_banner(void)if (ret)return ; -#ifdef CONFIG_VIDEO_LOGO
common/splash.c void splash_display_banner(void)
Quoted 10 lines
common/splash.c +3
-3- col =BMP_LOGO_WIDTH /VIDEO_FONT_WIDTH +1 ; - row =BMP_LOGO_HEIGHT /VIDEO_FONT_HEIGHT +1 ; +#if IS_ENABLED (CONFIG_VIDEO_LOGO ) + col =BMP_LOGO_WIDTH / fontdata->width +1 ; + row =BMP_LOGO_HEIGHT / fontdata->height +1 ;#else col =0 ; row =0 ; --
should I send v9 with this patch?
Re: [PATCH v8 04/10] video console: implement multiple fonts configuration
Quoted 30 lines · On Fri, 10 Mar 2023 11:35:12 +0300 Dzmitry Sankouski [email protected] wrote:
вт, 7 мар. 2023 г. в 18:22, Anatolij Gustschin <[email protected]>:
(...)Quoted 28 lines
there was another build error for boards with
CONFIG_VIDEO_LOGOdisabled:https://source.denx.de/u-boot/custodians/u-boot-video/-/jobs/589501#L1430
I changed this to
void
splash_display_banner(void)
{common/splash.c +4
-3+struct video_fontdata __maybe_unused *fontdata = fonts;struct udevice *dev;char buf[DISPLAY_OPTIONS_BANNER_LENGTH ];int col, row, ret;@@ -138,9 +140,9 @@ void splash_display_banner(void)if (ret)return ; -#ifdef CONFIG_VIDEO_LOGO - col =BMP_LOGO_WIDTH /VIDEO_FONT_WIDTH +1 ; - row =BMP_LOGO_HEIGHT /VIDEO_FONT_HEIGHT +1 ; +#if IS_ENABLED (CONFIG_VIDEO_LOGO ) + col =BMP_LOGO_WIDTH / fontdata->width +1 ; + row =BMP_LOGO_HEIGHT / fontdata->height +1 ;#else col =0 ; row =0 ;
Quoted 2 lines
Quoted 1 line
should I send v9 with this patch?
No, I fixed patch 4/10 when applying. Thanks!
--
Anatolij
On Tue, 7 Mar 2023 13:21:10 +0300
Dzmitry Sankouski [email protected] wrote:
...
Quoted 37 lines
Changes in v8:
- fix build with disabledCONFIG_VIDEO_COPY
- add 12X22 font to sandox defconfigDzmitry Sankouski (10):
video console: refactoring and optimization
video console: add support for fonts wider than 1 byte video console: move 8x16 font data in named header video console: implement multiple fonts configuration video console: movevidconsole_get_font_size()logic to driver ops video console: allow font size configuration at runtime video console: add 12x22 Sun font from linux
video console: add 16x32 Terminus font from linux
video console: sandbox: add 12x22 font defconfigs
video console: add 12x22 console simple font testcmd/Kconfig | 8 + cmd/Makefile | 2 +- cmd/font.c | 6 +- common/splash.c | 17 +- configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + drivers/video/Kconfig | 30 + drivers/video/Makefile | 6 + drivers/video/console_core.c | 212 + drivers/video/console_normal.c | 177 +- drivers/video/console_rotate.c | 371 +- drivers/video/console_truetype.c | 3 +- drivers/video/vidconsole-uclass.c | 11 + drivers/video/vidconsole_internal.h | 120 + include/video_console.h | 17 +- include/video_font.h | 31 +- include/video_font_4x6.h | 11 +- include/video_font_8x16.h | 4624 ++++++++++++++++++++ include/video_font_data.h | 4644 +------------------- include/video_font_sun12x22.h | 6158 +++++++++++++++++++++++++++ include/video_font_ter16x32.h | 2062 +++++++++
Quoted 8 lines
test/cmd/font.c | 13 +- test/dm/video.c | 41 + 23 files changed, 13518 insertions(+), 5048 deletions(-) create mode 100644 drivers/video/console_core.c create mode 100644 drivers/video/vidconsole_internal.h create mode 100644 include/video_font_8x16.h create mode 100644 include/video_font_sun12x22.h create mode 100644 include/video_font_ter16x32.h
Series applied to u-boot-video/next, thanks!
--
Anatolij