Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp655676pxx; Wed, 28 Oct 2020 13:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWkuwBn3DJ05Fl+l6COsDUPzAUFoVjDRidn8JNEr5eVHf0UDdG98sMuRC9AyiWYhW0z9uO X-Received: by 2002:a05:6402:651:: with SMTP id u17mr723390edx.206.1603917267325; Wed, 28 Oct 2020 13:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603917267; cv=none; d=google.com; s=arc-20160816; b=xe3XIyQJpiVrGSQvMOCBrw8zPcF9T/5VGmBktR3ELrxBDHuQsdGmzmzA6Vo9zw5cf0 o51o04hN6n2qfJ8jgCge/FyihqIRRHWM1O9ntNdZdk0Xk/J5Hhybpd93z/AKrnqETk+f 6B2p2v8BLmWXx0gDZgVykjudg/2fWK5uW1WXWkQP61AS1Fi+LmiKbaO4+Zb6T7gXAp7C PvB/Z+t9LRUDa4oc28Yv0hq3dnsMexwIaIgoS3bWUaa1JtMMDsAfIh9g0WfHuv6vEm2y U7HTSYIhVAqz1G27Xc7bmm2sltDaXe31EzftIrOtGJj46+U3qrptRqZhhZImpV25QMb5 mwWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=P3J/+0GiuC41DT0MOvT+FF9RAHnRvTVHa938Xwr2s1o=; b=GFSN8KJjw80Kw5rjUr3Uf+S6PqVhckH3zwihcHGrW0rVoOaI5gGOVeFFB/tpOeD4+A fPA8nIVRKeInYk6RojPjXdM98bHaUSXqdoqyuaZyRXQC5FvApWyS6OWLmTWfgMqLdRG9 143ABceg01169or5iJZTgEAxzkhlxrqKsuEdmzWQOPPENMBk5r5+pp0CWi6fEo67SmgD BMCpl8PjBKNxg6cuWZ7msf1teCepKW8PYKdE9/jaucAiCP4eVDpMTqQSRqp940QkBnkO QA7AzewEezqZUDZa3uFDircALMGcXgGsSqaSJxEQCPTuyfOuTqvzrHWOkDIjOhdAgBZl cI9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=iAotOM6W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si30189edq.122.2020.10.28.13.34.05; Wed, 28 Oct 2020 13:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=iAotOM6W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1829509AbgJ0TOA (ORCPT + 99 others); Tue, 27 Oct 2020 15:14:00 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50750 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1829503AbgJ0TN6 (ORCPT ); Tue, 27 Oct 2020 15:13:58 -0400 Received: by mail-wm1-f65.google.com with SMTP id 13so2431431wmf.0 for ; Tue, 27 Oct 2020 12:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=P3J/+0GiuC41DT0MOvT+FF9RAHnRvTVHa938Xwr2s1o=; b=iAotOM6WKIuDQ6FgXb5rOAYby/U4SAR7GX1dfobxCt0NUEUYvR3JU5IbXXXzzEzb+x NVw1W6NV+zW7ZjBUjaeVYKNjF3on3pNs1Hgp6GQgb8ezNmvtVbTVJ9+wG1SxiBt1nZ0N E1jWM77BDsGkX6UGDdQshv1RZmgj9/9Fqg5Zw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=P3J/+0GiuC41DT0MOvT+FF9RAHnRvTVHa938Xwr2s1o=; b=ZNe4rvsor4ShO6HWf+jZ7vnkrd+VNOK/5M0GE06vTtprdgFBy3v+JTz3YlK0BPY7MP PC+Sb6cvmyqN2cc9Zy+Ab2KDHLuKkAOdWkneblErAChbse6SX3OCjWPZgMO8OOkRZhpw EqSIskfCHRvifuq7MRl6rn3mQshuYerT4I3Ne6SGQoW/gZWpczuwUipDuIu7cWggw8WW ckqZd4B2jfjzmtjdu46qthQF3WpUA0f1wAeOgnVpNbwDuKTS8Fatfyybxk0H+pdJeayQ g0I9IlPXWPdCfqnjh8yTP/Oqo/7S7djCXJpT+AyFSL/WqMY1nGUH23xh+fCY58QVCxGW AEew== X-Gm-Message-State: AOAM532BnDGrz2YXTaz4JmdMmF40CyosngQmLL9JQBoOMYFR9DKZoL3d vVSFKBWzkUjNcdMf/cCJeVEYbA== X-Received: by 2002:a1c:e919:: with SMTP id q25mr4233791wmc.142.1603826035820; Tue, 27 Oct 2020 12:13:55 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id m1sm3070487wmm.34.2020.10.27.12.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 12:13:55 -0700 (PDT) Date: Tue, 27 Oct 2020 20:13:53 +0100 From: Daniel Vetter To: Peilin Ye Cc: Daniel Vetter , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Jiri Slaby , 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 Message-ID: <20201027191353.GO401619@phenom.ffwll.local> Mail-Followup-To: Peilin Ye , Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , Jiri Slaby , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <54f7d42e07eca2a2f13669575a9de88023ebc1ac.1603788512.git.yepeilin.cs@gmail.com> <6c28279a10dbe7a7e5ac3e3a8dd7c67f8d63a9f2.1603788512.git.yepeilin.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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