Commit afac4c66 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull fbdev updates from Helge Deller:
 "A major refactorization by Thomas Zimmermann from SUSE regarding
  handling of console font data, addition of helpers for console font
  rotation and split into individual components for glyphs, fonts and
  the overall fbcon state.

  And there is the round of usual code cleanups and fixes:

  Cleanups:
   - atyfb: Remove unused fb_list (Geert Uytterhoeven)
   - goldfishfb, wmt_ge_rops: use devm_platform_ioremap_resource() (Amin GATTOUT)
   - matroxfb: Mark variable with __maybe_unused (Andy Shevchenko)
   - omapfb: Add missing error check for clk_get() (Chen Ni)
   - tdfxfb: Make the VGA register initialisation a bit more obvious (Daniel Palmer)
   - macfb: Replace deprecated strcpy with strscpy (Thorsten Blum)

  Fixes:
   - tdfxfb, udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO (Greg Kroah-Hartman)
   - omap2: fix inconsistent lock returns in omapfb_mmap (Hongling Zeng)
   - viafb: check ioremap return value in viafb_lcd_get_mobile_state (Wang Jun)"

* tag 'fbdev-for-7.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: (40 commits)
  fbdev: udlfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
  fbdev: tdfxfb: avoid divide-by-zero on FBIOPUT_VSCREENINFO
  fbdev: omap2: fix inconsistent lock returns in omapfb_mmap
  MAINTAINERS: Add dedicated entry for fbcon
  fbcon: Put font-rotation state into separate struct
  fbcon: Fill cursor mask in helper function
  lib/fonts: Implement font rotation
  lib/fonts: Refactor glyph-rotation helpers
  lib/fonts: Refactor glyph-pattern helpers
  lib/fonts: Implement glyph rotation
  lib/fonts: Clean up Makefile
  lib/fonts: Provide helpers for calculating glyph pitch and size
  vt: Implement helpers for struct vc_font in source file
  fbcon: Avoid OOB font access if console rotation fails
  fbdev: atyfb: Remove unused fb_list
  fbdev: matroxfb: Mark variable with __maybe_unused to avoid W=1 build break
  fbdev: update help text for CONFIG_FB_NVIDIA
  fbdev: omapfb: Add missing error check for clk_get()
  fbdev: viafb: check ioremap return value in viafb_lcd_get_mobile_state
  lib/fonts: Remove internal symbols and macros from public header file
  ...
parents 00c6649b a31e4518
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -10073,6 +10073,29 @@ S: Maintained
W:	https://floatingpoint.billm.au/
F:	arch/x86/math-emu/
FRAMEBUFFER CONSOLE
M:	Helge Deller <deller@gmx.de>
M:	Thomas Zimmermann <tzimmermann@suse.de>
L:	dri-devel@lists.freedesktop.org
L:	linux-fbdev@vger.kernel.org
S:	Maintained
T:	git https://gitlab.freedesktop.org/drm/misc/kernel.git
F:	Documentation/fb/fbcon.rst
F:	drivers/video/fbdev/core/bitblit.c
F:	drivers/video/fbdev/core/fb_logo.c
F:	drivers/video/fbdev/core/fbcon.c
F:	drivers/video/fbdev/core/fbcon.h
F:	drivers/video/fbdev/core/fbcon_ccw.c
F:	drivers/video/fbdev/core/fbcon_cw.c
F:	drivers/video/fbdev/core/fbcon_rotate.c
F:	drivers/video/fbdev/core/fbcon_rotate.h
F:	drivers/video/fbdev/core/fbcon_ud.c
F:	drivers/video/fbdev/core/softcursor.c
F:	drivers/video/fbdev/core/tileblit.c
F:	include/linux/fbcon.h
F:	include/linux/font.h
F:	lib/fonts/
FRAMEBUFFER CORE
M:	Simona Vetter <simona@ffwll.ch>
S:	Odd Fixes
+34 −0
Original line number Diff line number Diff line
@@ -230,6 +230,40 @@ enum {
	blank_vesa_wait,
};

/*
 * struct vc_font
 */

/**
 * vc_font_pitch - Calculates the number of bytes between two adjacent scanlines
 * @font: The VC font
 *
 * Returns:
 * The number of bytes between two adjacent scanlines in the font data
 */
unsigned int vc_font_pitch(const struct vc_font *font)
{
	return font_glyph_pitch(font->width);
}
EXPORT_SYMBOL_GPL(vc_font_pitch);

/**
 * vc_font_size - Calculates the size of the font data in bytes
 * @font: The VC font
 *
 * vc_font_size() calculates the number of bytes of font data in the
 * font specified by @font. The function calculates the size from the
 * font parameters.
 *
 * Returns:
 * The size of the font data in bytes.
 */
unsigned int vc_font_size(const struct vc_font *font)
{
	return font_glyph_size(font->width, font->height) * font->charcount;
}
EXPORT_SYMBOL_GPL(vc_font_size);

/*
 * /sys/class/tty/tty0/
 *
+19 −42
Original line number Diff line number Diff line
@@ -33,9 +33,9 @@

#define NEWPORT_LEN	0x10000

#define FONT_DATA ((unsigned char *)font_vga_8x16.data)
#define FONT_DATA font_vga_8x16.data

static unsigned char *font_data[MAX_NR_CONSOLES];
static font_data_t *font_data[MAX_NR_CONSOLES];

static struct newport_regs *npregs;
static unsigned long newport_addr;
@@ -370,9 +370,9 @@ static void newport_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
static void newport_putc(struct vc_data *vc, u16 charattr, unsigned int ypos,
			 unsigned int xpos)
{
	unsigned char *p;
	const unsigned char *p;

	p = &font_data[vc->vc_num][(charattr & 0xff) << 4];
	p = &font_data_buf(font_data[vc->vc_num])[(charattr & 0xff) << 4];
	charattr = (charattr >> 8) & 0xff;
	xpos <<= 3;
	ypos <<= 4;
@@ -400,7 +400,7 @@ static void newport_putcs(struct vc_data *vc, const u16 *s,
			  unsigned int count, unsigned int ypos,
			  unsigned int xpos)
{
	unsigned char *p;
	const unsigned char *p;
	unsigned int i;
	u16 charattr;

@@ -424,7 +424,7 @@ static void newport_putcs(struct vc_data *vc, const u16 *s,
				 NPORT_DMODE0_L32);

	for (i = 0; i < count; i++, xpos += 8) {
		p = &font_data[vc->vc_num][(scr_readw(s++) & 0xff) << 4];
		p = &font_data_buf(font_data[vc->vc_num])[(scr_readw(s++) & 0xff) << 4];

		newport_wait(npregs);

@@ -501,52 +501,32 @@ static int newport_set_font(int unit, const struct console_font *op,
{
	int w = op->width;
	int h = op->height;
	int size = h * op->charcount;
	int i;
	unsigned char *new_data, *data = op->data, *p;
	font_data_t *new_data;

	/* ladis: when I grow up, there will be a day... and more sizes will
	 * be supported ;-) */
	if ((w != 8) || (h != 16) || (vpitch != 32)
	    || (op->charcount != 256 && op->charcount != 512))
	if (w != 8 || h != 16 || (op->charcount != 256 && op->charcount != 512))
		return -EINVAL;

	if (!(new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size,
	     GFP_USER))) return -ENOMEM;

	new_data += FONT_EXTRA_WORDS * sizeof(int);
	FNTSIZE(new_data) = size;
	FNTCHARCNT(new_data) = op->charcount;
	REFCOUNT(new_data) = 0;	/* usage counter */
	FNTSUM(new_data) = 0;

	p = new_data;
	for (i = 0; i < op->charcount; i++) {
		memcpy(p, data, h);
		data += 32;
		p += h;
	}
	new_data = font_data_import(op, vpitch, NULL);
	if (IS_ERR(new_data))
		return PTR_ERR(new_data);

	/* check if font is already used by other console */
	for (i = 0; i < MAX_NR_CONSOLES; i++) {
		if (font_data[i] != FONT_DATA
		    && FNTSIZE(font_data[i]) == size
		    && !memcmp(font_data[i], new_data, size)) {
			kfree(new_data - FONT_EXTRA_WORDS * sizeof(int));
		if (font_data_is_equal(font_data[i], new_data)) {
			font_data_put(new_data);
			/* current font is the same as the new one */
			if (i == unit)
				return 0;
			new_data = font_data[i];
			font_data_get(new_data);
			break;
		}
	}
	/* old font is user font */
	if (font_data[unit] != FONT_DATA) {
		if (--REFCOUNT(font_data[unit]) == 0)
			kfree(font_data[unit] -
			      FONT_EXTRA_WORDS * sizeof(int));
	}
	REFCOUNT(new_data)++;

	font_data_put(font_data[unit]);
	font_data[unit] = new_data;

	return 0;
@@ -554,12 +534,9 @@ static int newport_set_font(int unit, const struct console_font *op,

static int newport_set_def_font(int unit, struct console_font *op)
{
	if (font_data[unit] != FONT_DATA) {
		if (--REFCOUNT(font_data[unit]) == 0)
			kfree(font_data[unit] -
			      FONT_EXTRA_WORDS * sizeof(int));
	font_data_put(font_data[unit]);
	font_data[unit] = FONT_DATA;
	}
	font_data_get(font_data[unit]);

	return 0;
}
+6 −4
Original line number Diff line number Diff line
@@ -668,10 +668,12 @@ config FB_NVIDIA
	select BITREVERSE
	select VGASTATE
	help
	  This driver supports graphics boards with the nVidia chips, TNT
	  and newer. For very old chipsets, such as the RIVA128, then use
	  the rivafb.
	  Say Y if you have such a graphics board.
	  This driver supports graphics boards with the nVidia chips, from TNT
	  through early GeForce generations (NV4–NV2x: Twintor, Twintor2, Celsius,
	  Kelvin).
	  Later architectures (Rankine and newer) are not reliably supported.
	  For very old chipsets, such as the RIVA128, use rivafb.
	  If unsure, say N.

	  To compile this driver as a module, choose M here: the
	  module will be called nvidiafb.
+0 −4
Original line number Diff line number Diff line
@@ -2324,8 +2324,6 @@ static void aty_calc_mem_refresh(struct atyfb_par *par, int xclk)
 * Initialisation
 */

static struct fb_info *fb_list = NULL;

#if defined(__i386__) && defined(CONFIG_FB_ATY_GENERIC_LCD)
static int atyfb_get_timings_from_lcd(struct atyfb_par *par,
				      struct fb_var_screeninfo *var)
@@ -2758,8 +2756,6 @@ static int aty_init(struct fb_info *info)
#endif
	}

	fb_list = info;

	PRINTKI("fb%d: %s frame buffer device on %s\n",
		info->node, info->fix.id, par->bus_type == ISA ? "ISA" : "PCI");
	return 0;
Loading