Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1374873rbb; Mon, 26 Feb 2024 07:24:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWX3J0RA1c2mEFbspCkXxleQEPygCNBAsTVsPD8jDXEEch2IBgnNBUia3Rfn8789FkqMQLvB3I929n6t691wFkaSlwB1AkFhikIQ3O+2w== X-Google-Smtp-Source: AGHT+IETG8PRRYzruOJFBZtPmJFx72Js2EMAfNScmr6nkgplB1ngjUgRDAf/tCXF0Zho4EiL0t1U X-Received: by 2002:a05:6a20:9e4c:b0:19c:9b38:f398 with SMTP id mt12-20020a056a209e4c00b0019c9b38f398mr11579220pzb.22.1708961064485; Mon, 26 Feb 2024 07:24:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708961064; cv=pass; d=google.com; s=arc-20160816; b=cre5l/CENklSXfGgrlC/k5ro2FVHaJPBgt9Bjc/uWX4LVp5XN71GBPe3Qb49xmQGdV 8e3sfraXZg+fVbhiqX6Styoy7brMxigd+pWKoORPdOUO8v9DqFa599bevwsGzuM4qrf8 Y1hUOS3bxeEJU3Ekusu08+SblwDEBrx+BeoG6agUZmH6KjX6ggOPtZZJzXcKf9fh1GHN m9u0zypAwtoyfNgg7C/cpeJ3z4o0gwuQUaD8f43BUsCJZxjbroCR9g/VnPlRAhUfyhPl rd4/qRHgp3ANPZ414TsQBTeK1d76OWMYVSc+S8aoPHZz1GjmJfIsX1FWWlCefrgmHx+s k93A== 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=0U4ieiJ4jzKFtjBe2gGGtKEWqSdTmhbJ7YTInFQgM90=; fh=+sjJkTnuceKV/39ogbp2WrGgLtnGuaoEzUs1VQcMbqE=; b=gvRC67x3ctp50ayNINu5ZPscmNNufwW0LXvaD5fCuGSm9AmrulpwVA+H4yw+M7IfkY 9c5FRPjkdvVhPl8jhOEw5duU3xZgjQVNgeLxGQ0rCJ6T3pws1pc7tBZV4CTneApyvo75 6Xo/YR69JqfnN3SBFJAEqWNxphc2gIlENyesMB27SlVwVBR7xxCcVB3dFKaH/dkpyok7 XoxbLnj/fo1JKZiilMl6GkvOJqk8Xl8lraTlXcDAKz4InfRNB7HPmVhBDGmIwBKVhjLg piMwNLLgdYDj4z/V1YH1d8ut3pqDTBbFZ7TGahwHQ7qzo+WHja/jqPonBWdt+OAjMBKJ p9sA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-81788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81788-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 d3-20020a63f243000000b005dc4827d5bdsi3924792pgk.546.2024.02.26.07.24.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 07:24:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81788-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-81788-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81788-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 34ECA2A3EC7 for ; Mon, 26 Feb 2024 15:24:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 951E912C557; Mon, 26 Feb 2024 15:22:39 +0000 (UTC) Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.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 72CA912C528 for ; Mon, 26 Feb 2024 15:22:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=207.211.30.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960959; cv=none; b=edr8QLnMiLRkfW1y4VR3SpScVH1lbfTCOafmMoGT9M30od4aW8/y7kQPRnM6DLWUwrN46XYX1DprHR0YJC3WGC7mZFcg4Xzya9oJRiDQHhep5vaV1qvZqV8GWH6f9qtCBx7nMzBD+EjxtnDYSwYdLzUGDU/i/5MRHUIk9DB0h6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708960959; c=relaxed/simple; bh=jJGWS4fls7FxdD0C7TzlrnH9rCl6Eia5MnOtRY3vNvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FdlwwKQwxyz6VtDgSjxNiUeTQuTFDK+YFba2RrBNTQMXnF/Xw7vQLvXZSQVH67rCaNaTlTdU+oGhp/C/9VCNe8AX1RHys53b1LSh3/m3UM1/k69+W34nIMhBZlJ/MlKL+HTOUdEJFg3CsBzLWrrA6wZahKAmYg785rz/rd+ka2c= 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=207.211.30.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 (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-A_t5tt-EMT2pGOjzsrEoTQ-1; Mon, 26 Feb 2024 10:21:26 -0500 X-MC-Unique: A_t5tt-EMT2pGOjzsrEoTQ-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 B5CE71C106A1; Mon, 26 Feb 2024 15:21:25 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.224.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04798492BD7; Mon, 26 Feb 2024 15:21:24 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Cc: linux-api@vger.kernel.org Subject: [RFC PATCH v2 4/5] vgacon: Allow to get max font width and height Date: Mon, 26 Feb 2024 16:21:13 +0100 Message-ID: <6e8da86c7c8aa955158e8fec048a2c89cba4b592.1708960303.git.legion@kernel.org> 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/console/vgacon.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 8ef1579fa57f..b75d31ef3353 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -61,6 +61,10 @@ static struct vgastate vgastate; #define BLANK 0x0020 #define VGA_FONTWIDTH 8 /* VGA does not support fontwidths != 8 */ + +#define VGACON_MAX_FONT_WIDTH VGA_FONTWIDTH +#define VGACON_MAX_FONT_HEIGHT 32 + /* * Interface used by the world */ @@ -1013,6 +1017,19 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight) return 0; } +static int vgacon_font_info(struct vc_data *vc, struct console_font_info *info) +{ + info->min_width = VGACON_MAX_FONT_WIDTH; + info->min_height = 0; + + info->max_width = VGACON_MAX_FONT_WIDTH; + info->max_height = VGACON_MAX_FONT_HEIGHT; + + info->flags = KD_FONT_INFO_FLAG_LOW_SIZE | KD_FONT_INFO_FLAG_HIGH_SIZE; + + return 0; +} + static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigned int vpitch, unsigned int flags) { @@ -1022,7 +1039,8 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, if (vga_video_type < VIDEO_TYPE_EGAM) return -EINVAL; - if (font->width != VGA_FONTWIDTH || font->height > 32 || vpitch != 32 || + if (font->width != VGACON_MAX_FONT_WIDTH || + font->height > VGACON_MAX_FONT_HEIGHT || vpitch != 32 || (charcount != 256 && charcount != 512)) return -EINVAL; @@ -1177,6 +1195,7 @@ const struct consw vga_con = { .con_scroll = vgacon_scroll, .con_switch = vgacon_switch, .con_blank = vgacon_blank, + .con_font_info = vgacon_font_info, .con_font_set = vgacon_font_set, .con_font_get = vgacon_font_get, .con_resize = vgacon_resize, -- 2.44.0