From patchwork Thu Feb 15 15:37:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Gladkov X-Patchwork-Id: 201616 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp501829dyb; Thu, 15 Feb 2024 08:07:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWgB3+rm69zti4aGbvUGrFJfzU5et2sxDtNMMAIwzWulvswijmx06oVOtUKPNt2O72AVKYRazW2olNl6bZN3I0xtY5QBQ== X-Google-Smtp-Source: AGHT+IFdv1pPHuH0MHHCByo+nX7hSoYKjFVlExxOXKk3yARRNICtE3PC7qasf6pw9V3AU+aVxVpI X-Received: by 2002:a05:6a00:3cca:b0:6ce:6b61:2f2e with SMTP id ln10-20020a056a003cca00b006ce6b612f2emr3068376pfb.24.1708013237051; Thu, 15 Feb 2024 08:07:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708013237; cv=pass; d=google.com; s=arc-20160816; b=q+5QzEE2ePIVKT3Y4GKKN2W1LP3/ROTnQf/Xp3W/RBO74drKtIOutyG8MxtRNzFZJI q85uT9/HiliZtspXzeO5XTIMqUhZGVkrXsTnFFbUynFCkrO3+hhHeykMX3hZKgl2IOI8 kTbhvmDM6xMY8eWX3qfrk4g4D47W2MNiW1nMWyBCohyK2aKZ7/8uLucNxeWJF4SfHeTo TX8Pay6JGpx9zvADQF2wI4fPmlunV1KP0BVXwwU8FcgjMDoHaH3ONMWDo2JO894VbMoP dixyfcYBsboTM3QdLFQKgmLURmgxhWUOSxBXsli3kV9/Fsuqig+v+zIHeTXtoTmAD3or v52g== 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:to:from; bh=CJWTpQ5EloVrFZ0LyC4c8Tr9VtC5B4g4OIsjs4S7wiU=; fh=5lLQrGdKCUTEsMQkEJ//E4ZZVMrkT7zt/nAQQco0YdQ=; b=wgcKSHy1qZfY4Ny6kFwiR0cDus1rm/x4AhVREWJECrtKQXlMV0ix0X8Lzb3N4Yv5Ta o9pMZHbujCM+ei4foCOqzvjE/bqk5G7FPAeD0ByPkc4xBR9tHUHNgVdL0FlCGimqFoGg dMnROl+CXhGCE+1UtTDOTZy1/DENdAz0KtzWYFObNbGS9Xw/ecoGKrz07gC4mX9MGcWO EFy+OfR+1cKR+Pwwe1c6jFbptPVcssJ/6HtSicLMozmhY8TBu7Or4wtbveIarwoBD8Ef xu2hZFICc/xHGoxBiGG4Xqhlpunb1OxwKxMjhXwOI9l6Mbj/GpGiYuF+rg8/EAKSlJwB +Wvw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67214-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67214-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s16-20020a656910000000b005dc88726780si1322487pgq.374.2024.02.15.08.07.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 08:07:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67214-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-67214-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67214-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C24B8B20D42 for ; Thu, 15 Feb 2024 15:40:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30237135A57; Thu, 15 Feb 2024 15:37:58 +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 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790981687794479761 X-GMAIL-MSGID: 1790981687794479761 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; +#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 /* 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 = op->data, *p; - if ((w < 6) || (h < 6) || (w > 32) || (h > 32) || (vpitch != 32) - || (op->charcount != 256 && op->charcount != 512)) + if ((w < STICON_MIN_FONT_WIDTH) || (h < STICON_MIN_FONT_HEIGHT) || + (w > STICON_MAX_FONT_WIDTH) || (h > STICON_MAX_FONT_HEIGHT) || + (vpitch != 32) || + (op->charcount != 256 && op->charcount != 512)) return -EINVAL; pitch = ALIGN(w, 8) / 8; bpc = 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); } +static int sticon_font_info(struct vc_data *vc, struct console_font *font) +{ + font->width = STICON_MAX_FONT_WIDTH; + font->height = STICON_MAX_FONT_HEIGHT; + font->charcount = 512; + + return 0; +} + static void sticon_init(struct vc_data *c, int init) { struct sti_struct *sti = sticon_sti; @@ -371,6 +387,7 @@ static const struct consw sti_con = { .con_scroll = sticon_scroll, .con_switch = sticon_switch, .con_blank = sticon_blank, + .con_font_info = sticon_font_info, .con_font_set = sticon_font_set, .con_font_default = sticon_font_default, .con_build_attr = sticon_build_attr,