From nobody Wed Feb 11 02:53:22 2026 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 016F5134721 for ; Thu, 15 Feb 2024 15:37:51 +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=1708011473; cv=none; b=O8rPlp7Y7kTsr7t/KC3+fTYv3z1z7MJfsJYq0+Ul3VuHvB06K+YEOBh7khLNsuCXHSbvWTw/bSqucja7CMZ/LjjB5sOKAI1aI4ND4zk1cXjhAPhUEmy95PYH/uRBgSxWZ5XcqLNXTvhuAtAOyLsRGgtrlDNjU0U6XAxGQZEMHZI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011473; c=relaxed/simple; bh=474Y3iVLHHUM1rCff7tk5dxLN3ak3aH90Sl7yM/vUg4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H9vdPMYrRW5/rM+/EQFMi+iV3qgJd1nubl9ddiacBlQ0k2AX5K7vD8BeTNZ0beJvE/g+BEGNZ1fcCeD8ZXkpMB1XZyKAfCn6lRCT7BMysKWrOuOXfpamFwo/0atXyDxi/EVf3YOok+l7ratnU8LOggAjI9D8Ly1XUOTHFPnQ4Zw= 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 (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-680-9OgLH7iLM0K_zkVk9ukhBA-1; Thu, 15 Feb 2024 10:37:43 -0500 X-MC-Unique: 9OgLH7iLM0K_zkVk9ukhBA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 273471C0983A; Thu, 15 Feb 2024 15:37:43 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.226.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 858F7112132A; Thu, 15 Feb 2024 15:37:42 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Subject: [RFC PATCH v1 1/5] VT: Add KD_FONT_OP_GET_INFO operation Date: Thu, 15 Feb 2024 15:37:20 +0000 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: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Content-Type: text/plain; charset="utf-8" Each driver has its own restrictions on font size. There is currently no way to understand what the requirements are. The new operation allows userspace to get the maximum font size values. Signed-off-by: Alexey Gladkov --- drivers/tty/vt/vt.c | 27 +++++++++++++++++++++++++++ drivers/tty/vt/vt_ioctl.c | 2 +- include/linux/console.h | 1 + include/uapi/linux/kd.h | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 156efda7c80d..e1d0f95ccba0 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -4628,6 +4628,31 @@ static int con_font_set(struct vc_data *vc, struct c= onsole_font_op *op) return rc; } =20 +static int con_font_info(struct vc_data *vc, struct console_font_op *op) +{ + struct console_font font; + int rc =3D -EINVAL; + + font.height =3D max_font_height; + font.width =3D max_font_width; + font.charcount =3D max_font_glyphs; + + console_lock(); + if (vc->vc_mode !=3D KD_TEXT) + rc =3D -EINVAL; + else if (vc->vc_sw->con_font_info) + rc =3D vc->vc_sw->con_font_info(vc, &font); + else + rc =3D -ENOSYS; + console_unlock(); + + op->height =3D font.height; + op->width =3D font.width; + op->charcount =3D font.charcount; + + return rc; +} + static int con_font_default(struct vc_data *vc, struct console_font_op *op) { struct console_font font =3D {.width =3D op->width, .height =3D op->heigh= t}; @@ -4673,6 +4698,8 @@ int con_font_op(struct vc_data *vc, struct console_fo= nt_op *op) return con_font_get(vc, op); case KD_FONT_OP_SET_DEFAULT: return con_font_default(vc, op); + case KD_FONT_OP_GET_INFO: + return con_font_info(vc, op); case KD_FONT_OP_COPY: /* was buggy and never really used */ return -EINVAL; diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c index 8c685b501404..d6853d30ad19 100644 --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -469,7 +469,7 @@ static int vt_k_ioctl(struct tty_struct *tty, unsigned = int cmd, =20 if (copy_from_user(&op, up, sizeof(op))) return -EFAULT; - if (!perm && op.op !=3D KD_FONT_OP_GET) + if (!perm && op.op !=3D KD_FONT_OP_GET && op.op !=3D KD_FONT_OP_GET_INFO) return -EPERM; ret =3D con_font_op(vc, &op); if (ret) diff --git a/include/linux/console.h b/include/linux/console.h index 779d388af8a0..4afd9139d529 100644 --- a/include/linux/console.h +++ b/include/linux/console.h @@ -59,6 +59,7 @@ struct consw { unsigned int lines); int (*con_switch)(struct vc_data *vc); int (*con_blank)(struct vc_data *vc, int blank, int mode_switch); + int (*con_font_info)(struct vc_data *vc, struct console_font *font); int (*con_font_set)(struct vc_data *vc, struct console_font *font, unsigned int vpitch, unsigned int flags); int (*con_font_get)(struct vc_data *vc, struct console_font *font, diff --git a/include/uapi/linux/kd.h b/include/uapi/linux/kd.h index 6b384065c013..21a1fb18dba0 100644 --- a/include/uapi/linux/kd.h +++ b/include/uapi/linux/kd.h @@ -180,6 +180,7 @@ struct console_font { #define KD_FONT_OP_COPY 3 /* Obsolete, do not use */ #define KD_FONT_OP_SET_TALL 4 /* Set font with vpitch =3D height */ #define KD_FONT_OP_GET_TALL 5 /* Get font with vpitch =3D height */ +#define KD_FONT_OP_GET_INFO 6 =20 #define KD_FONT_FLAG_DONT_RECALC 1 /* Don't recalculate hw charcell size = [compat] */ =20 --=20 2.43.0 From nobody Wed Feb 11 02:53:22 2026 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 E3496134724 for ; Thu, 15 Feb 2024 15:37:52 +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=1708011474; cv=none; b=Ot3KaILSS9g675JMidz8TTCxOSPg24D6iheE/VgN+qwbgKsSOweQn76gtRfou16JIVskwx+PM+wd8xGq0SFe/xmYrVux9XC/qto92f3B3OvbcTYgh/rCUnhiyaioxgtt8B5mkau25I9FMkfOgw0K2/ZcABlbILLcBl5HZ/RxKHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011474; c=relaxed/simple; bh=Wi1Uo3NTt3EhwOxhS1vpUDA6r4xPVGJhZxavZcntHe8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NUCcIuEF0w+h1mLItivVSU2TS/42dTVTv9OrQXUHT9n2VlTKuKUNQh8LuciDlf2W/ergck+rNWNRJ8tWsNBu/48nvTjhRdTdBVQikSWy1Ele3m7Hrb6Q9XzVLa2kufMR5+A244yLMOdRESqZj2Q6gavWoNOx8IxZwfABPbplO6E= 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 (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-404-5N3N6lTGOKWbNHkP7jCTUQ-1; Thu, 15 Feb 2024 10:37:44 -0500 X-MC-Unique: 5N3N6lTGOKWbNHkP7jCTUQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 0005B3C11A04; Thu, 15 Feb 2024 15:37:43 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.226.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EDB9112132A; Thu, 15 Feb 2024 15:37:43 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Subject: [RFC PATCH v1 2/5] newport_con: Allow to get max font width and height Date: Thu, 15 Feb 2024 15:37:21 +0000 Message-ID: <84a8e29072a5bdcc954d13b55b0574c6b0126499.1708011391.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: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alexey Gladkov --- drivers/video/console/newport_con.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/video/console/newport_con.c b/drivers/video/console/ne= wport_con.c index e8e4f82cd4a1..1364197136e7 100644 --- a/drivers/video/console/newport_con.c +++ b/drivers/video/console/newport_con.c @@ -33,6 +33,9 @@ =20 #define NEWPORT_LEN 0x10000 =20 +#define NEWPORT_MAX_FONT_WIDTH 8 +#define NEWPORT_MAX_FONT_HEIGHT 16 + #define FONT_DATA ((unsigned char *)font_vga_8x16.data) =20 static unsigned char *font_data[MAX_NR_CONSOLES]; @@ -328,8 +331,8 @@ static void newport_init(struct vc_data *vc, int init) { int cols, rows; =20 - cols =3D newport_xsize / 8; - rows =3D newport_ysize / 16; + cols =3D newport_xsize / NEWPORT_MAX_FONT_WIDTH; + rows =3D newport_ysize / NEWPORT_MAX_FONT_HEIGHT; vc->vc_can_do_color =3D 1; if (init) { vc->vc_cols =3D cols; @@ -507,8 +510,8 @@ static int newport_set_font(int unit, struct console_fo= nt *op, unsigned int vpit =20 /* ladis: when I grow up, there will be a day... and more sizes will * be supported ;-) */ - if ((w !=3D 8) || (h !=3D 16) || (vpitch !=3D 32) - || (op->charcount !=3D 256 && op->charcount !=3D 512)) + if ((w !=3D NEWPORT_MAX_FONT_WIDTH) || (h !=3D NEWPORT_MAX_FONT_HEIGHT) || + (vpitch !=3D 32) || (op->charcount !=3D 256 && op->charcount !=3D 512= )) return -EINVAL; =20 if (!(new_data =3D kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, @@ -569,6 +572,15 @@ static int newport_font_default(struct vc_data *vc, st= ruct console_font *op, cha return newport_set_def_font(vc->vc_num, op); } =20 +static int newport_font_info(struct vc_data *vc, struct console_font *font) +{ + font->width =3D NEWPORT_MAX_FONT_WIDTH; + font->height =3D NEWPORT_MAX_FONT_HEIGHT; + font->charcount =3D 512; + + return 0; +} + static int newport_font_set(struct vc_data *vc, struct console_font *font, unsigned int vpitch, unsigned int flags) { @@ -688,6 +700,7 @@ const struct consw newport_con =3D { .con_scroll =3D newport_scroll, .con_switch =3D newport_switch, .con_blank =3D newport_blank, + .con_font_info =3D newport_font_info, .con_font_set =3D newport_font_set, .con_font_default =3D newport_font_default, .con_save_screen =3D newport_save_screen --=20 2.43.0 From nobody Wed Feb 11 02:53:22 2026 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 1534613475C for ; Thu, 15 Feb 2024 15:37:54 +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=1708011476; cv=none; b=mCYPfTsVPeMMI5HFC6QaeS5yc5runQif998JVcjG2PeA/pcJr8UGO72mr/5i6BZU+fJZvXt3biAZslkBr3aZB6RDpRErACSLIJfqRbC+MyEH4dCDdW0pO+OecYet19olaRqjrvqWgfouheze4dzOOioWx6Dpwk18faCT2f9xIvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011476; c=relaxed/simple; bh=bMbVIOzi1rK1lP2i91pr+ZkS3sDA0uZVi6JPvb+dw5U=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W+NgVxk45NSdr8FKl2RgV2nSMoNgbr+3W/lzuNqcq0RodlLJr6gXuX8R7tllT+1geJmckuG6bYWdH9AdcmnxwAOVEvb0iH1UJvWEJEWxe9jTdsxfOQpU2ehLRG4Kwj2viWh7s9R6frbBKQ+8w014lWP9maMrCWCTlfrjsJOWpGk= 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 (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-567-LbA3p-fHOmqRYxhf3xAGfQ-1; Thu, 15 Feb 2024 10:37:45 -0500 X-MC-Unique: LbA3p-fHOmqRYxhf3xAGfQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 CCF0F1025622; Thu, 15 Feb 2024 15:37:44 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.226.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3792B112132A; Thu, 15 Feb 2024 15:37:44 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Subject: [RFC PATCH v1 3/5] sticon: Allow to get max font width and height Date: Thu, 15 Feb 2024 15:37:22 +0000 Message-ID: <0c724c30a36aefe2cb4470182cf868d256fbabcd.1708011391.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: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alexey Gladkov --- drivers/video/console/sticon.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c index 992a4fa431aa..63368b3ff9c5 100644 --- a/drivers/video/console/sticon.c +++ b/drivers/video/console/sticon.c @@ -56,6 +56,11 @@ #define BLANK 0 static int vga_is_gfx; =20 +#define STICON_MIN_FONT_WIDTH 6 +#define STICON_MIN_FONT_HEIGHT 6 +#define STICON_MAX_FONT_WIDTH 32 +#define STICON_MAX_FONT_HEIGHT 32 + #define STI_DEF_FONT sticon_sti->font =20 /* borrowed from fbcon.c */ @@ -180,8 +185,10 @@ static int sticon_set_font(struct vc_data *vc, struct = console_font *op, struct sti_cooked_font *cooked_font; unsigned char *data =3D op->data, *p; =20 - if ((w < 6) || (h < 6) || (w > 32) || (h > 32) || (vpitch !=3D 32) - || (op->charcount !=3D 256 && op->charcount !=3D 512)) + if ((w < STICON_MIN_FONT_WIDTH) || (h < STICON_MIN_FONT_HEIGHT) || + (w > STICON_MAX_FONT_WIDTH) || (h > STICON_MAX_FONT_HEIGHT) || + (vpitch !=3D 32) || + (op->charcount !=3D 256 && op->charcount !=3D 512)) return -EINVAL; pitch =3D ALIGN(w, 8) / 8; bpc =3D pitch * h; @@ -273,6 +280,15 @@ static int sticon_font_set(struct vc_data *vc, struct = console_font *font, return sticon_set_font(vc, font, vpitch); } =20 +static int sticon_font_info(struct vc_data *vc, struct console_font *font) +{ + font->width =3D STICON_MAX_FONT_WIDTH; + font->height =3D STICON_MAX_FONT_HEIGHT; + font->charcount =3D 512; + + return 0; +} + static void sticon_init(struct vc_data *c, int init) { struct sti_struct *sti =3D sticon_sti; @@ -371,6 +387,7 @@ static const struct consw sti_con =3D { .con_scroll =3D sticon_scroll, .con_switch =3D sticon_switch, .con_blank =3D sticon_blank, + .con_font_info =3D sticon_font_info, .con_font_set =3D sticon_font_set, .con_font_default =3D sticon_font_default, .con_build_attr =3D sticon_build_attr, --=20 2.43.0 From nobody Wed Feb 11 02:53:22 2026 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 18EDD133417 for ; Thu, 15 Feb 2024 15:37:53 +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=1708011475; cv=none; b=QB238gR7XWcMp5Dh8gXGmMJI6pSLPs92jwz+vQd6LOHc+PL4fvcfEympTbR2jELujCgK1NNZJMEP1EO3Ck8LUf5Ybqdd/tTK1WiOYv2guW9QXKEr7vTh/SEvBHpFZ/uh25iHQPZGCfbqzoTwUZ4zGwZFNHInrxQOGAU1s3Ct5mA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011475; c=relaxed/simple; bh=PzRCrAYZ3bmmaS2SVBTn1kR7ocsfUIv45eipG7Xx1Iw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MBCYIM1zJf395pYF5l0KAWs4RVi3N/+HmyUz9fHp6yZgRcm9bFK6LSXnlKzum5a2AfmQupTAlyGmxK7rI/TQQkRxgcYcQh/FK5yLVw4IXiHQFL3hYJDhlg5ya8hYOesgWRAYyjQGCzdQqXoiWX7VBrCqvPGV1oXaHTb/4XDDzxQ= 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 (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-649-MvIx3WUINFKvlgf5QeaYgQ-1; Thu, 15 Feb 2024 10:37:45 -0500 X-MC-Unique: MvIx3WUINFKvlgf5QeaYgQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 A5320185A782; Thu, 15 Feb 2024 15:37:45 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.226.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FDDC112132A; Thu, 15 Feb 2024 15:37:44 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Subject: [RFC PATCH v1 4/5] vgacon: Allow to get max font width and height Date: Thu, 15 Feb 2024 15:37:23 +0000 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: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alexey Gladkov --- drivers/video/console/vgacon.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 8ef1579fa57f..a499a469df4d 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -61,6 +61,10 @@ static struct vgastate vgastate; #define BLANK 0x0020 =20 #define VGA_FONTWIDTH 8 /* VGA does not support fontwidths !=3D 8 = */ + +#define VGACON_MAX_FONT_WIDTH VGA_FONTWIDTH +#define VGACON_MAX_FONT_HEIGHT 32 + /* * Interface used by the world */ @@ -1013,6 +1017,15 @@ static int vgacon_adjust_height(struct vc_data *vc, = unsigned fontheight) return 0; } =20 +static int vgacon_font_info(struct vc_data *vc, struct console_font *font) +{ + font->width =3D VGACON_MAX_FONT_WIDTH; + font->height =3D VGACON_MAX_FONT_HEIGHT; + font->charcount =3D 512; + + return 0; +} + static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigned int vpitch, unsigned int flags) { @@ -1022,7 +1035,8 @@ static int vgacon_font_set(struct vc_data *c, struct = console_font *font, if (vga_video_type < VIDEO_TYPE_EGAM) return -EINVAL; =20 - if (font->width !=3D VGA_FONTWIDTH || font->height > 32 || vpitch !=3D 32= || + if (font->width !=3D VGACON_MAX_FONT_WIDTH || + font->height > VGACON_MAX_FONT_HEIGHT || vpitch !=3D 32 || (charcount !=3D 256 && charcount !=3D 512)) return -EINVAL; =20 @@ -1177,6 +1191,7 @@ const struct consw vga_con =3D { .con_scroll =3D vgacon_scroll, .con_switch =3D vgacon_switch, .con_blank =3D vgacon_blank, + .con_font_info =3D vgacon_font_info, .con_font_set =3D vgacon_font_set, .con_font_get =3D vgacon_font_get, .con_resize =3D vgacon_resize, --=20 2.43.0 From nobody Wed Feb 11 02:53:22 2026 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 E5E2D13541C for ; Thu, 15 Feb 2024 15:37:56 +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=1708011478; cv=none; b=r9Hqpgi6c9/d7QGLPnscRONalSLgfOqfTfEAYfwbfYkXg1Mncz8VKmlxIFGcjl+DJKWmVINDOZZvYxUdTLR5ZFCPyLocskeFc0P+nc5vBq54lJV2pXaYvM6HqX1oDvPQ1Xvfc0Df13ZHa6TWYdmDcCfscbVuDx8nYNDsTf24bqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708011478; c=relaxed/simple; bh=efCocjGDk1w3W9iKbxUAnx77/Ju+MiN+a2dnJUfXKoY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kNEqCTY6cyWKbERD4EYh//pi1ovlxQ753fh6bUolKax/SaVGNVMDw8v9ufKNlgekHJQLAnRw5iujCmEmymdknDcoM38J4JaEpj+qsLVOrz2COaOczm5ukiFKiVRT/yKPJtkOVzzT0pL83Fuv7rsdnqElXYdoHclo22mzNBvPgxg= 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 (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-128-YVyoMV41MumVIiMbfc3cWQ-1; Thu, 15 Feb 2024 10:37:46 -0500 X-MC-Unique: YVyoMV41MumVIiMbfc3cWQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 809ED1C0983D; Thu, 15 Feb 2024 15:37:46 +0000 (UTC) Received: from gentoo.redhat.com (unknown [10.45.226.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE04A112131D; Thu, 15 Feb 2024 15:37:45 +0000 (UTC) From: Alexey Gladkov To: LKML , Greg Kroah-Hartman , Jiri Slaby Subject: [RFC PATCH v1 5/5] fbcon: Allow to get max font width and height Date: Thu, 15 Feb 2024 15:37:24 +0000 Message-ID: <1985617597448ffc0eb4d242cd22d1250542b433.1708011391.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: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 Content-Type: text/plain; charset="utf-8" Signed-off-by: Alexey Gladkov --- drivers/video/fbdev/core/fbcon.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fb= con.c index 1183e7a871f8..6f9015868cac 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -101,6 +101,9 @@ enum { FBCON_LOGO_DONTSHOW =3D -3 /* do not show the logo */ }; =20 +#define FBCON_MAX_FONT_WIDTH 32 +#define FBCON_MAX_FONT_HEIGHT 32 + static struct fbcon_display fb_display[MAX_NR_CONSOLES]; =20 static struct fb_info *fbcon_registered_fb[FB_MAX]; @@ -2458,6 +2461,17 @@ static int fbcon_do_set_font(struct vc_data *vc, int= w, int h, int charcount, return ret; } =20 + +static int fbcon_font_info(struct vc_data *vc, struct console_font *font) +{ + font->width =3D FBCON_MAX_FONT_WIDTH; + font->height =3D FBCON_MAX_FONT_HEIGHT; + font->charcount =3D 512; + + return 0; +} + + /* * User asked to set font; we are guaranteed that charcount does not exce= ed 512 * but lets not assume that, since charcount of 512 is small for unicode = support. @@ -2485,7 +2499,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; =20 - if (font->width > 32 || font->height > 32) + if (font->width > FBCON_MAX_FONT_WIDTH || + font->height > FBCON_MAX_FONT_HEIGHT) return -EINVAL; =20 /* Make sure drawing engine can handle the font */ @@ -3160,6 +3175,7 @@ static const struct consw fb_con =3D { .con_scroll =3D fbcon_scroll, .con_switch =3D fbcon_switch, .con_blank =3D fbcon_blank, + .con_font_info =3D fbcon_font_info, .con_font_set =3D fbcon_set_font, .con_font_get =3D fbcon_get_font, .con_font_default =3D fbcon_set_def_font, --=20 2.43.0