public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] vc,fbcon,fonts: Proper handling of font data
@ 2026-02-18  8:15 Thomas Zimmermann
  2026-02-18  8:15 ` [PATCH 01/13] fbdev: Declare src parameter of fb_pad_ helpers as constant Thomas Zimmermann
                   ` (12 more replies)
  0 siblings, 13 replies; 18+ messages in thread
From: Thomas Zimmermann @ 2026-02-18  8:15 UTC (permalink / raw)
  To: gregkh, deller, sam
  Cc: linux-fbdev, dri-devel, linux-kernel, Thomas Zimmermann

Provide helpers for handling console font data. Update consoles and VT.

VT's vc_state stores fotn data as a plain byte array of glphys. Fbcon,
newport_con and the kernel's internal fonts store the glyph data as an
array of plain bytes plus a hidden header for refcounting, check sums and
buffer sizes. The refcounting only works for user-space fonts but not
for internal fonts. Font-data handling is duplicated in several places.
Most of the font handling is open-coded and mixed up with VT's plain glyph
arrays.

To addiress these issues, add proper handling of font data to all involved
components: struct vc_font for font state in VC; a font data type for the
consoles. Then implement interfaces for handling font data one by one.

Patch 1 prepares the fbdev interface.

Patches 2 to 4 prepare VT's font handling.

Patches 5 to 13 refactor fbcon and newport_con to use clean interfaces for
their fonts.

Fbcon has long been a source of problems and bug reports. [1] With its
confusing implementation, it is hard to find the cause of these bugs.
Cleaning up the fbcon code will hopefully help with resolving bug reports
in the future.

The series has been tested with fbcon under DRM's bochs driver by changing
fonts at runtime useing the setfont utility. The changes to newport_con have
only been tested to compile.

[1] https://lore.kernel.org/all/6992c84c.a70a0220.2c38d7.00e8.GAE@google.com/
[2] https://www.man7.org/linux/man-pages/man8/setfont.8.html

Thomas Zimmermann (13):
  fbdev: Declare src parameter of fb_pad_ helpers as constant
  vt: Remove trailing whitespaces
  vt: Store font in struct vc_font
  vt: Calculate font-buffer size with vc_font_size()
  lib/fonts: Remove trailing whitespaces
  lib/fonts: Remove FNTCHARCNT()
  lib/fonts: Store font data as font_data_t; update consoles
  lib/fonts: Read font size with font_data_size()
  lib/fonts: Compare font data for equality with font_data_is_equal()
  lib/fonts: Manage font-data lifetime with font_data_get/_put()
  lib/fonts: Create font_data_t from struct console_font with
    font_data_import()
  lib/fonts: Store font data for user space with font_data_export()
  lib/fonts: Remove internal symbols and macros from public header file

 drivers/video/console/newport_con.c |  61 +++----
 drivers/video/fbdev/core/bitblit.c  |  11 +-
 drivers/video/fbdev/core/fbcon.c    | 194 +++++++----------------
 drivers/video/fbdev/core/fbcon.h    |   8 +-
 drivers/video/fbdev/core/fbmem.c    |   6 +-
 include/linux/console_struct.h      |  59 ++++++-
 include/linux/fb.h                  |  10 +-
 include/linux/font.h                |  90 +++++++----
 lib/fonts/font.h                    |  52 ++++++
 lib/fonts/font_10x18.c              |   2 +-
 lib/fonts/font_6x10.c               |   3 +-
 lib/fonts/font_6x11.c               |   2 +-
 lib/fonts/font_6x8.c                |   3 +-
 lib/fonts/font_7x14.c               |   2 +-
 lib/fonts/font_8x16.c               |   3 +-
 lib/fonts/font_8x8.c                |   2 +-
 lib/fonts/font_acorn_8x8.c          |   4 +-
 lib/fonts/font_mini_4x6.c           |  10 +-
 lib/fonts/font_pearl_8x8.c          |   2 +-
 lib/fonts/font_sun12x22.c           |   3 +-
 lib/fonts/font_sun8x16.c            |   3 +-
 lib/fonts/font_ter10x18.c           |   4 +-
 lib/fonts/font_ter16x32.c           |   4 +-
 lib/fonts/fonts.c                   | 236 +++++++++++++++++++++++++++-
 24 files changed, 521 insertions(+), 253 deletions(-)
 create mode 100644 lib/fonts/font.h


base-commit: 0082025812a31eda451fb14f13f52683ed375c49
-- 
2.52.0


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-03-02 13:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18  8:15 [PATCH 00/13] vc,fbcon,fonts: Proper handling of font data Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 01/13] fbdev: Declare src parameter of fb_pad_ helpers as constant Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 02/13] vt: Remove trailing whitespaces Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 03/13] vt: Store font in struct vc_font Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 04/13] vt: Calculate font-buffer size with vc_font_size() Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 05/13] lib/fonts: Remove trailing whitespaces Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 06/13] lib/fonts: Remove FNTCHARCNT() Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 07/13] lib/fonts: Store font data as font_data_t; update consoles Thomas Zimmermann
2026-02-18  8:15 ` [PATCH 08/13] lib/fonts: Read font size with font_data_size() Thomas Zimmermann
2026-02-18  8:16 ` [PATCH 09/13] lib/fonts: Compare font data for equality with font_data_is_equal() Thomas Zimmermann
2026-02-18  8:16 ` [PATCH 10/13] lib/fonts: Manage font-data lifetime with font_data_get/_put() Thomas Zimmermann
2026-02-18  8:16 ` [PATCH 11/13] lib/fonts: Create font_data_t from struct console_font with font_data_import() Thomas Zimmermann
2026-02-18  8:16 ` [PATCH 12/13] lib/fonts: Store font data for user space with font_data_export() Thomas Zimmermann
2026-02-18  8:16 ` [PATCH 13/13] lib/fonts: Remove internal symbols and macros from public header file Thomas Zimmermann
2026-02-18 21:47   ` kernel test robot
2026-02-19  2:08   ` kernel test robot
2026-02-23 15:05   ` Helge Deller
2026-03-02 13:45     ` Thomas Zimmermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox