linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Peilin Ye <yepeilin.cs@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] fbcon: Avoid hard-coding built-in font charcount
Date: Tue, 27 Oct 2020 20:13:53 +0100	[thread overview]
Message-ID: <20201027191353.GO401619@phenom.ffwll.local> (raw)
In-Reply-To: <a3b1b3cdc160fb9aef389c366f387fb27f0aef38.1603788512.git.yepeilin.cs@gmail.com>

On Tue, Oct 27, 2020 at 12:37:29PM -0400, Peilin Ye wrote:
> fbcon_startup() and fbcon_init() are hard-coding the number of characters
> of our built-in fonts as 256. Recently, we included that information in
> our kernel font descriptor `struct font_desc`, so use `font->charcount`
> instead of a hard-coded value.
> 
> This patch depends on patch "Fonts: Add charcount field to font_desc".
> 
> Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>

So I think this is correct, but it also doesn't do a hole lot yet. fbcon.c
still has tons of hard-coded 256 all over, and if (p->userfont).

I think if we instead set vc->vc_font.charcount both in fbcon_init and in
fbcon_do_set_font (probably just replace the userfont parameter with
font_charcount for now), then we could replace these all with
vc->vc_font.charcount. And the code would already improve quite a bit I
think.

With just this change here I think we have even more inconsistency, since
for built-in fonts vc->vc_font.charcount is now set correctly, but for
userfonts we need to instead look at FNTCHARCNT(vc->vc_font.data).

We'd still need to maintain p->userfont because of the refcount chaos, but
that is much more work.

Or do I miss something here?
-Daniel

> ---
>  drivers/video/fbdev/core/fbcon.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index cef437817b0d..e563847991b7 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -1004,7 +1004,7 @@ static const char *fbcon_startup(void)
>  		vc->vc_font.width = font->width;
>  		vc->vc_font.height = font->height;
>  		vc->vc_font.data = (void *)(p->fontdata = font->data);
> -		vc->vc_font.charcount = 256; /* FIXME  Need to support more fonts */
> +		vc->vc_font.charcount = font->charcount;
>  	} else {
>  		p->fontdata = vc->vc_font.data;
>  	}
> @@ -1083,8 +1083,7 @@ static void fbcon_init(struct vc_data *vc, int init)
>  			vc->vc_font.width = font->width;
>  			vc->vc_font.height = font->height;
>  			vc->vc_font.data = (void *)(p->fontdata = font->data);
> -			vc->vc_font.charcount = 256; /* FIXME  Need to
> -							support more fonts */
> +			vc->vc_font.charcount = font->charcount;
>  		}
>  	}
>  
> -- 
> 2.25.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  parent reply	other threads:[~2020-10-27 19:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 16:27 [PATCH 0/5] Preparation work for using font_desc in vc_data Peilin Ye
2020-10-27 16:31 ` [PATCH 1/5] fbdev/atafb: Remove unused extern variables Peilin Ye
2020-10-27 16:33   ` [PATCH 2/5] Fonts: Make font size unsigned in font_desc Peilin Ye
2020-10-27 16:34     ` [PATCH 3/5] Fonts: Add charcount field to font_desc Peilin Ye
2020-10-27 16:37       ` [PATCH 4/5] fbcon: Avoid hard-coding built-in font charcount Peilin Ye
2020-10-27 16:41         ` [PATCH 5/5] parisc/sticore: " Peilin Ye
2020-10-27 19:18           ` Daniel Vetter
2020-10-27 19:13         ` Daniel Vetter [this message]
2020-10-28  5:30           ` [PATCH 4/5] fbcon: " Peilin Ye
2020-10-28 15:51         ` [PATCH RFC v2 4/5] fbdev: Avoid using FNTCHARCNT() and hard-coded " Peilin Ye
2020-10-27 18:59       ` [PATCH 3/5] Fonts: Add charcount field to font_desc Daniel Vetter
2020-10-28  6:11         ` Peilin Ye
2020-10-28  6:05       ` [PATCH 3/5 v2] " Peilin Ye
2020-11-02 15:03         ` Daniel Vetter
2020-10-27 18:50     ` [PATCH 2/5] Fonts: Make font size unsigned in font_desc Daniel Vetter
2020-10-28  5:43       ` Peilin Ye
2020-10-28  8:18         ` Daniel Vetter
2020-10-28 10:30           ` Peilin Ye
2020-10-28 10:56     ` [PATCH v2 " Peilin Ye
2020-10-28 18:40       ` Daniel Vetter
2020-10-27 18:44   ` [PATCH 1/5] fbdev/atafb: Remove unused extern variables Daniel Vetter
2020-10-28  9:59   ` Geert Uytterhoeven
2020-10-28 19:25   ` Thomas Zimmermann
2020-10-27 16:50 ` Following up Peilin Ye
2020-10-27 18:36   ` Daniel Vetter
2020-10-28  5:34     ` Peilin Ye
2020-11-02 15:01 ` [PATCH 0/5] Preparation work for using font_desc in vc_data Daniel Vetter

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=20201027191353.GO401619@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=b.zolnierkie@samsung.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yepeilin.cs@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).