From patchwork Fri Sep 19 20:14:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 353 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312964; bh=frPN94HaGdFUnJoD4h/YTO8XTTss0aDWDH5DbZTS5Hc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=e78gAiQA7NjMTvp+C5mgirH87nD+HUAkwfK+pCplBYalL40VtSEeU8pUSwKXzLA1/ OKX7s8T+3hG/MR9sRGcRKhQp41PjJ/MRRHra7EDAYzUOPEg5j5sPUhQOqJtz6yHvEV 78a2G5yKYvc+rTKz56LKYFWK5x+WcMrudhdHJi5Ia2ZuHTQ7ThSV6WrF8N0qjn9xmD 81vNoeaFTu9QY6HZ2r2IwqW2ka9RZ8t1k3PdLABY34JjoNgQ4q7tBLbVFn3c4wRP7B 9TF0QPzkiMRo5AQ53LHIFgIYz3FEd6kUALL6U0ubikhiN9Q5EIVtGGQCK+UPyCFTA1 pA+EMXrpHfpaA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68D5467C6D for ; Fri, 19 Sep 2025 14:16:04 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id yQh7LTxJmtyM for ; Fri, 19 Sep 2025 14:16:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312964; bh=frPN94HaGdFUnJoD4h/YTO8XTTss0aDWDH5DbZTS5Hc=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=e78gAiQA7NjMTvp+C5mgirH87nD+HUAkwfK+pCplBYalL40VtSEeU8pUSwKXzLA1/ OKX7s8T+3hG/MR9sRGcRKhQp41PjJ/MRRHra7EDAYzUOPEg5j5sPUhQOqJtz6yHvEV 78a2G5yKYvc+rTKz56LKYFWK5x+WcMrudhdHJi5Ia2ZuHTQ7ThSV6WrF8N0qjn9xmD 81vNoeaFTu9QY6HZ2r2IwqW2ka9RZ8t1k3PdLABY34JjoNgQ4q7tBLbVFn3c4wRP7B 9TF0QPzkiMRo5AQ53LHIFgIYz3FEd6kUALL6U0ubikhiN9Q5EIVtGGQCK+UPyCFTA1 pA+EMXrpHfpaA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5195067B3B for ; Fri, 19 Sep 2025 14:16:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312963; bh=gMRcV5S4gtzom6d+UeyYydv0z7LsiifIQ1MadROF3Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmXoCzpVCw0lrCfAyWgLnl86/dF1YqG6Tt8BuFs9+I69aaiEZ+hzPDlJ47Y4bAAfz Lib3ewYgBLRn6aw/9Ti/ullCIMK1P2l+YI7ViIsDLGfO1P6S5QXn3JsSVKd19wyHCA eGBQzeT/HurHknFpnQ3dMyOwZHh80ITtQ5Tq1Zhjyo8hVEA7/FKTpL2YLlYhqNvnwp J86YanjB2aE/qreegzvwP1JcNlBBc92WJjB+CndQh7vY0Vznstevs0LETlC2FOQwjD yEOvnX2EM5ZWb28KqvA9liGeB6q24gI4OXRDlYZkg1ORIyqVTQAGvyzdBzoPc8iF7l 8C1tAJEzjA0kQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2679B67C7B; Fri, 19 Sep 2025 14:16:03 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id UrKBNHKu3GWg; Fri, 19 Sep 2025 14:16:03 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1758312960; bh=R8Cjfx9YRMVli3zU61qsHF7acQTNfUadD8e03+CAZEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNdPDHXiTbq8ZmXvk6K3nhJUnjyqdVJj2mAruTLmZwMMgYLz9k5aJ9hbuG8LYIoFR UxhipOQWnXKRGiGKZItXCK4IRA/UnPrkh5r/TzGckNXbO8T7KEmaSD/OfwnieMUKJ4 nnLSd17WuLnub9ec5fxh2ZTkfXBiqsy+kHsqg7IcxPOlN3GS5DMw2z5Gn0AtJdNPEy ukIx1z5SkRfvHuveH1Ib8NT+lgHaJNYaTdZLNFi2bJLiGOayJ8yMaKvMK7IRESUuBI MdZFwLWm5A868pugl+rvy1+vjFq42x6TopCnTfcfvKA2VLVLnwBYiP7sPvXZjtXxS/ T0/FoY+JUnA+g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E82F567C70; Fri, 19 Sep 2025 14:15:59 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Fri, 19 Sep 2025 14:14:18 -0600 Message-ID: <20250919201507.4024144-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250919201507.4024144-1-sjg@u-boot.org> References: <20250919201507.4024144-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 22W2WJWSFR2UZHPT4GGWABYK6IZXKO7Q X-Message-ID-Hash: 22W2WJWSFR2UZHPT4GGWABYK6IZXKO7Q X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/42] video: Move setting of the bitmap font into uclass List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Most of this function deals with uclass data, so move it into the uclass. This will allow truetype to use it too. Signed-off-by: Simon Glass --- drivers/video/console_core.c | 18 +----------------- drivers/video/vidconsole-uclass.c | 24 ++++++++++++++++++++++++ include/video_console.h | 10 ++++++++++ 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/drivers/video/console_core.c b/drivers/video/console_core.c index 4b75a5b6e12..aec51dc809d 100644 --- a/drivers/video/console_core.c +++ b/drivers/video/console_core.c @@ -21,25 +21,9 @@ static int console_set_font(struct udevice *dev, struct video_fontdata *fontdata) { struct console_simple_priv *priv = dev_get_priv(dev); - struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); - struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); - - debug("console_simple: setting %s font\n", fontdata->name); - debug("width: %d\n", fontdata->width); - debug("byte width: %d\n", fontdata->byte_width); - debug("height: %d\n", fontdata->height); priv->fontdata = fontdata; - vc_priv->x_charsize = fontdata->width; - vc_priv->y_charsize = fontdata->height; - if (vid_priv->rot % 2) { - vc_priv->cols = vid_priv->ysize / fontdata->width; - vc_priv->rows = vid_priv->xsize / fontdata->height; - vc_priv->xsize_frac = VID_TO_POS(vid_priv->ysize); - } else { - vc_priv->cols = vid_priv->xsize / fontdata->width; - vc_priv->rows = vid_priv->ysize / fontdata->height; - } + vidconsole_set_bitmap_font(dev, fontdata); return 0; } diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index f53d55e81b7..b5f0b79bcf6 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -812,3 +812,27 @@ void vidconsole_set_quiet(struct udevice *dev, bool quiet) priv->quiet = quiet; } + +void vidconsole_set_bitmap_font(struct udevice *dev, + struct video_fontdata *fontdata) +{ + struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); + + log_debug("console_simple: setting %s font\n", fontdata->name); + log_debug("width: %d\n", fontdata->width); + log_debug("byte width: %d\n", fontdata->byte_width); + log_debug("height: %d\n", fontdata->height); + + vc_priv->x_charsize = fontdata->width; + vc_priv->y_charsize = fontdata->height; + if (vid_priv->rot % 2) { + vc_priv->cols = vid_priv->ysize / fontdata->width; + vc_priv->rows = vid_priv->xsize / fontdata->height; + vc_priv->xsize_frac = VID_TO_POS(vid_priv->ysize); + } else { + vc_priv->cols = vid_priv->xsize / fontdata->width; + vc_priv->rows = vid_priv->ysize / fontdata->height; + /* xsize_frac is set in vidconsole_pre_probe() */ + } +} diff --git a/include/video_console.h b/include/video_console.h index d3c65a08331..8cd1ccacb0f 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -10,6 +10,7 @@ #include struct abuf; +struct video_fontdata; struct video_priv; #define VID_FRAC_DIV 256 @@ -603,4 +604,13 @@ int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep */ void vidconsole_set_quiet(struct udevice *dev, bool quiet); +/** + * vidconsole_set_bitmap_font() - prepare vidconsole for chosen bitmap font + * + * @dev vidconsole device + * @fontdata pointer to font data struct + */ +void vidconsole_set_bitmap_font(struct udevice *dev, + struct video_fontdata *fontdata); + #endif