fbconsole: switch to lib/fonts framework
Subsystems (3)
cover fbconsole: switch to lib/fonts framework
Antony Pavlov (5):
for-ammend: fbconsole: FBCONSOLE -> FRAMEBUFFER_CONSOLE import lib/fonts framework from linux kernel
for-ammend: video: fbconsole: switch to lib/fonts framework lib/fonts: add "MINI4x6" font
video: fbconsole: switch to "MINI4x6" font: just for demo purposes
drivers/video/Kconfig | 2 +- drivers/video/Makefile | 2 +- drivers/video/fbconsole.c | 44 +- include/linux/font.h | 29 + lib/Kconfig | 2 + lib/Makefile | 1 + lib/fonts/Kconfig | 25 + lib/fonts/Makefile | 10 + include/video_font_data.h => lib/fonts/font_8x16.c | 479 ++--- lib/fonts/font_mini_4x6.c | 2155 ++++++++++++++++++++ lib/fonts/fonts.c | 66 + 11 files changed, 2559 insertions(+), 256 deletions(-) create mode 100644 include/linux/font.h create mode 100644 lib/fonts/Kconfig create mode 100644 lib/fonts/Makefile rename include/video_font_data.h => lib/fonts/font_8x16.c (94%) create mode 100644 lib/fonts/font_mini_4x6.c create mode 100644 lib/fonts/fonts.c
Signature · 7 lines
2.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/5 for-ammend: fbconsole: FBCONSOLE -> FRAMEBUFFER_CONSOLE
linux kernel uses FRAMEBUFFER_CONSOLE option name.
--- drivers/video/Kconfig | 2 +- drivers/video/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/video/Kconfig +1 -1
@@ -5,7 +5,7 @@ menuconfig VIDEO if VIDEO -config FBCONSOLE +config FRAMEBUFFER_CONSOLE bool select IMAGE_RENDERER prompt "framebuffer console support"
drivers/video/Makefile +1 -1
@@ -3,7 +3,7 @@ obj-$(CONFIG_DRIVER_VIDEO_EDID) += edid.o obj-$(CONFIG_OFDEVICE) += of_display_timing.o obj-$(CONFIG_DRIVER_VIDEO_BACKLIGHT) += backlight.o obj-$(CONFIG_DRIVER_VIDEO_BACKLIGHT_PWM) += backlight-pwm.o -obj-$(CONFIG_FBCONSOLE) += fbconsole.o +obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbconsole.o obj-$(CONFIG_DRIVER_VIDEO_ATMEL) += atmel_lcdfb.o atmel_lcdfb_core.o obj-$(CONFIG_DRIVER_VIDEO_ATMEL_HLCD) += atmel_hlcdfb.o atmel_lcdfb_core.o
Signature · 7 lines
2.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/5 import lib/fonts framework from linux kernel
In reply to Antony Pavlov--- include/linux/font.h | 28 + lib/Kconfig | 2 + lib/Makefile | 1 + lib/fonts/Kconfig | 21 + lib/fonts/Makefile | 9 + lib/fonts/font_8x16.c | 4630 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/fonts/fonts.c | 62 + 7 files changed, 4753 insertions(+)
include/linux/font.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* font.h -- `Soft' font definitions +* +* Created 1995 by Geert Uytterhoeven +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file COPYING in the main directory of this archive +* for more details. +*/ + +#ifndef _VIDEO_FONT_H +#define _VIDEO_FONT_H + +struct font_desc { +const char *name; +int width, height; +const void *data; +}; + +extern const struct font_desc font_vga_8x16; + +/* Find a font with a specific name */ +extern const struct font_desc *find_font (const char *name); + +/* Max. length for the name of a predefined font */ +#define MAX_FONT_NAME 32 + +#endif /* _VIDEO_FONT_H */
lib/Kconfig +2 -0
@@ -57,6 +57,8 @@ config STMP_DEVICE source lib/gui/Kconfig +source lib/fonts/Kconfig + source lib/bootstrap/Kconfig config PRINTF_UUID
lib/Makefile +1 -0
@@ -54,3 +54,4 @@ obj-y += libfile.o obj-y += bitmap.o obj-y += gcd.o obj-y += hexdump.o +obj-$(CONFIG_FONTS) += fonts/
lib/fonts/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +# +# Font configuration +# + +config FONTS + bool "Select compiled-in fonts" + depends on FRAMEBUFFER_CONSOLE + +if FONTS + +config FONT_8x16 + bool "VGA 8x16 font" + help + This is the "high resolution" font for the VGA frame buffer (the one + provided by the VGA text console 80x25 mode). + +config FONT_AUTOSELECT + def_bool y + select FONT_8x16 + +endif # FONTS
lib/fonts/Makefile new file +9 -0
@@ -0,0 +1,9 @@ +# Font handling + +font-objs := fonts.o + +font-objs-$(CONFIG_FONT_8x16) += font_8x16.o + +font-objs += $(font-objs-y) + +obj-$(CONFIG_FONTS) += font.o
lib/fonts/font_8x16.c new file +4630 -0
2,930 lines not on this page · raw message
lib/fonts/fonts.c new file +62 -0
62 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.1.4
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Part of the diff is not shown here. View the raw message.
PATCH 3/5 for-ammend: video: fbconsole: switch to lib/fonts framework
In reply to Antony Pavlov--- drivers/video/fbconsole.c | 44 +- include/video_font_data.h | 4627 --------------------------------------------- 2 files changed, 28 insertions(+), 4643 deletions(-)
drivers/video/fbconsole.c +28 -16
@@ -5,9 +5,7 @@#include <fb.h> #include <gui/image_renderer.h> #include <gui/graphic_utils.h> - -/* 8x16 font from U-Boot */ -#include <video_font_data.h> +#include <linux/font.h> enum state_t {LIT ,/* Literal input */
@@ -22,7 +20,11 @@ struct fbc_priv {struct fb_info *fb;struct screen sc; +/* FIXME */ +#define VIDEO_FONT_CHARS 256struct image *chars[VIDEO_FONT_CHARS ]; +int font_width, font_height; +const void *fontdata;unsigned int cols, rows;unsigned int x, y;/* cursor position */
@@ -51,26 +53,26 @@ static void drawchar(struct fbc_priv *priv, int x, int y, char c)int bpp = priv->fb->bits_per_pixel >>3 ;void *adr;int i; -char *inbuf; +const char *inbuf;int line_length;u32 color, bgcolor; buf =gui_screen_redering_buffer (&priv->sc); - inbuf = &video_fontdata[c *VIDEO_FONT_HEIGHT ]; + inbuf = &priv->fontdata[c * priv->font_height]; line_length = priv->fb->line_length; color = priv->invert ?0xff000000 : priv->color; bgcolor = priv->invert ? priv->color :0xff000000 ; -for (i =0 ; i <VIDEO_FONT_HEIGHT ; i++) { +for (i =0 ; i < priv->font_height; i++) {uint8_t t = inbuf[i];int j; - adr = buf + line_length * (y *VIDEO_FONT_HEIGHT + i) + x *VIDEO_FONT_WIDTH * bpp; + adr = buf + line_length * (y * priv->font_height + i) + x * priv->font_width * bpp; -for (j =0 ; j <VIDEO_FONT_WIDTH ; j++) { +for (j =0 ; j < priv->font_width; j++) {if (t &0x80 )set_pixel (priv->fb, adr, color);else
@@ -91,8 +93,8 @@ static void video_invertchar(struct fbc_priv *priv, int x, int y) buf =gui_screen_redering_buffer (&priv->sc); -invert_area (priv->fb, buf, x *VIDEO_FONT_WIDTH , y *VIDEO_FONT_HEIGHT , -VIDEO_FONT_WIDTH ,VIDEO_FONT_HEIGHT ); +invert_area (priv->fb, buf, x * priv->font_width, y * priv->font_height, + priv->font_width, priv->font_height); }static void printchar (struct fbc_priv *priv,int c)
@@ -137,13 +139,12 @@ static void printchar(struct fbc_priv *priv, int c)if (priv->y > priv->rows) {void *buf;u32 line_length = priv->fb->line_length; +int line_height = line_length * priv->font_height; buf =gui_screen_redering_buffer (&priv->sc); -memcpy (buf, buf + line_length *VIDEO_FONT_HEIGHT , - line_length *VIDEO_FONT_HEIGHT * (priv->rows +1 )); -memset (buf + line_length *VIDEO_FONT_HEIGHT * priv->rows, -0 , line_length *VIDEO_FONT_HEIGHT ); +memcpy (buf, buf + line_height, line_height * (priv->rows +1 )); +memset (buf + line_height * priv->rows,0 , line_height); priv->y = priv->rows; }
@@ -272,8 +273,19 @@ static int fbc_set_active(struct console_device *cdev, unsigned flags)struct fb_info *fb = priv->fb;int fd; - priv->rows = fb->yres /VIDEO_FONT_HEIGHT -1 ; - priv->cols = fb->xres /VIDEO_FONT_WIDTH -1 ; +const struct font_desc *font; + + font =find_font ("VGA8x16" ); +if (!font) { +return -ENOENT ; + } + + priv->font_width = font->width; + priv->font_height = font->height; + priv->fontdata = font->data; + + priv->rows = fb->yres / priv->font_height -1 ; + priv->cols = fb->xres / priv->font_width -1 ;/* FIXME */ fd =fb_open ("/dev/fb0" , &priv->sc,0 );
include/video_font_data.h deleted +0 -4627
2,901 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
2.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Part of the diff is not shown here. View the raw message.
PATCH 4/5 lib/fonts: add "MINI4x6" font
In reply to Antony Pavlov--- include/linux/font.h | 3 +- lib/fonts/Kconfig | 4 + lib/fonts/Makefile | 1 + lib/fonts/font_mini_4x6.c | 2155 +++++++++++++++++++++++++++++++++++++++++++++ lib/fonts/fonts.c | 4 + 5 files changed, 2166 insertions(+), 1 deletion(-)
include/linux/font.h +2 -1
@@ -17,7 +17,8 @@ struct font_desc {const void *data; }; -extern const struct font_desc font_vga_8x16; +extern const struct font_desc font_vga_8x16, + font_mini_4x6;/* Find a font with a specific name */ extern const struct font_desc *find_font (const char *name);
lib/fonts/Kconfig +4 -0
@@ -14,8 +14,12 @@ config FONT_8x16 This is the "high resolution" font for the VGA frame buffer (the one provided by the VGA text console 80x25 mode). +config FONT_MINI_4x6 + bool "Mini 4x6 font" + config FONT_AUTOSELECT def_bool y + depends on !FONT_MINI_4x6 select FONT_8x16 endif # FONTS
lib/fonts/Makefile +1 -0
@@ -3,6 +3,7 @@ font-objs := fonts.o font-objs-$(CONFIG_FONT_8x16) += font_8x16.o +font-objs-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o font-objs += $(font-objs-y)
lib/fonts/font_mini_4x6.c new file +2155 -0
2,155 lines not on this page · raw message
lib/fonts/fonts.c +4 -0
@@ -25,6 +25,10 @@ static const struct font_desc *fonts[] = {#undef NO_FONTS &font_vga_8x16,#endif +#ifdef CONFIG_FONT_MINI_4x6 +#undef NO_FONTS + &font_mini_4x6, +#endif };#define num_fonts ARRAY_SIZE(fonts)
Signature · 7 lines
2.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/5 video: fbconsole: switch to "MINI4x6" font: just for demo purposes
In reply to Antony Pavlov--- drivers/video/fbconsole.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbconsole.c +1 -1
@@ -275,7 +275,7 @@ static int fbc_set_active(struct console_device *cdev, unsigned flags)const struct font_desc *font; - font =find_font ("VGA8x16" ); + font =find_font ("MINI4x6" );if (!font) {return -ENOENT ; }
Signature · 7 lines
2.1.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Antony,
Quoted 6 lines · Antony Pavlov
Antony Pavlov (5):
for-ammend: fbconsole: FBCONSOLE ->FRAMEBUFFER_CONSOLEimport lib/fonts framework from linux kernel
for-ammend: video: fbconsole: switch to lib/fonts framework lib/fonts: add "MINI4x6" font
video: fbconsole: switch to "MINI4x6" font: just for demo purposes
I merged this into the next branch. I don't really consider this ready now, but I think we can use the branch to continue working on it.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox