From patchwork Mon Oct 6 16:54:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 510 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=1759769727; bh=6aQqBqHovfkeoJj2fE39IBDltSup4nFUqDdoNcrSxb8=; 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=U8LjUKmyVtwDdJ9A2Vv3vX+vXttlw7jnt163hqP7wMhKwSjh55I7k6uZYWXiES8fo QfQUdmK9Eu7tpjlWA587IMkMVr5l0STVt/MVUKfErr8xWVCVVr+PgXVQ+3iZkLHIPt ozcStBmnTgN37n/J009W/0naMCRdc8mZOTRrosbUa7ggR3ZFnblq1oSXQUFoqniPZU lGUoDIb7qf1Fk8zwAfwYZH8EBgTbb6P2RMulnKVmB6TQR+sRRKQH+hD/ixwJRUnpWU f4+wtjhbj6FomMOfkfeigGG9NvtzMWzgk9rp0KmD2H5zzqjzzi2UBqU790SedGa7RT 7t2fEvAN9uQrA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BDFC267F8E for ; Mon, 6 Oct 2025 10:55:27 -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 ILXCEhtB9XxO for ; Mon, 6 Oct 2025 10:55:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769727; bh=6aQqBqHovfkeoJj2fE39IBDltSup4nFUqDdoNcrSxb8=; 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=U8LjUKmyVtwDdJ9A2Vv3vX+vXttlw7jnt163hqP7wMhKwSjh55I7k6uZYWXiES8fo QfQUdmK9Eu7tpjlWA587IMkMVr5l0STVt/MVUKfErr8xWVCVVr+PgXVQ+3iZkLHIPt ozcStBmnTgN37n/J009W/0naMCRdc8mZOTRrosbUa7ggR3ZFnblq1oSXQUFoqniPZU lGUoDIb7qf1Fk8zwAfwYZH8EBgTbb6P2RMulnKVmB6TQR+sRRKQH+hD/ixwJRUnpWU f4+wtjhbj6FomMOfkfeigGG9NvtzMWzgk9rp0KmD2H5zzqjzzi2UBqU790SedGa7RT 7t2fEvAN9uQrA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ADFF367F09 for ; Mon, 6 Oct 2025 10:55:27 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769725; bh=es3mIojETOaGJdq12Uw9s1L6sJTznnXqJ7EAWdYiyVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZgUiUJAsSqaCSTVz3vJqr1Ywv0J62tNWR+Ijt8y5Mdg4gsuDgulbviU6rKHVFM/yX 72T8OyZ/ANPhn1pxwhECSsre1rFow1vHKgRG+uEf0oVtKs3gxwqw64qh+anxXp4bdV CwY/3IaEujI3XcoFdiKE53+U0v0PSHUBWAEu97EFAYw71+QhHlbYZ7JmHPxjosyTO1 KoV6ERDNNsmo0qYR6LdLFeOU6PLooFQgvRAQKWiZxrE+N5+ZEHCTQknQuZ6wf8YefZ hLuP7890RAbjvD5UeJiF0ZAfnjCCDcxSl16ENWsODiUG6k5neSSmVsnJdGhrfJE2hl sJ9clSSmqrZPQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E5F3267F03; Mon, 6 Oct 2025 10:55:25 -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 vYnSsrnXTOUL; Mon, 6 Oct 2025 10:55:25 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769724; bh=QXtOfLsPOG2dYpgk8bMHmB2Eujuoy99eCKcUtlAJsgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RBjJpcS0zPYA960BfXkZVmHyObneQdFoF3y//whP3r6yYweVyunL+EjhFREArbciy LdJ1MKloE4zg8i86YXCnm4NtzWbzuSZL+ayOQQparSCjO4EN6sWKV72ILHyUAD646C mHidivsP/DNLTGH6CJQMbi4dtt+0kz3gIbuszUaHilDo8MOYljSNOcJPs4gUK5RNYs 1yOWJZB1vxJk//y0sHK3xgVOszqUHEAr2DHtnXHp5Z3+JwxPlNPvLR2iQawT7N5gKL 2kAkS2JEsauj1mj5NPpXSKv9bwNlQaKmXgGSVGr7WOEwHgarlekNkmk22XhwvsnV95 Y7Xi21NyPVtbA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C50A967FBB; Mon, 6 Oct 2025 10:55:23 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:39 -0600 Message-ID: <20251006165452.1675349-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251006165452.1675349-1-sjg@u-boot.org> References: <20251006165452.1675349-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: R2NPZKX7MPDEVZG4BMPD5RHFLD5HGFB2 X-Message-ID-Hash: R2NPZKX7MPDEVZG4BMPD5RHFLD5HGFB2 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 07/14] expo: Store mouse pointer and size in expo 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 Store the mouse pointer image and its dimensions in the expo structure when mouse support is enabled. This avoids repeatedly looking up the image and calculating its size. Use struct vid_size to store the mouse pointer dimensions. Signed-off-by: Simon Glass --- boot/cedit.c | 12 +++++++++--- boot/expo.c | 23 ++++++++++++++++++++++- cmd/bootflow.c | 12 ++++++++++-- include/expo.h | 25 +++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/boot/cedit.c b/boot/cedit.c index ad2c98aa7a5..691780512ca 100644 --- a/boot/cedit.c +++ b/boot/cedit.c @@ -245,20 +245,26 @@ int cedit_run(struct expo *exp) expo_set_mouse_enable(exp, true); + expo_enter_mode(exp); + exp->done = false; exp->save = false; do { struct expo_action act; ret = expo_render(exp); - if (ret) + if (ret) { + expo_exit_mode(exp); return log_msg_ret("cer", ret); + } ret = expo_poll(exp, &act); - if (!ret) + if (!ret) { cedit_do_action(exp, scn, vid_priv, &act); - else if (ret != -EAGAIN) + } else if (ret != -EAGAIN) { + expo_exit_mode(exp); return log_msg_ret("cep", ret); + } } while (!exp->done); if (ret) diff --git a/boot/expo.c b/boot/expo.c index b5c54291220..42109b88e72 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -168,7 +168,7 @@ int expo_set_mouse_enable(struct expo *exp, bool enable) { int ret; - if (!enable) { + if (!IS_ENABLED(CONFIG_MOUSE) || !enable) { exp->mouse_enabled = false; return 0; } @@ -177,6 +177,17 @@ int expo_set_mouse_enable(struct expo *exp, bool enable) if (ret) return log_msg_ret("sme", ret); + /* Get mouse pointer image and dimensions */ + exp->mouse_ptr = video_image_getptr(riscos_arrow); + if (exp->mouse_ptr) { + ulong width, height; + uint bpix; + + video_bmp_get_info(exp->mouse_ptr, &width, &height, &bpix); + exp->mouse_size.w = width; + exp->mouse_size.h = height; + } + exp->mouse_enabled = true; return 0; @@ -456,3 +467,13 @@ void expo_req_size(struct expo *exp, int width, int height) exp->req_width = width; exp->req_height = height; } + +void expo_enter_mode(struct expo *exp) +{ + video_manual_sync(exp->display, true); +} + +void expo_exit_mode(struct expo *exp) +{ + video_manual_sync(exp->display, false); +} diff --git a/cmd/bootflow.c b/cmd/bootflow.c index c9f36a364dd..caff52fcc7c 100644 --- a/cmd/bootflow.c +++ b/cmd/bootflow.c @@ -55,19 +55,27 @@ __maybe_unused static int bootflow_handle_menu(struct bootstd_priv *std, if (ret) return log_msg_ret("bhs", ret); + expo_enter_mode(exp); + ret = -ERESTART; do { if (ret == -ERESTART) { ret = expo_arrange(exp); - if (ret) + if (ret) { + expo_exit_mode(exp); return log_msg_ret("bha", ret); + } ret = expo_render(exp); - if (ret) + if (ret) { + expo_exit_mode(exp); return log_msg_ret("bhr", ret); + } } ret = bootflow_menu_poll(exp, &seq); } while (ret == -EAGAIN || ret == -ERESTART || ret == -EREMCHG); + expo_exit_mode(exp); + if (ret == -EPIPE) { printf("Nothing chosen\n"); std->cur_bootflow = NULL; diff --git a/include/expo.h b/include/expo.h index e359da1343b..3250ecee40e 100644 --- a/include/expo.h +++ b/include/expo.h @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -131,6 +132,8 @@ struct expo_theme { * @popup: true to use popup menus, instead of showing all items * @show_highlight: show a highlight bar on the selected menu item * @mouse_enabled: true if the mouse is enabled + * @mouse_ptr: Pointer to mouse pointer image data (BMP format) + * @mouse_size: Size of mouse pointer (width and height in pixels) * @priv: Private data for the controller * @done: Indicates that a cedit session is complete and the user has quit * @save: Indicates that cedit data should be saved, rather than discarded @@ -153,6 +156,8 @@ struct expo { bool popup; bool show_highlight; bool mouse_enabled; + const void *mouse_ptr; + struct vid_size mouse_size; void *priv; bool done; bool save; @@ -1185,4 +1190,24 @@ int expo_poll(struct expo *exp, struct expo_action *act); */ void expo_req_size(struct expo *exp, int width, int height); +/** + * expo_enter_mode() - Enter expo mode for the video subsystem + * + * @exp: Expo to update + * + * This suppresses automatic video sync operations to allow expo to control + * rendering timing. Should be called before starting the expo loop. + */ +void expo_enter_mode(struct expo *exp); + +/** + * expo_exit_mode() - Exit expo mode for the video subsystem + * + * @exp: Expo to update + * + * This restores normal video sync operations. Should be called after + * finishing the expo loop. + */ +void expo_exit_mode(struct expo *exp); + #endif /*__EXPO_H */