Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1374356rbb; Mon, 26 Feb 2024 07:23:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWWOekKb+H787f0752GKWrx8bTrTF2h2VYASnkZRokLSwnUaXcKpJ2yhitS+8tf60PTqnpOXrMYXyI+vip1V9VKyRbNShm3lXzbt/vKAg== X-Google-Smtp-Source: AGHT+IFI3qSMu2GLi3tZk31b6DIu4BwzFA2Sn9rys29VVd7g7EP1oalLkitsO074JOhMdwXpz9N9 X-Received: by 2002:a92:dcce:0:b0:365:75b2:a338 with SMTP id b14-20020a92dcce000000b0036575b2a338mr7640114ilr.24.1708961011659; Mon, 26 Feb 2024 07:23:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708961011; cv=pass; d=google.com; s=arc-20160816; b=kQnbUsh5XgvD2HWot4LVuiKX8p7ckwfxYWsAGpHG6kBX8MpI4dAppUyu4NpS1mqpo8 Fi13mJwgdS4rQKgTjKG82ta5v5O0d5Tbff3OJCbIYwT66J+5hQuoNK9iBLVH6fuH0otR 1mCA8CjDakYr8Yz1bhQbjhZAQzagvzvB3iabyn9BVTguN3+e842zBKCYz0q7UEyErMB5 cR8TrwWwXgkR9hMpiSkMv706VC3E5MHLzQ3QCGCbDqdx/Wq2a63O0M5NXfo/jcAmQjvZ xOMGelQ8leniwBWkr8qPFBjRBOhTl3pun7yaxlWhrGcx0BCizhZp36iRYuZf0O3AT0Dq hb3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=HtggLGKqXHmQgmr25dN6Q3a2D1EG2Fw4+5TywrlGRIw=; fh=+sjJkTnuceKV/39ogbp2WrGgLtnGuaoEzUs1VQcMbqE=; b=XflMvZ7dHtBlY2xy9rbofcuJQT29iTkmMDky/vuS5Jn557zhgZLDVLgOBGrKbmtrFl uOnFXl1MEvZ7Zz2BdRhiRu4LjKb771uTnG+v/wayahSiCXB8LyL2XZJX0KNlVajnkcm/ xF5kSf8C4EtCOHnvHjGUaj9d5DHQXY9ZaCPGRmsnB27F1XkvoXvEx7rTnqc8+/Ut4++q jNgiCMVnN/Ua6/juEG3iub2oZcxc549DdGh2r0jsOs2s9Oyge3W/keli344nuLJEkZrx yjEGK8tB54y6hQQDBoGb20KbXo/7jmZKITkfr/DQFQ17lVAaiIWag7ZhYI0tA85f5vi4 0gSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-81785-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81785-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g15-20020a63e60f000000b005e42b4c0c48si3842971pgh.390.2024.02.26.07.23.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:23:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81785-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-81785-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81785-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 59D5E2A3D65 for ; Mon, 26 Feb 2024 15:23:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 106A412C54E; Mon, 26 Feb 2024 15:21:38 +0000 (UTC) Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D33A128368 for ; Mon, 26 Feb 2024 15:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.139.111.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960897; cv=none; b=f45cIzuLETPsOCr+gkirWNPbFY/Tbmriyi36Q6915WP8cslvjxq9KXpZGT0Gv09juo1MTBSFsp4RU9mJKlOk8YMogJ4z8LiBHZwiu5Pl5Q4VfYcY51zOJYznCu0YfRBMeDUd6PCcLlhpD1k29ORfcRu16HHRlduUeACRxzpPduQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960897; c=relaxed/simple; bh=y3ktYAlWGlGh0UnsX6kzOaJ18fiNnqB5N6XWTMa6ZYo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q+oRc58eBSP1I0qpqC665Mtkc7o8YKUmRVY92oF5/SEz/YDFR3OC4ujmba6MzsuCv4nyAbcvt+8kNXJdL5Wzc5moYNnYeIm4dcA44f9jL4FKevW0dl2gj9lp5OQCqlsaAFbSaYWqzdF0x32Ku3yQLvINvWEaqy2qHYxEP00M704= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=fail smtp.mailfrom=kernel.org; arc=none smtp.client-ip=205.139.111.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=kernel.org Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-612-hUFdyclRNYa7u9Dzspq9HQ-1; Mon, 26 Feb 2024 10:21:27 -0500 X-MC-Unique: hUFdyclRNYa7u9Dzspq9HQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AC846185A781; Mon, 26 Feb 2024 15:21:26 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.224.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED5D3492BE2; Mon, 26 Feb 2024 15:21:25 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Cc: linux-api@vger.kernel.org Subject: [RFC PATCH v2 5/5] fbcon: Allow to get max font width and height Date: Mon, 26 Feb 2024 16:21:14 +0100 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 Signed-off-by: Alexey Gladkov --- drivers/video/fbdev/core/fbcon.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 1183e7a871f8..055d0d01243c 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -101,6 +101,9 @@ enum { FBCON_LOGO_DONTSHOW = -3 /* do not show the logo */ }; +#define FBCON_MAX_FONT_WIDTH 32 +#define FBCON_MAX_FONT_HEIGHT 32 + static struct fbcon_display fb_display[MAX_NR_CONSOLES]; static struct fb_info *fbcon_registered_fb[FB_MAX]; @@ -2458,6 +2461,21 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h, int charcount, return ret; } + +static int fbcon_font_info(struct vc_data *vc, struct console_font_info *info) +{ + info->min_width = 0; + info->min_height = 0; + + info->max_width = FBCON_MAX_FONT_WIDTH; + info->max_height = FBCON_MAX_FONT_HEIGHT; + + info->flags = KD_FONT_INFO_FLAG_LOW_SIZE | KD_FONT_INFO_FLAG_HIGH_SIZE; + + return 0; +} + + /* * User asked to set font; we are guaranteed that charcount does not exceed 512 * but lets not assume that, since charcount of 512 is small for unicode support. @@ -2485,7 +2503,8 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font, h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) return -EINVAL; - if (font->width > 32 || font->height > 32) + if (font->width > FBCON_MAX_FONT_WIDTH || + font->height > FBCON_MAX_FONT_HEIGHT) return -EINVAL; /* Make sure drawing engine can handle the font */ @@ -3160,6 +3179,7 @@ static const struct consw fb_con = { .con_scroll = fbcon_scroll, .con_switch = fbcon_switch, .con_blank = fbcon_blank, + .con_font_info = fbcon_font_info, .con_font_set = fbcon_set_font, .con_font_get = fbcon_get_font, .con_font_default = fbcon_set_def_font, -- 2.44.0