mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Thomas Zimmermann <tzimmermann@suse.de>,
	gregkh@linuxfoundation.org, sam@ravnborg.org
Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 03/13] vt: Store font in struct vc_font
Date: Tue, 3 Mar 2026 15:31:44 +0100	[thread overview]
Message-ID: <7e17139f-47bf-4fec-b13f-d4a1b3a7a62d@gmx.de> (raw)
In-Reply-To: <20260302141255.518657-4-tzimmermann@suse.de>

On 3/2/26 15:08, Thomas Zimmermann wrote:
> Replace struct console_font with struct vc_font for the type of the
> vc_font field of struct vc_data. Struct console_font is UAPI, which
> prevents further changes. Hence a new data type is required.
> 
> Struct console_font has a documented vertical pitch of 32 bytes. This
> is not the case after the font data has been loaded into the kernel.
> Changing the type of vc_font addresses this inconsistency.
> 
> The font data is now declared as constant, as it might come from the
> kernel's read-only section. There's some fallout throughout the console
> code where non-const variables refer to it. Fix them. A later update
> will declare the font data to a dedicated data type.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
>   drivers/video/fbdev/core/bitblit.c | 11 +++++------
>   drivers/video/fbdev/core/fbcon.c   |  4 ++--
>   drivers/video/fbdev/core/fbcon.h   |  4 ++--
>   include/linux/console_struct.h     | 29 +++++++++++++++++++++++++++--
>   4 files changed, 36 insertions(+), 12 deletions(-)
> 
....
> diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h
> index ebdb9750d348..7fdcae6ed49c 100644
> --- a/include/linux/console_struct.h
> +++ b/include/linux/console_struct.h
> @@ -13,8 +13,9 @@
>   #ifndef _LINUX_CONSOLE_STRUCT_H
>   #define _LINUX_CONSOLE_STRUCT_H
>   
> -#include <linux/wait.h>
> +#include <linux/math.h>
>   #include <linux/vt.h>
> +#include <linux/wait.h>
>   #include <linux/workqueue.h>
>   
>   struct uni_pagedict;
> @@ -58,6 +59,30 @@ struct vc_state {
>   	bool		reverse;
>   };
>   
> +/**
> + * struct vc_font - Describes a font
> + * @width: The width of a single glyph in bits
> + * @height: The height of a single glyph in scanlines
> + * @charcount: The number of glyphs in the font
> + * @data: The raw font data
> + *
> + * Font data is organized as an array of glyphs. Each glyph is a bitmap with
> + * set bits indicating the foreground color. Unset bits indicate background
> + * color. The fields @width and @height store a single glyph's number of
> + * horizontal bits and vertical scanlines. If width is not a multiple of 8,
> + * there are trailing bits to fill up the byte. These bits should not be drawn.
> + *
> + * The field @data points to the first glphy's first byte. The value @charcount
> + * gives the number of glyphs in the font. There are no empty scanlines between
> + * two adjacent glyphs.
> + */
> +struct vc_font {
> +	unsigned int width;
> +	unsigned int height;
> +	unsigned int charcount;

I wonder if we shouldn't declare width and height as "u8" or "short int" type?
And charcount as u16 or "short int" ?
Makes later calculations shorter & easier.

Helge

  reply	other threads:[~2026-03-03 14:31 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 14:08 [PATCH v2 00/13] vc,fbcon,fonts: Proper handling of font data Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 01/13] fbdev: Declare src parameter of fb_pad_ helpers as constant Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 02/13] vt: Remove trailing whitespaces Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 03/13] vt: Store font in struct vc_font Thomas Zimmermann
2026-03-03 14:31   ` Helge Deller [this message]
2026-03-04  7:49     ` Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 04/13] vt: Calculate font-buffer size with vc_font_size() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 05/13] lib/fonts: Remove trailing whitespaces Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 06/13] lib/fonts: Remove FNTCHARCNT() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 07/13] lib/fonts: Store font data as font_data_t; update consoles Thomas Zimmermann
2026-03-03 14:57   ` Helge Deller
2026-03-04  7:51     ` Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 08/13] lib/fonts: Read font size with font_data_size() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 09/13] lib/fonts: Compare font data for equality with font_data_is_equal() Thomas Zimmermann
2026-03-05  0:23   ` Nathan Chancellor
2026-03-05  9:31     ` Thomas Zimmermann
2026-03-05 20:12       ` Nathan Chancellor
2026-03-02 14:08 ` [PATCH v2 10/13] lib/fonts: Manage font-data lifetime with font_data_get/_put() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 11/13] lib/fonts: Create font_data_t from struct console_font with font_data_import() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 12/13] lib/fonts: Store font data for user space with font_data_export() Thomas Zimmermann
2026-03-02 14:08 ` [PATCH v2 13/13] lib/fonts: Remove internal symbols and macros from public header file Thomas Zimmermann
2026-03-03 15:29 ` [PATCH v2 00/13] vc,fbcon,fonts: Proper handling of font data Helge Deller
2026-03-04  9:11   ` Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e17139f-47bf-4fec-b13f-d4a1b3a7a62d@gmx.de \
    --to=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®