On Tue, Oct 27, 2020 at 08:13:53PM +0100, Daniel Vetter wrote:
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).
You are right, let's remove FNTCHARCNT() altogether. fbcon_do_set_font() still needs a userfont parameter for refcount handling, I'll just add a charcount parameter to it.
Peilin