From patchwork Mon Oct 6 16:54:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 504 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=1759769715; bh=2t09C6QhZHYwymS1/x6UDBIgYu+ReGgFPHa1yaAsPRo=; 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=aEkn9JGOMJxH4sFasXx6rGoVoRSoQP8T2HIuyfjuxpfxc4pQEf9RjlndoFOvcvzrr 5Pm3z4hea8qvSttq5DqFAhjPbY3S0rCLcTR2oWGHjSnFz7qONAFzLEAaUQz2fzy9BG 7sCZGuNeNHeypEUVODfJfxMNvE03T39ufuho83+Xrj2G/t4VthoPYTMELi1q80Inan tZelqu9L1JJLs+PtiN0dVWwHlHuaE1PqQ3S9//o9n/XfduLbkPTh22uTLzoM8XfB6N WEqfZyH1Gy25gHQV6jZ73QKIUywcW8mFdHRwkIkzP9yxqfDe2ZgytjMZ3REGHTdsDx h3A/YoCEK8OyQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E0EB167FB1 for ; Mon, 6 Oct 2025 10:55:15 -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 f1fYN1PSc7qM for ; Mon, 6 Oct 2025 10:55:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769713; bh=2t09C6QhZHYwymS1/x6UDBIgYu+ReGgFPHa1yaAsPRo=; 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=nEGaRksy/SjR9P71r1u2FP5nQpKVqgZQDUET+LN2oq8HX9bzziZOG5pYzyCehb1KU fDrZJUckejcUAqcd4Issb303hTGTnIEnay70xb1m+sERVOHIvKCPKj9guF/muChh5y elS+VBCSm3o29Nu/hAvZCHYTg3tTLaPghRQL5oloZ+12UD0SVlDLkmWqw+aorKvfW3 +PRMHKRsBNyLAh7seiYN8kFb7aGWPt05GOffkeeeUYoIrDOBUP2OtNsBfttc32ATDE x8NujPvxGJX9oDjDDwFlAd/lE0X9s7h/+eB/QHkbPtyLejJkWSzEcY8KrhRcA3IO7C M4aXURtszWdbw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E304767FB3 for ; Mon, 6 Oct 2025 10:55:13 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769710; bh=aRVQ5y7Aj919SLqSJAqAKAmXHFIgNwTPhtZ1h9/DXWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wIuGxGy1cnLsnimRoeXJ984rD4T6hLz6i6u0qNaBLFRkQwFYabBJh/3NMztTDB2Af 4s+vvk0oJqW0aVi14ylI87XQxS9qGoKlvDIoIbPnGcT+tgv7zBLperwndKK4VI4+Ou BTyfMvb6lt55uX4mZThjQWziupf5rTmJTYH4QMSfe850jteyp4pb9eTkI417IMTR7b nCDoTAyCLXMxoOO2RdSHH/HCsmuoujoWvxaIiVm07DaVj/UE2faLFiNhcRd0wawTKP CTtsOehpAxPXKe4OCTsqzhUMnO4oPqekDIbLElL0OxnjryD1gKigUdyG48l+QOOKve BL9wKAutKskOw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 015BA67F03; Mon, 6 Oct 2025 10:55:10 -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 fQaJtkNOtwI3; Mon, 6 Oct 2025 10:55:09 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769709; bh=jOpP2MZwVnLN97/Xb3JoGps7dy6pib7dOv2nHVY01XE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYkUlog87j93P7qeqAjQd0SKNon0Q0/OEl4PprVYS1XQ/EKnr1HXpauNE1RSu45o3 xZ10+mD89GoXPI6FwN0vX7r879LXhA0+iDH8/Ed9Z5fGYisI1qENX5cXdkYIFG/pMr MXa8n2bjpcyPDOzbj3EByTFjm5RrJDSmIQ1K5t7gh9GGqEImMqP0GQef9pNN3xDqmX 6kPT8GjrJGAphfZNgX9itbAX+nfvq2yY+9a1foOAKJ0R+UXMGUMmE8VQM0UqTkoH4l WBxz+8hXm6tm9SgivE77r2xd1KSPnaqPFtT/RfW0Cjrk0KcMXQStWxlgsAPt/IV2Ye VUkyDKaJlaQHg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 35F0F67ECE; Mon, 6 Oct 2025 10:55:09 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:33 -0600 Message-ID: <20251006165452.1675349-2-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: ULJKCEG73OEH6LH55TAO64SVH5MSWFAX X-Message-ID-Hash: ULJKCEG73OEH6LH55TAO64SVH5MSWFAX 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/14] video: Add struct vid_pos for coordinates 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 Add a simple struct to represent x,y coordinates. Co-developed-by: Claude Signed-off-by: Simon Glass --- include/video_defs.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/video_defs.h b/include/video_defs.h index 3ff9e786abc..397764a5d3c 100644 --- a/include/video_defs.h +++ b/include/video_defs.h @@ -47,6 +47,18 @@ static inline bool vid_bbox_valid(const struct vid_bbox *bbox) { return bbox->x1 > bbox->x0 && bbox->y1 > bbox->y0; } + +/** + * struct vid_pos - Represents a position for video operations + * + * @x: X coordinate in pixels from the left + * @y: Y coordinate in pixels from the top + */ +struct vid_pos { + int x; + int y; +}; + #endif /* __ASSEMBLY__ */ #endif /* __VIDEO_DEFS_H */ From patchwork Mon Oct 6 16:54:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 505 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=1759769716; bh=fL9hVuIJoamos4d17G6u5iPSCvK2Vsj5z1dQGamRiqI=; 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=ffi7yLkcbCYkVZceAiB0UgigAiNufBwZ23VjrtmDR/F8LYQlmzAWTOmgjb6ARwMFM 0XD+QuBTnpjD7HAHP45MR4Oh5iGUvx1gBdN7EKdjWCWvieBlz6WhGUwXcdLJxtECY4 kJMMq8H0grLDFyntEQM1MMZsJYQf8+3IfHBjPKCjAzK77J1DxGCWxTB+9s4NDzhFJe FrPe72G4ywsTDStM0rtlN17uEUHPmHTgKKyxwlmigJvaIVrm8ZukjvY7itg8c4Q41g ME+eFi4FmvtEEHCjPDEGFv9PDQdATV1/8AHzqqLXqHTnkObnrqsbbe6f6OeWXbtkbd l4emIfQdF9PVw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4AC9C67F8F for ; Mon, 6 Oct 2025 10:55:16 -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 hd1d7v31FwH3 for ; Mon, 6 Oct 2025 10:55:16 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769715; bh=fL9hVuIJoamos4d17G6u5iPSCvK2Vsj5z1dQGamRiqI=; 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=EPmRRcbB4CDyEi7BPjKRjb0tfuzDo0F5BzxgkATLyl9wK85HrE1LHqk0EQM83ZgL9 reDkydZ0j66W6JewDmqPh7PP0b+YDIkSUL3ZvcDU81HEfvo1mMhNIao6/6vFrm6rPE G/7eNQI3TEJLejmjmymnBCgDvg8YgDbUisRLLYl+VpQNwTWWBYvTRT+g8BPXVX7gtG FYME2eMcwR7hT3Nn6/837UfeTSLE2RhMRMiE/i5sWqIE+01FGLXhVpCToxcSwRudWp sLt7p9eBjJC9QuOSFGgdMhvh1Pri/KbdpZ/iCihRQRvxCNM6MxxA6b6DMP5Q7yOlBe iRassbNQ4MLXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2085667FB7 for ; Mon, 6 Oct 2025 10:55:15 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769710; bh=JQC8A2uTAT4WcnZXFjaCpdgEoRE4+DpUszxPZWoIrJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XmIbrFJuLd4BUuCmghT0WqKzTSt6tkGiwOkrMCfJyFxvtfQ1QN3SXJVq8HPoy6O82 7YOMcTtZO9fcRxDquV8ZasYjGZQe9w5QRjLCd2V8MRRaTuWD9Z2i6uES1Rsy4JA7JC YhRPFvS3a+UYluzlTqGtMRGOsgvVXuhQzpEXU5dLPpPZzpLITAOMgmPJNAPi6lzt6t xQoOE8phbr1kWeQ+uv78Qutx90ylMkT6hJCL2K99CbquTQEgrIutQSdxcoF4q4X8UQ LTEjB/tXgAxm8eeNsx+5pPO3Cm/aAbFZsr82S8aEJr47oM/BiJh3u7SnXcIDxYsSrE UmgLRl1LWlKcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D4EC567F09; Mon, 6 Oct 2025 10:55:10 -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 OwdhHHRLybh1; Mon, 6 Oct 2025 10:55:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769710; bh=QNlF0lCJtpPkZgND5bLnN4Hdrjd6bG0ZI3hPw8jXPmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2wS1OxbxZq+D3izHh7std4RG+pbJkt57O1EAa/mi0VWWMMFiQUVDVRWTQrHbqw1H XuWLTEp1ac+wdur8mPvIRHDvQWyZhOjofzZNloI0j7Aq0YR2mdVMOtUcfC2Z/RiFLg 9/m2stNdbRFzIBmdxXJWdW5CUnGEgUjlQJyFjWnscfVTW7yUBVvkLV3dIxk7/dEwsS ifxdC6GJt0m3BUoD4BjVmtTq4DguPKmc7ZKyokhVcML4BJAO8jfPOw6glrhj02hfGl Hlp3GQdy22Ezbo50/hSlUSJ6TwLWjFZVkuxxxXByXAe3CP01iVLbVmE+Qvp6sS3zwu lHL1qF9U1Z09w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4585267ECE; Mon, 6 Oct 2025 10:55:10 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:34 -0600 Message-ID: <20251006165452.1675349-3-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: JXQPT477Y6CAPOL22LOVRKI3YFBIGU4V X-Message-ID-Hash: JXQPT477Y6CAPOL22LOVRKI3YFBIGU4V 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/14] mouse: Use struct vid_pos for click position 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 Use the new vid_pos struct instead of separate x/y fields. Co-developed-by: Claude Signed-off-by: Simon Glass --- drivers/input/mouse-uclass.c | 8 ++++---- include/mouse.h | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index 256642ef55e..0e5faccf1e2 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -44,8 +44,8 @@ int mouse_get_click(struct udevice *dev, int *xp, int *yp) if (uc_priv->left_button_state == BUTTON_PRESSED && new_state == BUTTON_RELEASED) { pending = true; - uc_priv->click_x = event.button.x; - uc_priv->click_y = event.button.y; + uc_priv->click_pos.x = event.button.x; + uc_priv->click_pos.y = event.button.y; } /* Update button state */ @@ -54,9 +54,9 @@ int mouse_get_click(struct udevice *dev, int *xp, int *yp) /* If we just detected a click, return it */ if (pending) { if (xp) - *xp = uc_priv->click_x; + *xp = uc_priv->click_pos.x; if (yp) - *yp = uc_priv->click_y; + *yp = uc_priv->click_pos.y; return 0; } diff --git a/include/mouse.h b/include/mouse.h index 0d20f8ffdbc..8e65ac79b94 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -9,6 +9,7 @@ #define _MOUSE_H #include +#include struct udevice; @@ -35,13 +36,11 @@ enum mouse_press_state_t { * struct mouse_uc_priv - private data for mouse uclass * * @left_button_state: Current state of left button (BUTTON_PRESSED/BUTTON_RELEASED) - * @click_x: X coordinate where the click occurred - * @click_y: Y coordinate where the click occurred + * @click_pos: Position where the click occurred */ struct mouse_uc_priv { enum mouse_press_state_t left_button_state; - int click_x; - int click_y; + struct vid_pos click_pos; }; /** From patchwork Mon Oct 6 16:54:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 507 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=1759769723; bh=U9kiinuVHksyA5nPCS8CQGqJxv5TQgc1iCuC4Cc08FA=; 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=swYBqU5KdtFpZyNJ3SgyT2K5Sj9wSbnynPEFPdDT4QzGPbhTOWjx2v3bcmBoQgHtx VuikkyvWvOdl+5CpzWcb1i4BIxKmWgLw0gdLgTlLhW5Sd7W4IMeZ6ml1zZwNTxyqhv 7wq3ibB52Mpue0O6psoiEUrC3BcJykVnmsNaJstM9NNjjYmh6c8nvHNsJTg31AchI1 KIYyxOaQTICV3KmTSA8ujX9RE7LiNNoivcSyf0MfmdSMFGyFVk9UWn5OeGk7CvhbKg sVF0LaAJqTt7DSxtaI2LflIbsoUf9c76wZr1pQTZeLt4yqBtyiYIOj+UyrZkXq1cIR 81bB59TkMkCfg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 384AD67F1D for ; Mon, 6 Oct 2025 10:55:23 -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 aRi_G_X6I7N3 for ; Mon, 6 Oct 2025 10:55:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769721; bh=U9kiinuVHksyA5nPCS8CQGqJxv5TQgc1iCuC4Cc08FA=; 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=Z/1ntzzc9saAkKF1mOyfn/+RQsfJ4tWDMnoCbiiw4xjhE03WLlx0MkM6P8JJF9U+V U5IFKpldeHYZGSPCcaJrQ++DnXtCMcZ/jcDk5DF4OwzwTYfWU0LG2jN4I4MlK/7y+s BrEyA64v5zYeDSkBYO8NI5byv0UpcS8jCSNCHoDrFQ7ffTpk7xNT8D0l45cKRbJO/I fqi1xGFugeKREwVqkRHbT9rHWRvtn7VQqv1m84ZaO9rn7OJdmz4A4VX63tJirMBvFi vMw2M+u+M6Hyv/F62Bg7Kts+xvtSXh+8u7yxw4YtWpwDCZnSTSpe9iwlExhrdxWcVa 0EEYlHhkWPLHA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E1E3A67F8E for ; Mon, 6 Oct 2025 10:55:21 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769718; bh=tBgDCRys8jaJMVQYt3bw63Wdc2PAOzFU39GBhmnKND0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3u6nCZF4ImwrFLPRejRS/ShI7VtxWGJgQOp7PaCOMp2ZFqt9YjZIQ+vitJkkar1s 384l+T7A3Mck9QhihpPr21n9OD3ds7qhx5FY/lHRzZfZen8ywjqYXZ3oQUKP/AyctA 972dJwJqJesElWCspA3flffruwt4IA43Deyqjcgw/KpIZsFq/FNu/iYbw7pc8NkRUm 5n6dVYn3l5D0MejKR9R33y5Cqi+33Gx6YgEe2NZSbOhcYUO1iwCqvMRMWbnoxIUGll ViueVqmZfEeHs9DXGWiBjLjRUVK8RfKLlNWudEqyuMIU/fYfBiSM9HTeNTAA8EdiU5 xuqg3X2lh15QA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B404067F8B; Mon, 6 Oct 2025 10:55:18 -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 sZt5Q3o7x5h9; Mon, 6 Oct 2025 10:55:18 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769711; bh=iu/z7J80zOo5ttZt+C36Nz3ipZMKvPfeYjYWfP9nrAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QH1I4kckxExSc0bfDOq2ukw9EMgf9OBLyvjcWE5su7Jk4mmMQlXer6/5ZvZ5P4XPi 67+67Xdev15Is/lBmtO9OXnCLwuXgWNPulkWyxAwmLv4GdeuuLGIYlcdZvb6RSMBFx K8vdIPamg/b7E9rl9MI+4UWa/NfcDDPCDMr7zAINACWxezqos9+/uxt2k5xLKCz4cZ xLXaBy4k2sKAHWZmasj40P4co+gyHqpq7y3gxpdWYL8rW1HrpAZ0iLJYq0FpO4fvBv sLm3eNK5nCjaByA6nLM6ZUgzo5RG898EY41qzN4r5pnKX2j9CEg0FvziuzfH/oE+Zz NmVJ5EAqo5kGw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 277A867ECE; Mon, 6 Oct 2025 10:55:11 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:35 -0600 Message-ID: <20251006165452.1675349-4-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: VZQ53KIWBVSBPDL6EWHBDTQNWOCH3PML X-Message-ID-Hash: VZQ53KIWBVSBPDL6EWHBDTQNWOCH3PML 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/14] mouse: Update mouse_get_click() to use struct vid_pos 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 Change the API to use struct vid_pos instead of separate x/y pointers. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 9 +++++---- drivers/input/mouse-uclass.c | 8 ++------ include/mouse.h | 5 ++--- test/dm/mouse.c | 29 ++++++++++++++--------------- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 00924a19d27..1051133e200 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -413,18 +413,19 @@ static int poll_keys(struct expo *exp) static int poll_mouse(struct expo *exp, int *xp, int *yp) { - int ret, x, y; + struct vid_pos pos; + int ret; if (!exp->mouse_enabled) return -EAGAIN; /* First check if we have a click available */ - ret = mouse_get_click(exp->mouse, &x, &y); + ret = mouse_get_click(exp->mouse, &pos); if (ret) return log_msg_ret("epm", ret); - *xp = x; - *yp = y; + *xp = pos.x; + *yp = pos.y; return 0; /* Click available */ } diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index 0e5faccf1e2..1bb836ff59d 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -23,7 +23,7 @@ int mouse_get_event(struct udevice *dev, struct mouse_event *evt) return 0; } -int mouse_get_click(struct udevice *dev, int *xp, int *yp) +int mouse_get_click(struct udevice *dev, struct vid_pos *pos) { struct mouse_uc_priv *uc_priv = dev_get_uclass_priv(dev); struct mouse_event event; @@ -53,11 +53,7 @@ int mouse_get_click(struct udevice *dev, int *xp, int *yp) /* If we just detected a click, return it */ if (pending) { - if (xp) - *xp = uc_priv->click_pos.x; - if (yp) - *yp = uc_priv->click_pos.y; - + *pos = uc_priv->click_pos; return 0; } } diff --git a/include/mouse.h b/include/mouse.h index 8e65ac79b94..76f9c789b7b 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -95,10 +95,9 @@ int mouse_get_event(struct udevice *dev, struct mouse_event *event); * mouse_get_click() - Check if a left mouse button click has occurred * * @dev: Mouse device - * @xp: Returns X coordinate of click (can be NULL) - * @yp: Returns Y coordinate of click (can be NULL) + * @pos: Returns position of click * Returns: 0 if a click has occurred, -EAGAIN if no click pending */ -int mouse_get_click(struct udevice *dev, int *xp, int *py); +int mouse_get_click(struct udevice *dev, struct vid_pos *pos); #endif diff --git a/test/dm/mouse.c b/test/dm/mouse.c index 1b4c2b5f60f..3efff4a0d7d 100644 --- a/test/dm/mouse.c +++ b/test/dm/mouse.c @@ -99,7 +99,7 @@ static int dm_test_mouse_click(struct unit_test_state *uts) { struct udevice *dev; struct mouse_event inject; - int x, y; + struct vid_pos pos; ut_assertok(uclass_first_device_err(UCLASS_MOUSE, &dev)); @@ -107,7 +107,7 @@ static int dm_test_mouse_click(struct unit_test_state *uts) sandbox_mouse_set_test_mode(dev, true); /* test that no click is detected initially */ - ut_asserteq(-EAGAIN, mouse_get_click(dev, &x, &y)); + ut_asserteq(-EAGAIN, mouse_get_click(dev, &pos)); /* inject a left button press */ inject.type = MOUSE_EV_BUTTON; @@ -123,7 +123,7 @@ static int dm_test_mouse_click(struct unit_test_state *uts) * calling mouse_get_click() should not detect a click yet (press * only) */ - ut_asserteq(-EAGAIN, mouse_get_click(dev, &x, &y)); + ut_asserteq(-EAGAIN, mouse_get_click(dev, &pos)); /* inject a left button release */ inject.type = MOUSE_EV_BUTTON; @@ -136,12 +136,12 @@ static int dm_test_mouse_click(struct unit_test_state *uts) sandbox_mouse_inject(dev, &inject); /* now mouse_get_click() should detect the click */ - ut_assertok(mouse_get_click(dev, &x, &y)); - ut_asserteq(300, x); - ut_asserteq(400, y); + ut_assertok(mouse_get_click(dev, &pos)); + ut_asserteq(300, pos.x); + ut_asserteq(400, pos.y); /* verify no more clicks are pending */ - ut_asserteq(-EAGAIN, mouse_get_click(dev, &x, &y)); + ut_asserteq(-EAGAIN, mouse_get_click(dev, &pos)); return 0; } @@ -151,6 +151,7 @@ static int dm_test_mouse_click_no_coordinates(struct unit_test_state *uts) { struct udevice *dev; struct mouse_event inject; + struct vid_pos pos; ut_assertok(uclass_first_device_err(UCLASS_MOUSE, &dev)); @@ -167,15 +168,13 @@ static int dm_test_mouse_click_no_coordinates(struct unit_test_state *uts) sandbox_mouse_inject(dev, &inject); /* process the press event */ - ut_asserteq(-EAGAIN, mouse_get_click(dev, NULL, NULL)); + ut_asserteq(-EAGAIN, mouse_get_click(dev, &pos)); inject.button.press_state = BUTTON_RELEASED; sandbox_mouse_inject(dev, &inject); - /* - * now test that click is detected without coordinate return - */ - ut_assertok(mouse_get_click(dev, NULL, NULL)); + /* now test that click is detected (coordinates are ignored) */ + ut_assertok(mouse_get_click(dev, &pos)); return 0; } @@ -185,7 +184,7 @@ static int dm_test_mouse_right_button(struct unit_test_state *uts) { struct udevice *dev; struct mouse_event inject; - int x, y; + struct vid_pos pos; ut_assertok(uclass_first_device_err(UCLASS_MOUSE, &dev)); @@ -204,13 +203,13 @@ static int dm_test_mouse_right_button(struct unit_test_state *uts) inject.button.y = 200; sandbox_mouse_inject(dev, &inject); - ut_asserteq(-EAGAIN, mouse_get_click(dev, &x, &y)); + ut_asserteq(-EAGAIN, mouse_get_click(dev, &pos)); inject.button.press_state = BUTTON_RELEASED; sandbox_mouse_inject(dev, &inject); /* still no click detected since it was right button */ - ut_asserteq(-EAGAIN, mouse_get_click(dev, &x, &y)); + ut_asserteq(-EAGAIN, mouse_get_click(dev, &pos)); return 0; } From patchwork Mon Oct 6 16:54:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 506 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=1759769720; bh=jTsulk64A9xQpRIw3tCqCSOkoIFAoLaH10/8y+FaTYo=; 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=LLmBdl/xfCYaZ2tWkq3N8olcgiKBsxCxSi51rXieSvMjLsfVId8byvKCbejoJo5sr XA6mvcjZ5K+F4zixD/Cj0uPUc0htgDMUlGqRpTVyYxiEQEGa5xwcwGGbk2I+ibqOws GmEki2AhDiAUyglpdl3t+PzSoLkEIPB6laQBItjBQxQkMYC4XOf8o/VZowMlzuo6oH K0AXH2DjQVw8O5htbBIwNe+Fo0sxe3X53zb/jyLMSN5GJL/h3hffs8IOuwmaQHyrqs EgXGm3Bvf06GuPKJ3+XLnNCV30tqfStXNtOH1YrLqlFJeI6J+p/NBMo17QVnW9exke b3d2U/CiHVSWQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B396B67ECE for ; Mon, 6 Oct 2025 10:55:20 -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 IxYFqGpSnu9p for ; Mon, 6 Oct 2025 10:55:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769720; bh=jTsulk64A9xQpRIw3tCqCSOkoIFAoLaH10/8y+FaTYo=; 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=LLmBdl/xfCYaZ2tWkq3N8olcgiKBsxCxSi51rXieSvMjLsfVId8byvKCbejoJo5sr XA6mvcjZ5K+F4zixD/Cj0uPUc0htgDMUlGqRpTVyYxiEQEGa5xwcwGGbk2I+ibqOws GmEki2AhDiAUyglpdl3t+PzSoLkEIPB6laQBItjBQxQkMYC4XOf8o/VZowMlzuo6oH K0AXH2DjQVw8O5htbBIwNe+Fo0sxe3X53zb/jyLMSN5GJL/h3hffs8IOuwmaQHyrqs EgXGm3Bvf06GuPKJ3+XLnNCV30tqfStXNtOH1YrLqlFJeI6J+p/NBMo17QVnW9exke b3d2U/CiHVSWQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A403767F8B for ; Mon, 6 Oct 2025 10:55:20 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769718; bh=rawu3eY0N+rE6Xuo4nBzMHfANxw/PLNu8WvClRBymnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=esa5gryBrbAyo2zMEOg87K2fcwEWmHYB1iTmKuGdQu8jrP6/CDX5ho2Yc5O/BLUOU AjG3f32Jq8MYhMOmwNt6gW7MNxJ/vJKN7Ce/SKFc8/QPDILS8icUELpxUFC6FS4eyz lhDEdviX+En1yGfdZhgGa79e8vKiqGehYjhDP1ESSzNhSvnMtdYB0ezI0DPq4KLL06 SbCpA70/wtXJYH58fvmzyRziXUN5YvUqLwwkzj/s5WInIovgAS4SBXofHB17Zr0qYl qXYu59+LiiABAjVh+DU1Ku1/W7SjWykWYWayXT3d7AnLrKkhzAUoHgeznNVR8Smc4X K1WIN23rw6ybA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B353A67F3F; Mon, 6 Oct 2025 10:55:18 -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 A1rl59QpFVjM; Mon, 6 Oct 2025 10:55:18 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769716; bh=hvQTEnRUkxTeuUV7XjrqZfyUe6ulxy0a3ffNplVLHJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ej1yJsJpgkXZtBcTt5n3hfwAod2vl058CH6+fA6BnBxgDaU7R8QEZI07lGdVCcZ8s T5D33sYG6oPEmcRjmH/TKpiL5+tRGfqVMbxO+wnLieflfignFIS4KvNf41aflpShGg zMiRe6UMJDFf9sIETv7B1ivRZZQuQmhl4HAk3Lt10++N2xjArE7rvY0OGBgdMzRkvy I48JA4w8Fdl7duE3Imnx/AWl+4N/4YSifXhKnnRWFQHWUBBHcbUCXk2IQzfnmvpiaS WjwsWuVezLUGcWylTWYHMPhXU/QBQ3529DK5r/2VYPoCt9xr6QI49d3k0+hpj2KBuC 4li6e/tABMqzw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C812467FBD; Mon, 6 Oct 2025 10:55:15 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:36 -0600 Message-ID: <20251006165452.1675349-5-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: E2UBKNOQW7ZIU7PEQXXVRIBPRQSXC5H3 X-Message-ID-Hash: E2UBKNOQW7ZIU7PEQXXVRIBPRQSXC5H3 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/14] expo: Update poll_mouse() to use struct vid_pos 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 Simplify the function to use struct vid_pos instead of separate x/y pointers. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 1051133e200..b5c54291220 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -411,22 +411,18 @@ static int poll_keys(struct expo *exp) return key ? key : -EAGAIN; } -static int poll_mouse(struct expo *exp, int *xp, int *yp) +static int poll_mouse(struct expo *exp, struct vid_pos *pos) { - struct vid_pos pos; int ret; if (!exp->mouse_enabled) return -EAGAIN; /* First check if we have a click available */ - ret = mouse_get_click(exp->mouse, &pos); + ret = mouse_get_click(exp->mouse, pos); if (ret) return log_msg_ret("epm", ret); - *xp = pos.x; - *yp = pos.y; - return 0; /* Click available */ } @@ -438,11 +434,11 @@ int expo_poll(struct expo *exp, struct expo_action *act) if (key != -EAGAIN) { ret = expo_send_key(exp, key); } else if (IS_ENABLED(CONFIG_MOUSE)) { - int x, y; + struct vid_pos pos; - ret = poll_mouse(exp, &x, &y); + ret = poll_mouse(exp, &pos); if (!ret) - ret = expo_send_click(exp, x, y); + ret = expo_send_click(exp, pos.x, pos.y); } if (ret) return log_msg_ret("epk", ret); From patchwork Mon Oct 6 16:54:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 508 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=1759769723; bh=vvt5MZdT5EV7ypgBEKYFtgG3HElnqF/yRBN13vcArC8=; 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=JLPC+IxNNhNqQaKGznMC90iNNliDbU99621bBBDSojMX9Xx+BvM4FoW9YMCkgZ7Hr LpHsdZxZ2G7e8XkDQy9lqtD0mjpewKnCfRsE+FjKzuG1DYburULVqALMQuLCafGh+o JXPYtL21DEsVUe1V2V+oLOdq+XlnwkvO26tMkl/gxj1c87Ggc3jPIHs7VB0S++7Nc8 Oy28mRFK5M1C2E4WD+5R7NfMXcoPsWNaWwBgQi/uI1tD4wbYROLlTGjiTb6syMTDHt LW/uO8QD7+OmXB1L1XtkfwicyssZZLF9oTC58ConR3+JmJKTOIHQ+6BG0RsLhSUDGA h6S4lx0lFG0Uw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E4C967FB1 for ; Mon, 6 Oct 2025 10:55:23 -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 8bPLg4BWSCRB for ; Mon, 6 Oct 2025 10:55:23 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769722; bh=vvt5MZdT5EV7ypgBEKYFtgG3HElnqF/yRBN13vcArC8=; 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=OUrbcZdvch6IyJW6MhcFwSRp1ZkrdJmOe0j2ut775H34DJIu0QXt5g62g4jziZ92l zyVagRH9SoixLaon/4Xs8PfSo+Lwm3v6545k+hVkBXv6Tc6SNsMMZYKWUevxHmYAyh 4BpwRrMFWub+C0BGTCJp18IpGCN+370Xd5mGlJ9Du2C5F7epI5qveCpIJJqOJvBOlg 8x792s+S6cBlhGUcOBfqxDTAeFVZrn8jx60V1A9DK/DmJCnSPdKiDhZraKGc3QEtGU F+6jZICs3lEDefJ21c9XpE9E5UjU7YimQvvOaZfASXvojX0XykNUOX0a41NExU4xII TSm4kKhVsmPDQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 68E6867FBA for ; Mon, 6 Oct 2025 10:55:22 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769718; bh=5N9KAUQgddU8HBoEqBG2H+ASYr0qCP0a6Y2b6tmgvYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PF+fX2ECrKffBfdok2N4Dp/iZnb6f3yg884q7/xAhAvhEOwZX0imELRq8mpxIOWQE Ro3CsmUFek0mT4YA2OJUwu4C3li0IvUtLC+T4XEgm5Sv3gzORuGtWvFVnHqi8dps14 CZRcWl6ThPFpSIh0atLRQeQmJBxKhCQpD7/7rkv1xgh61ynIMyG68NzfGYWg5KIXxc lPRVehskSqZnCQiPpfcJ6sDslkmgzqsafTC9BiLrAC1FY2gusNY5sy0Cvpq8WPva3m xcZ+prv9HpkEFYTZoVmOgcXjUpKFaYL6A8up2qu2ZDFGJc8pXIbdz8gEFi1R3xv0As 6f4ygMayND/uw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD9C967ECE; Mon, 6 Oct 2025 10:55:18 -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 LVGgbM6ZF6oc; Mon, 6 Oct 2025 10:55:18 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769718; bh=YwHDdWjCYyYzqaB0JsxMzQJktV/9VyyC81FT1nBRshU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D3mr02bZF8gZr4z9NqFrCB9D2UlNyC0dgJ316T4i2VPxZ0fhNL37ivqAImQ5bHcmI 84GCb/a7lqNxtkY7cOvAXWBcCmmg51y6myoaZZXqr7XTFjHUIS63seTEdGXoqLDFFP RQlHw7x8++wU+xj2pCM3Ve7ThqCh5qm8N8l2M2nnEeZP6dF9SB4M610Ig/3vhbw38r BuPYijyKzgUdPzdq9a0FXUi/D63ahQF3vitTikzOuc1CE0WeqizASRU3XAbIEPkWr0 2EpqxMvkcPEbA/9ArEZeyEfNGhV9TMUQOhXxxLNmqzAv+DTxMoM9MnzM90aWcrx1wp kuDZaeeBBIpLA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DD3C467F09; Mon, 6 Oct 2025 10:55:17 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:37 -0600 Message-ID: <20251006165452.1675349-6-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: VNZRGRHXPRNSU2QSQ5SDCRIPGTO6MTWZ X-Message-ID-Hash: VNZRGRHXPRNSU2QSQ5SDCRIPGTO6MTWZ 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 05/14] video: Add struct vid_size for width/height 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 Add struct vid_size with w and h members to represent dimensions in video operations, complementing struct vid_pos for positions and struct vid_bbox for bounding boxes. Signed-off-by: Simon Glass --- include/video_defs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/video_defs.h b/include/video_defs.h index 397764a5d3c..ba60765bb4a 100644 --- a/include/video_defs.h +++ b/include/video_defs.h @@ -59,6 +59,17 @@ struct vid_pos { int y; }; +/** + * struct vid_size - Represents a size for video operations + * + * @w: Width in pixels + * @h: Height in pixels + */ +struct vid_size { + int w; + int h; +}; + #endif /* __ASSEMBLY__ */ #endif /* __VIDEO_DEFS_H */ From patchwork Mon Oct 6 16:54:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 509 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=6ix9ma/Y/Pu5LQOzfmuwiVLLsc4N4p82Y+W/0iRt7Fo=; 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=B+4O80rjt2nK6VdWTIdkdMNyUQB+6zAHWtoHI4I2uvtTOZAEen+KN0fz9TTrJtYeR uFBnrfut6g2v0a/xH6LymTgMEd8U7XvOdlga7+rNSTTObzm8K8UU+IFpHB3bBTIVlh KfUeOYfq65Gy25Jnif/ds0i6dbrudgexDu5nzAYjHmmNYzuLmI/8kVJA7KkWc7rU7B kxiphmcfnSyqEsJZooVSbM6IxdaHTek/dhXXsJmPLeVxB58ds1V0swPL1trz20tbgG KIdncE+dS/PvUVoLLtqp2uSGwT+wJ6XCLYwFHrm85DLJNRlpNrUeHhbMI+dID53H9V 5Wdlv7gj/f+uQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C7D167ECE 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 q83EkQ91Mqm0 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=6ix9ma/Y/Pu5LQOzfmuwiVLLsc4N4p82Y+W/0iRt7Fo=; 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=B+4O80rjt2nK6VdWTIdkdMNyUQB+6zAHWtoHI4I2uvtTOZAEen+KN0fz9TTrJtYeR uFBnrfut6g2v0a/xH6LymTgMEd8U7XvOdlga7+rNSTTObzm8K8UU+IFpHB3bBTIVlh KfUeOYfq65Gy25Jnif/ds0i6dbrudgexDu5nzAYjHmmNYzuLmI/8kVJA7KkWc7rU7B kxiphmcfnSyqEsJZooVSbM6IxdaHTek/dhXXsJmPLeVxB58ds1V0swPL1trz20tbgG KIdncE+dS/PvUVoLLtqp2uSGwT+wJ6XCLYwFHrm85DLJNRlpNrUeHhbMI+dID53H9V 5Wdlv7gj/f+uQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CC3A67F8B 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=D9O3vWm3DuSvyCoa/X4H5wlhCsFLNyOXKif/ELeKvD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQWMJs/ybXiZ6sdT+nMrmTQY0VUYqHi51fmGshvIZq5pary+lzhtyGFqPSK+NQ/3n BaC5ZU2vPCBpbc2PGVOQhu4HSVJKFneX8CU4hxzjj6skp2BpHr+i5NvATzCyEWp2Br ZkYH1qo4S9G6pvpmk9MXPQOaWeBN9ti4Tr2cPj7LraPiFZ7cU0o2/6b2idCZZdFApJ vyuRB3aghhhLPywm9ErA52iYXhjlfbAWaLotmIL+JPWZ+/b3/mB3lnTRiE6ZZbbkqq ESpN0LleVrRqKINWCOIDbs8z51PdWxqpgw8hmSgl90+29CgkOJakFxcFd5pKFnlnf3 u4glXBYuzIOeQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E696567F1D; 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 peFuR08pidl3; 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=1759769719; bh=JH53SJYN958Onl0a5uuCgit4I6S2Roxh6inmAK4Y7ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sk/F2fM3ZRK30oPzMYPSf+toTHcMHzFa5U7uRPPY+7fEzlHkT3HpN0lA69sCGbvOp +pVCO9UuhS8NrQbZOCoH451520U43gdiu+f4+TH5QYZLoKZfpQ6FQPwn+MuqkZXw8W K/tDDVolFBmlqAPju+T/oY1K8EyNAq0+T3kfKFB1l8t1F+q8ce0FogKTkU1PZcmEFZ pJFS+qxfEpqx02+cETKysjabnhA5+IY9X9SKJ91ujFli8NIkJZPp/kdEmqaX/Vo2uw kzRiDGYa2xvsmro+oEbxb6FOP6axKoHJPtTcCTOPS9Z9bYwEm22eRxL8eWcwgHTCzk i+75eAxWnNOOQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2846C67F09; Mon, 6 Oct 2025 10:55:19 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:38 -0600 Message-ID: <20251006165452.1675349-7-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: 6YDIYKPGQPC3JCMQ23DVN6JSSWIQX5GM X-Message-ID-Hash: 6YDIYKPGQPC3JCMQ23DVN6JSSWIQX5GM 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/14] mouse: Track last mouse position 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 Add tracking of the last mouse position received, separate from the click position. This allows callers to query the current mouse position using mouse_get_pos() regardless of whether a click occurred. The position is updated in mouse_get_event() for both motion and button events, ensuring it always reflects the most recent mouse coordinates. This avoid the problem of mouse_get_click() 'swallowing' motion events so that a position change is not noticed, e.g. for showing a pointer. Co-developed-by: Claude Signed-off-by: Simon Glass --- drivers/input/mouse-uclass.c | 22 ++++++++++++++++++++++ include/mouse.h | 11 +++++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index 1bb836ff59d..ee983397ef3 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -10,6 +10,7 @@ int mouse_get_event(struct udevice *dev, struct mouse_event *evt) { + struct mouse_uc_priv *uc_priv = dev_get_uclass_priv(dev); struct mouse_ops *ops = mouse_get_ops(dev); int ret; @@ -20,6 +21,18 @@ int mouse_get_event(struct udevice *dev, struct mouse_event *evt) if (ret) return ret; + /* Update last position for motion events */ + if (evt->type == MOUSE_EV_MOTION) { + uc_priv->last_pos.x = evt->motion.x; + uc_priv->last_pos.y = evt->motion.y; + } + + /* Update last position for button events */ + if (evt->type == MOUSE_EV_BUTTON) { + uc_priv->last_pos.x = evt->button.x; + uc_priv->last_pos.y = evt->button.y; + } + return 0; } @@ -61,6 +74,15 @@ int mouse_get_click(struct udevice *dev, struct vid_pos *pos) return -EAGAIN; } +int mouse_get_pos(struct udevice *dev, struct vid_pos *pos) +{ + struct mouse_uc_priv *uc_priv = dev_get_uclass_priv(dev); + + *pos = uc_priv->last_pos; + + return 0; +} + UCLASS_DRIVER(mouse) = { .id = UCLASS_MOUSE, .name = "mouse", diff --git a/include/mouse.h b/include/mouse.h index 76f9c789b7b..7fe263b289f 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -37,10 +37,12 @@ enum mouse_press_state_t { * * @left_button_state: Current state of left button (BUTTON_PRESSED/BUTTON_RELEASED) * @click_pos: Position where the click occurred + * @last_pos: Last position received from mouse */ struct mouse_uc_priv { enum mouse_press_state_t left_button_state; struct vid_pos click_pos; + struct vid_pos last_pos; }; /** @@ -100,4 +102,13 @@ int mouse_get_event(struct udevice *dev, struct mouse_event *event); */ int mouse_get_click(struct udevice *dev, struct vid_pos *pos); +/** + * mouse_get_pos() - Get the current mouse position + * + * @dev: Mouse device + * @pos: Returns last position + * Returns: 0 if position is available, -ve on error + */ +int mouse_get_pos(struct udevice *dev, struct vid_pos *pos); + #endif 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 */ From patchwork Mon Oct 6 16:54:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 511 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=1759769731; bh=sIXKeMJwSsgWLw2CLCSevkAC+FzplGIrM6W0j+dQihE=; 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=apyQmpW+SmtPaCfxJ2BFY5NQ41ZCmSRYrW8eDZqW3aobtpWiRV70Hchui6hc3nM20 K/BA4WsAHzhGQOFp0MWu0Nbh/i7UEfmNgYry0Lbia2eu/7WMvOymsbNqmS6NHbdsMi XfwPKUvEdUEqV0gFYCxHxSqG3V5qhl3Ps2uow8/oqtu+sU9x6chRxqDLFypuZqVDli MBJgJ7HsoDeUvlGzfKXAuNI0ERGStSgmuuBbXB7YA0hJf95YGmoa5bZ18uYl+5HwH7 GziD56Yagu5P3uOmKnLys5vBQwq9JILysjOtTJCfQIwHAowVTtFx7feZYhNVSQNn64 P9JQFxsv/ZGNg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B7C5967F8E for ; Mon, 6 Oct 2025 10:55:31 -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 O0LpH-3dwpLA for ; Mon, 6 Oct 2025 10:55:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769731; bh=sIXKeMJwSsgWLw2CLCSevkAC+FzplGIrM6W0j+dQihE=; 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=apyQmpW+SmtPaCfxJ2BFY5NQ41ZCmSRYrW8eDZqW3aobtpWiRV70Hchui6hc3nM20 K/BA4WsAHzhGQOFp0MWu0Nbh/i7UEfmNgYry0Lbia2eu/7WMvOymsbNqmS6NHbdsMi XfwPKUvEdUEqV0gFYCxHxSqG3V5qhl3Ps2uow8/oqtu+sU9x6chRxqDLFypuZqVDli MBJgJ7HsoDeUvlGzfKXAuNI0ERGStSgmuuBbXB7YA0hJf95YGmoa5bZ18uYl+5HwH7 GziD56Yagu5P3uOmKnLys5vBQwq9JILysjOtTJCfQIwHAowVTtFx7feZYhNVSQNn64 P9JQFxsv/ZGNg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A5DA967F1D for ; Mon, 6 Oct 2025 10:55:31 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769730; bh=yYy5O038dgDJTBdSjeAi0X93zDga+y30bGz62ysUZlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=huX8Yvum5aTsm5FjNNpAHV7HMRKibLAcf3kD9AtTnGlsJv7lWbs4bXcMt+4UGd/MN ELXK+iP9JDpu4JlpT2OQfdd9COmjZoQQAPuVXbJ2ceJYe8vpTOtSlrLtdRWn6zNfWd 26d/aI6D9u3FUkOcGc3QhSr3kK8+hhqHg/nLsX7lFzef/8HAd3bEcS2FIABC13yKaH oQFU7HKX/jpvIj96If57bGwfkp7EAqBua3KilfVy7w2TlQch2CRgjOicB9Xx3Eter6 G0BVJ+7xjc3Nt6yPgZO5802ttuo74IRzFEBdJXIL8rEcUoVuKuJAlHX5VeYzQkflWz Rt2BC9j57g15g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4141567F03; Mon, 6 Oct 2025 10:55:30 -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 gARJz5WnvNKa; Mon, 6 Oct 2025 10:55:30 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769726; bh=KSqKZWksYfN9qz55T7b5qHqUmDyH/SOmN8bGsYV4hFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/LnBiFwWJ6II1b/geLzWR3a0YSprd05u01RUqHl07H1z0tjDbZW0q2bZ3yr4EOpd 2hJ2BYxy5mlwEZdaxmxTaRNiQEdYgd/MdVHGcwID4Sj4mdHNB6/XgclUVD+ZO3SBeq sehWP3UZmrqkjOEq/hc3lkxrvmSh+WGh0SMJMeM+fP2vxnGSQEiV8WA6qnKn3cxrid 1RJivTPucwNRECM5bOrFne9WHgV/vmnIh6qIMUb7e+WDT4NwrH7vP9dhH1Gn5PJQx5 T5LEZMA8vmjZyF5jYEP9KvDk3JwS8ct6EttuTCKOVn+505FOeM+ibULdkZ7AeUlfgU SxT0ypo1aNodg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E2FEA67EE4; Mon, 6 Oct 2025 10:55:25 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:40 -0600 Message-ID: <20251006165452.1675349-9-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: K37CERKC57B33OA6SGQOV4RWFIONSKIS X-Message-ID-Hash: K37CERKC57B33OA6SGQOV4RWFIONSKIS 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 08/14] expo: Show the mouse when enabled 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 When the mouse is enabled, show it at its new position each time the expo is rendered. Signed-off-by: Simon Glass --- boot/expo.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/expo.h | 2 ++ 2 files changed, 61 insertions(+) diff --git a/boot/expo.c b/boot/expo.c index 42109b88e72..295b779dce8 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -249,6 +250,56 @@ int expo_arrange(struct expo *exp) return 0; } +static int update_mouse_position(struct expo *exp) +{ + struct mouse_event event; + int ret; + + if (!IS_ENABLED(CONFIG_MOUSE) || !exp->mouse_enabled) + return 0; + + /* Process all available mouse events to get latest position */ + while (1) { + ret = mouse_get_event(exp->mouse, &event); + if (ret) + break; /* No more events available */ + + if (event.type == MOUSE_EV_MOTION) { + exp->mouse_pos.x = event.motion.x; + exp->mouse_pos.y = event.motion.y; + } else if (event.type == MOUSE_EV_BUTTON) { + exp->mouse_pos.x = event.button.x; + exp->mouse_pos.y = event.button.y; + } + } + + return 0; +} + +/** + * render_mouse_pointer() - Render the mouse pointer if enabled and visible + * + * @exp: Expo containing mouse state + * Return: 0 if OK, -ve on error + */ +static int render_mouse_pointer(struct expo *exp) +{ + struct udevice *dev = exp->display; + int ret; + + if (!IS_ENABLED(CONFIG_MOUSE) || !exp->mouse_enabled || !exp->mouse_ptr) + return 0; + + /* Use white (0xffffff) as transparent color */ + ret = video_bmp_displaya(dev, map_to_sysmem(exp->mouse_ptr), + exp->mouse_pos.x, exp->mouse_pos.y, false, true, + 0xffffff); + if (ret) + log_debug("Failed to display mouse pointer: %d\n", ret); + + return 0; +} + int expo_render(struct expo *exp) { struct udevice *dev = exp->display; @@ -274,6 +325,11 @@ int expo_render(struct expo *exp) return log_msg_ret("ren", ret); } + /* Render mouse pointer if mouse is enabled */ + ret = render_mouse_pointer(exp); + if (ret) + return log_msg_ret("mou", ret); + video_sync(dev, true); return scn ? 0 : -ECHILD; @@ -441,6 +497,9 @@ int expo_poll(struct expo *exp, struct expo_action *act) { int key, ret = -EAGAIN; + /* update mouse position if mouse is enabled */ + update_mouse_position(exp); + key = poll_keys(exp); if (key != -EAGAIN) { ret = expo_send_key(exp, key); diff --git a/include/expo.h b/include/expo.h index 3250ecee40e..622088f395b 100644 --- a/include/expo.h +++ b/include/expo.h @@ -134,6 +134,7 @@ struct expo_theme { * @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) + * @mouse_pos: Current mouse position * @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 @@ -158,6 +159,7 @@ struct expo { bool mouse_enabled; const void *mouse_ptr; struct vid_size mouse_size; + struct vid_pos mouse_pos; void *priv; bool done; bool save; From patchwork Mon Oct 6 16:54:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 512 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=1759769737; bh=2eZsB8ATwDmjUm7JkqFpg1AX3BeBVD3j0TY6ii1y1Ok=; 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=flyobdMN75HYqvpz8I9gF1zBf633mG7LNauWk/5RVTxhLfEwtJVpeKjeKHzIShRwJ HGeREQGUG9wxstp8zJOanW3pMYdf5I/ENylSpITek428mSbAkulDYaWHZWrZbXhs97 qPVnfqk1otU9Ift/CQgvHZyTxnFZf6/XZQSTrkbUFnvGHVDv78/M49IvnODQasyFeG kb8Kc7fb8gx5mR9QoS8/bjLhuqwkXpFgNZQE99dMJNKvcCAoQz9aVgBUAJk5NbNHwe j4jpFADwi7r2J8JpKhRANYNW4l/9JnW2hYAsAQ2qiwJ3G+GN2yedims2Wipe8mgryD F9z06JBDQClbQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 459DA67F8B for ; Mon, 6 Oct 2025 10:55:37 -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 Cc0HCRMqR0h6 for ; Mon, 6 Oct 2025 10:55:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769737; bh=2eZsB8ATwDmjUm7JkqFpg1AX3BeBVD3j0TY6ii1y1Ok=; 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=flyobdMN75HYqvpz8I9gF1zBf633mG7LNauWk/5RVTxhLfEwtJVpeKjeKHzIShRwJ HGeREQGUG9wxstp8zJOanW3pMYdf5I/ENylSpITek428mSbAkulDYaWHZWrZbXhs97 qPVnfqk1otU9Ift/CQgvHZyTxnFZf6/XZQSTrkbUFnvGHVDv78/M49IvnODQasyFeG kb8Kc7fb8gx5mR9QoS8/bjLhuqwkXpFgNZQE99dMJNKvcCAoQz9aVgBUAJk5NbNHwe j4jpFADwi7r2J8JpKhRANYNW4l/9JnW2hYAsAQ2qiwJ3G+GN2yedims2Wipe8mgryD F9z06JBDQClbQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3483267F03 for ; Mon, 6 Oct 2025 10:55:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769734; bh=cAW8epNOsRlYaluECPP9I3OZTER1ncEavqQ7fDIOqFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hF3skmIHvQw2pa2l4v1EkwgFbq2evMAeRMvkGhpVqOuHmd2iQlYXcn1K12vjLdZGE KE7T7Pg9NZxeNCX9RAgNS+XxMuUH4S0U1umVpTQYBmrqA0L8rZ2E0m4fWQUXDIkFqs xPfSjdEdXez5wHse+bllWbgkHCODRC4FeXH6UcvMy5PDURIuBzSGj4z1oVtWysLHb1 YJG+JP7g1PS07SY1ZKxVSFMy1dnBXFEcnDsDhD29T8xncsRCouCaQ1tiIa0H4H9NdO 3iOxU3wdUPCirhemgN9MvgBHiB0gv3uLGwiTtRWJT6Pf6aPjy3yZ19588QRP8r6psQ LJH/9VcrDprcA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D65AC67ECE; Mon, 6 Oct 2025 10:55:34 -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 2zjTdYwRS3Jd; Mon, 6 Oct 2025 10:55:34 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769730; bh=vc5AFEkzwNkK2yDTpSV8BDfYi53tP0w8msWOgzPtkNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTqShe+fqMejqATyfegi8UuzfhYSpzSw1nhPBPDdSI6KzIqshHloHffupfT7Xnu9V wBlkfhl2UE7fLVhZ3iUlYjal0tB+er7GajIsbawvaE/v7CMW2W1qFRTNZrCzbOgeRd xfsqnEceLRA8foJb/tXOOcEpKEKPx5yoSEx8t4WrieBMyu2ur0pEpFWI1ZmasoAIOy 4AfoET47i648GlzdPMBC2bqCqp19FK1k3aK7OCG5jE0lZB/bNxvJ7tG7fXjbSW2glz oLQlRNb1JqugFNLd7za5wsrsPlHLDsBRdknwLQmPKKPzuSAAQrfosB/2ZzZN2gSAd0 KVPlz4HJ4bjjg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 82EDD67EE4; Mon, 6 Oct 2025 10:55:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:41 -0600 Message-ID: <20251006165452.1675349-10-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: QX6SRBZI63YGRGHHCMIZXQ3CUBS24MHC X-Message-ID-Hash: QX6SRBZI63YGRGHHCMIZXQ3CUBS24MHC 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 09/14] expo: Drop struct scene_obj_bbox in favour of vid_bbox 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 Replace the scene_obj_bbox with the common vid_bbox structure to avoid having the same structs with different names. Signed-off-by: Simon Glass --- boot/scene.c | 4 ++-- include/expo.h | 19 ++----------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index 96130f160fc..a451ee1d325 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -386,7 +386,7 @@ int scene_obj_flag_clrset(struct scene *scn, uint id, uint clr, uint set) static void handle_alignment(enum scene_obj_align horiz, enum scene_obj_align vert, - struct scene_obj_bbox *bbox, + struct vid_bbox *bbox, struct scene_obj_dims *dims, int xsize, int ysize, struct scene_obj_offset *offset) @@ -555,7 +555,7 @@ static int scene_txt_render(struct expo *exp, struct udevice *dev, struct vidconsole_colour old; enum colour_idx fore, back; struct scene_obj_dims dims; - struct scene_obj_bbox bbox; + struct vid_bbox bbox; const char *str; int ret; diff --git a/include/expo.h b/include/expo.h index 622088f395b..a6e6b2b780b 100644 --- a/include/expo.h +++ b/include/expo.h @@ -234,21 +234,6 @@ enum scene_obj_t { SCENEOBJT_TEXTLINE, }; -/** - * struct scene_obj_bbox - Dimensions of an object - * - * @x0: x position, in pixels from left side - * @y0: y position, in pixels from top - * @x1: x position of right size - * @y1: y position of bottom - */ -struct scene_obj_bbox { - int x0; - int y0; - int x1; - int y1; -}; - /** * struct scene_obj_offset - Offsets for drawing the object * @@ -367,8 +352,8 @@ struct scene_obj { char *name; uint id; enum scene_obj_t type; - struct scene_obj_bbox req_bbox; - struct scene_obj_bbox bbox; + struct vid_bbox req_bbox; + struct vid_bbox bbox; struct scene_obj_offset ofs; struct scene_obj_dims dims; enum scene_obj_align horiz; From patchwork Mon Oct 6 16:54:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 513 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=1759769739; bh=GfGh2wrVlE7TzGBlQH3YhMRXA5eML6WqKxbf5no1z8M=; 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=N0Qo+/96QZQNR6yb96FhI9kd4euwJNlchsfQSLyxscRcgwTCx5sVhd2hqhRARtgD1 JNkccaK9pJCiFiS1AuQo3774hywOFd4cyGcJk/D2j38YUXOBipYjPHifDhjAFRJ/co ZtiwE7Urg+ZpcL9ohsET+/0AEpP23lZGLBrMhZgytQKqUtwoSMs6i0kiiGTF6QyFk/ L4PvuA0cUvP+MHvwutPxAny1X+tXMx5i2SubInpSpXbD5exDpj8aH9djsODPpWwqwF SosTyMEhFxRvNKNIokXv9BSrp0sYaW3intJMODzVhNtIUP7gz5gHeDMV09zaXnsa8g tRfACixgUTb8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D0A4867ECE for ; Mon, 6 Oct 2025 10:55:39 -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 ijJTD3S7W9K7 for ; Mon, 6 Oct 2025 10:55:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769738; bh=GfGh2wrVlE7TzGBlQH3YhMRXA5eML6WqKxbf5no1z8M=; 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=NPwyElppXFb5VjLKaBINFP3aNdssc+M4FgYSlNp5sFY6bGOGlfWw6ZyUUULqU9IPf UUyXmN9KL50A2seZYM2uBMM8D9Hm5PN8ZJrpimoM/nxrHDRMcgg4yWQp8oZcQJNjrt dT4VC+kdqTpMl5DZauUi0WFSQMjD6+fMfPaZD0blLv/joG6gBnEbjHpzkJ3s5VUnY9 CKj1zw+1uXSp8v0N49rCb2W7ejJ+P2ju30hEoKRN3P104eU2baxjKDFiT6iRoK7Kn9 g9fcJIFklwPZhvYiPSaHl9meAVPPb93PRGRZdo4hlGXdj58/48Y7BYg5fSgfhib7ZH Ra/u6miL5jmjw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C1B5067EE5 for ; Mon, 6 Oct 2025 10:55:38 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769736; bh=fpSNYOsDg+0cMiqwtPIURlRwBX7YjGbzk2t68WmiOpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnEJhs/lVduxLswtlX+UrSts8VVWMUS4TRPu+HCW1+wlxjzcXuILO8YJpiBvE12Wz k4wgchdKlcvgAShWhIqUBKP0DTikcp6db4GxUt+T22I72FOz+68069fNg30c3DFnRw NCyYoRAS756LcrJYatMqwPLukltDNPlh7t/SfBsiFVhS2OKYouu2VJwwBMhW3mwG1E k5I+kkE5h6ihUHf1fGE95eA9eV0DXwgamOdTuUoSAZlkIwjabUHK8JPAIKf4TYIaii 1gXIoBeLt+aqNXCZXUPuwhVrDwAeJ+Xurw10nHTUSpdyzg4s9fhnSlShhOvEqFpSHQ y0OarEy51Ykdg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EEC4667ECE; Mon, 6 Oct 2025 10:55:36 -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 9FPAe_H8jXb9; Mon, 6 Oct 2025 10:55:36 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769735; bh=jeAXsaTKAvqxaCkDThiP5U0va+eq8TtjQ2HU/U5SiKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnZw7LH7TSnPdAT3kBwNUGf9+m7kSn/wRlLbx9ZNJxLZ/O8arFWhQ3NpVf/4/1Aei ohl8/AEImOWcEM0QMMzVhO8QkgNKjo/OSVvwgub2S23jD2wEqv2j04WI0sAFnkPziP dk9e1g5IwqpgBIN4DIeEUB5DHwZKB0jFv1OvJvmCb5S2rbBD16J7CsamHhQhEhgKuB HDS4IWZu5o0GIZv6QKhHKxLlyVsNrkKqJ1BwS378ZtfO+DUA28t89NflrbxLey0adL OWftEfAmbIDSBCHiAjtFwJEkY2E/JIKdRBHy+8E5gnCsn5zI6OJnm/gmC7/qRQFMNy 0lO0oHTVRhABA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 28D9767EE4; Mon, 6 Oct 2025 10:55:35 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:42 -0600 Message-ID: <20251006165452.1675349-11-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: GDWOA3NXUSG2YHTQVLJLMOTRT4SFULFP X-Message-ID-Hash: GDWOA3NXUSG2YHTQVLJLMOTRT4SFULFP 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/14] expo: Add damage tracking 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 As a few step towards making rendering more efficient, add support for tracking video damage within an expo. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 30 ++++++++++++++++++++++++++++++ include/expo.h | 23 +++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/boot/expo.c b/boot/expo.c index 295b779dce8..5cbe06b1c28 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -536,3 +536,33 @@ void expo_exit_mode(struct expo *exp) { video_manual_sync(exp->display, false); } + +void expo_damage_reset(struct expo *exp) +{ + exp->damage.x0 = 0; + exp->damage.y0 = 0; + exp->damage.x1 = 0; + exp->damage.y1 = 0; +} + +void expo_damage_add(struct expo *exp, const struct vid_bbox *bbox) +{ + /* If bbox is invalid (empty), do nothing */ + if (bbox->x1 <= bbox->x0 || bbox->y1 <= bbox->y0) + return; + + /* If current damage is empty, set it to the new bbox */ + if (exp->damage.x1 <= exp->damage.x0 || exp->damage.y1 <= exp->damage.y0) { + exp->damage = *bbox; + } else { + /* Expand damage area to include new bbox */ + if (bbox->x0 < exp->damage.x0) + exp->damage.x0 = bbox->x0; + if (bbox->y0 < exp->damage.y0) + exp->damage.y0 = bbox->y0; + if (bbox->x1 > exp->damage.x1) + exp->damage.x1 = bbox->x1; + if (bbox->y1 > exp->damage.y1) + exp->damage.y1 = bbox->y1; + } +} diff --git a/include/expo.h b/include/expo.h index a6e6b2b780b..487b58fb916 100644 --- a/include/expo.h +++ b/include/expo.h @@ -135,6 +135,7 @@ struct expo_theme { * @mouse_ptr: Pointer to mouse pointer image data (BMP format) * @mouse_size: Size of mouse pointer (width and height in pixels) * @mouse_pos: Current mouse position + * @damage: Bounding box of the area that needs to be redrawn * @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 @@ -160,6 +161,7 @@ struct expo { const void *mouse_ptr; struct vid_size mouse_size; struct vid_pos mouse_pos; + struct vid_bbox damage; void *priv; bool done; bool save; @@ -1197,4 +1199,25 @@ void expo_enter_mode(struct expo *exp); */ void expo_exit_mode(struct expo *exp); +/** + * expo_damage_reset() - Reset the damage tracking area + * + * @exp: Expo to reset damage tracking for + * + * Clears the damage area, indicating that no part of the display needs + * to be redrawn. + */ +void expo_damage_reset(struct expo *exp); + +/** + * expo_damage_add() - Add a damaged area to the expo damage tracking + * + * @exp: Expo to add damage to + * @bbox: Bounding box of the damaged area to add + * + * Expands the current damage area to include the new damaged region. + * If there is no existing damage, the damage area is set to the new region. + */ +void expo_damage_add(struct expo *exp, const struct vid_bbox *bbox); + #endif /*__EXPO_H */ From patchwork Mon Oct 6 16:54:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 514 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=1759769744; bh=VHbxRdoCFvOvw5t/h8/Jfwrq1gZ78VQIvdeYUKqZdcA=; 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=bEptPppXvAcKq714zFdg33jSNsFf7uvaDAJiGgFHW+JmtDP7UratdxVb+Wh7hrgqt XtfncpGlD/8o6mHy/eZXI4lLYQ9Rnmr69TIHWEzdZeI2xU3K0v9LJrh4h3p57B+dMc C4X2Z78nxkFIS/9WDWso9tv2Bsy9ezJLaUdRqqrWsOOPj8FWaFEGctSeziP0Pn/sdj 1g7bcfFCwOpHu9pWpIWSb36v1Us7jVYk4yGiQBjrLganZSKwnN+cMMLHzyI4LOw8AE glP4QWrUI3+wGdtHKKWa3PE8IPocccb8lMOZY2ziyYrFgf/MagXjkmZQb8/j1r72QP Y62AMl+eGrXdg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A8D1167F8E for ; Mon, 6 Oct 2025 10:55:44 -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 mTtL1vfxamg2 for ; Mon, 6 Oct 2025 10:55:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769744; bh=VHbxRdoCFvOvw5t/h8/Jfwrq1gZ78VQIvdeYUKqZdcA=; 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=bEptPppXvAcKq714zFdg33jSNsFf7uvaDAJiGgFHW+JmtDP7UratdxVb+Wh7hrgqt XtfncpGlD/8o6mHy/eZXI4lLYQ9Rnmr69TIHWEzdZeI2xU3K0v9LJrh4h3p57B+dMc C4X2Z78nxkFIS/9WDWso9tv2Bsy9ezJLaUdRqqrWsOOPj8FWaFEGctSeziP0Pn/sdj 1g7bcfFCwOpHu9pWpIWSb36v1Us7jVYk4yGiQBjrLganZSKwnN+cMMLHzyI4LOw8AE glP4QWrUI3+wGdtHKKWa3PE8IPocccb8lMOZY2ziyYrFgf/MagXjkmZQb8/j1r72QP Y62AMl+eGrXdg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9775967F8B for ; Mon, 6 Oct 2025 10:55:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769742; bh=Gt7c2V8kiQDvvStYveCkLszCtFGvIdX4NZS4m0ctq3g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Be/eTzAMVQdM9IJ54d5SWIJGkss/h+oBuzs0Ms6PEfnh/tJse07swYC8iz3sdnUR4 iFFHLWIRWORN/R9hNOs/9jPweYojqd7lsEuK7riC60msu1q3mrb3Ise66q+H9Y6g1S Ik4YypQ7ZJefvrrFTZRYIRzM2XpJQi/+mep/7ezhDKagNjhhhaEUonEugNnJtYDXgB A3znc+kt3yqd0X7Y+lRIw/CUHW192UONudKQJ1bjXYHswGi+HCpohpca5j6Kl7B81w I++GCtQ5HpPXMs0nNHeZQfSFxqzI0SHY7apAsRK6hmUXirxDS8/G2UNG+jkd9lhkM8 vHOkYtURGGv8w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5857267F03; Mon, 6 Oct 2025 10:55:42 -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 7Nxd3d3LT8UW; Mon, 6 Oct 2025 10:55:42 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769737; bh=x22NKH9LKI8JcrlF4HaFKZvnJx3/G7IIiOQ/Uz8d5+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w16DXR1GzwQvBFjGvdqJUyPRuX8E+b7rWmdTFu3VLFBI/SWNk93UOqPidHsCmAbrD 2vuwhJ5NwAnYqYfWJfRqDxTuGq/QkQktQEdXzUm4jVZq+nzwO7Uq8qwky5PTjbkRMX swBuR7jPl/7isLT1Wrp1tMmFuW1OkGLE0ZNnYUrKAi1aOPAJ+Ws3sg7AhUIq+OEmkA vtJXTTS6yLdus1b5UFrJAqfNXOB7RwfnkmFn2cxLvf4k62Yp2j3qwErmQUgaeMEH9Q PmYCYA3nLdl184IR9PShznGhWmM1bZgRpc44SHSsEguhjHeqGkXCexlLe3XL8UrgLi DWZCKzzELkIsg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3F94567EE4; Mon, 6 Oct 2025 10:55:37 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:43 -0600 Message-ID: <20251006165452.1675349-12-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: O66CHDD4DLVCZFIKGFK4226TGP5DBOUN X-Message-ID-Hash: O66CHDD4DLVCZFIKGFK4226TGP5DBOUN 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/14] expo: Set dirty flag when an object bbox changes 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 Add a flag to indicate that am object must be redrawn. Set this flag when an object's bounding box changes. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/scene.c | 7 +++++++ include/expo.h | 2 ++ test/boot/cedit.c | 21 +++++++++++++-------- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index a451ee1d325..242f21bbacf 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -1300,6 +1300,7 @@ int scene_sync_bbox(struct scene *scn) list_for_each_entry(obj, &scn->obj_head, sibling) { int req_width = obj->req_bbox.x1 - obj->req_bbox.x0; int req_height = obj->req_bbox.y1 - obj->req_bbox.y0; + struct vid_bbox old_bbox = obj->bbox; if (obj->flags & SCENEOF_SYNC_POS) { if (obj->flags & SCENEOF_SIZE_VALID) { @@ -1321,6 +1322,12 @@ int scene_sync_bbox(struct scene *scn) obj->bbox.x1 = obj->bbox.x0 + req_width; if (obj->flags & SCENEOF_SYNC_BBOX) obj->bbox = obj->req_bbox; + + /* Set dirty flag if bbox changed */ + if (old_bbox.x0 != obj->bbox.x0 || old_bbox.y0 != obj->bbox.y0 || + old_bbox.x1 != obj->bbox.x1 || old_bbox.y1 != obj->bbox.y1) + obj->flags |= SCENEOF_DIRTY; + obj->flags &= ~(SCENEOF_SYNC_POS | SCENEOF_SYNC_SIZE | SCENEOF_SYNC_WIDTH | SCENEOF_SYNC_BBOX); } diff --git a/include/expo.h b/include/expo.h index 487b58fb916..fcc090d54f1 100644 --- a/include/expo.h +++ b/include/expo.h @@ -308,6 +308,7 @@ enum scene_obj_align { * @SCENEOF_SYNC_WIDTH: object's widget has changed * @SCENEOF_SYNC_BBOX: object's bounding box has changed * @SCENEOF_MANUAL: manually arrange the items associated with this object + * @SCENEOF_DIRTY: object has been modified and needs to be redrawn * @SCENEOF_LAST: used just as a check for the size of the flags mask */ enum scene_obj_flags_t { @@ -320,6 +321,7 @@ enum scene_obj_flags_t { SCENEOF_SYNC_WIDTH = BIT(6), SCENEOF_SYNC_BBOX = BIT(7), SCENEOF_MANUAL = BIT(8), + SCENEOF_DIRTY = BIT(9), SCENEOF_LAST, /* check for size of flags below */ }; diff --git a/test/boot/cedit.c b/test/boot/cedit.c index 80150a29d37..bccc93f8926 100644 --- a/test/boot/cedit.c +++ b/test/boot/cedit.c @@ -593,20 +593,22 @@ static int cedit_mouse(struct unit_test_state *uts) ut_assertok(click_check(uts, scn, item->label_id, EXPOACT_OPEN, &act)); ut_asserteq(ID_CPU_SPEED, act.select.id); ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); - ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, speed->obj.flags); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID | SCENEOF_DIRTY, + speed->obj.flags); /* click outside the label to close the menu */ ut_assertok(scene_send_click(scn, 10, 10, &act)); ut_asserteq(EXPOACT_CLOSE, act.type); ut_asserteq(ID_CPU_SPEED, act.select.id); ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); - ut_asserteq(SCENEOF_SIZE_VALID, speed->obj.flags); + ut_asserteq(SCENEOF_SIZE_VALID | SCENEOF_DIRTY, speed->obj.flags); /* click on CPU speed to open it again */ ut_assertok(click_check(uts, scn, item->label_id, EXPOACT_OPEN, &act)); ut_asserteq(ID_CPU_SPEED, act.select.id); ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); - ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, speed->obj.flags); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID | SCENEOF_DIRTY, + speed->obj.flags); /* click on the second item (1.5 GHz) */ item = scene_menuitem_find_seq(speed, 1); @@ -619,7 +621,7 @@ static int cedit_mouse(struct unit_test_state *uts) /* verify that the second item is now selected and menu is closed */ ut_asserteq(ID_CPU_SPEED_2, speed->cur_item_id); - ut_asserteq(SCENEOF_SIZE_VALID, speed->obj.flags); + ut_asserteq(SCENEOF_SIZE_VALID | SCENEOF_DIRTY, speed->obj.flags); ut_asserteq(ID_CPU_SPEED, scn->highlight_id); /* click on the power loss menu to open it */ @@ -629,7 +631,8 @@ static int cedit_mouse(struct unit_test_state *uts) &act)); ut_asserteq(ID_POWER_LOSS, act.select.id); ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); - ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, loss->obj.flags); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID | SCENEOF_DIRTY, + loss->obj.flags); /* click on CPU speed to open it again */ item = scene_menuitem_find_seq(speed, 0); @@ -637,7 +640,8 @@ static int cedit_mouse(struct unit_test_state *uts) &act)); ut_asserteq(ID_CPU_SPEED, act.select.id); ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); - ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, speed->obj.flags); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID | SCENEOF_DIRTY, + speed->obj.flags); /* click on the lineedit */ ut_assertok(click_check(uts, scn, mach->edit_id, @@ -647,8 +651,9 @@ static int cedit_mouse(struct unit_test_state *uts) ut_assertok(cedit_do_action(exp, scn, vid_priv, &act)); ut_asserteq(ID_CPU_SPEED_2, speed->cur_item_id); ut_asserteq(ID_MACHINE_NAME, scn->highlight_id); - ut_asserteq(SCENEOF_SIZE_VALID, loss->obj.flags); - ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID, mach->obj.flags); + ut_asserteq(SCENEOF_SIZE_VALID | SCENEOF_DIRTY, loss->obj.flags); + ut_asserteq(SCENEOF_OPEN | SCENEOF_SIZE_VALID | SCENEOF_DIRTY, + mach->obj.flags); return 0; } From patchwork Mon Oct 6 16:54:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 515 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=1759769749; bh=ZyTow6JlBi46VYvAcDscKS5nOd03YTNOl+4GjtmVTnI=; 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=KY558Hk2heOM8WQG4KuRJY4H5D9+XlbwBP4dVIHLrwMqck9kE+xzX7eQbzF1B2R7q wGwtau9mmVYIBf8GcXGyKqkAc9Noz9+fK3IvJ5fFS00CCOtRS6U5yhhDqfnl22kH2x Wd3aysJ+cie8OInAsyY+PRuHtEoWD8EnrOaL1TRcBy0L9F7awaeFxHfjJHTxu6M5wo vSBidVjS1LH79Et8G1dTEC/AWn21R6JpeSUX7kikeGU5VQvYgy+O1e7JTudyZB01de d0LenYjU9S+4WazO4l6ODEmMJMinOBcUz6ihaZPh44mNg/Hy3RKinpRfLZL8DE2c/0 iWo3Yghm+qSng== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 85EBB67EE4 for ; Mon, 6 Oct 2025 10:55:49 -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 cfZXB0spCLDH for ; Mon, 6 Oct 2025 10:55:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769749; bh=ZyTow6JlBi46VYvAcDscKS5nOd03YTNOl+4GjtmVTnI=; 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=KY558Hk2heOM8WQG4KuRJY4H5D9+XlbwBP4dVIHLrwMqck9kE+xzX7eQbzF1B2R7q wGwtau9mmVYIBf8GcXGyKqkAc9Noz9+fK3IvJ5fFS00CCOtRS6U5yhhDqfnl22kH2x Wd3aysJ+cie8OInAsyY+PRuHtEoWD8EnrOaL1TRcBy0L9F7awaeFxHfjJHTxu6M5wo vSBidVjS1LH79Et8G1dTEC/AWn21R6JpeSUX7kikeGU5VQvYgy+O1e7JTudyZB01de d0LenYjU9S+4WazO4l6ODEmMJMinOBcUz6ihaZPh44mNg/Hy3RKinpRfLZL8DE2c/0 iWo3Yghm+qSng== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3591D67F1D for ; Mon, 6 Oct 2025 10:55:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769747; bh=Gtc53/go6FYAzwvuuvGz+Kgtu9DEgxtHP7faAktv1sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DcUDsSDXIeP4S6/xXAAT4gaE9WsMNFXQoypRQNlaWCJ+lWmoZE4ohRM71jlD/Hd60 RxfmSlPrCovgFdQ0eljcQKYjxr2DSTRpIeomPj3O7tqpZMb4/G1+NkQxY2mofZbKVB IgK/rhviMTpYdJ9puDL2X1aW85vwPpvLZtdrAUpfMm7UcAB3RL+DmM/JPVa0Jn7CQi iUxjxeuswT9Qmbu7NiuwBAx1IT0IOozBWELYOOZ6Mu2epEbbSpA9SB3r4/DH25WOL3 HzI9aQoqmPGktZ+a1qkJVq1G53qH/cBENj7pZuGWs1DfogO0PCtVLEPNHJ3ZZm3si+ zDr863dlCwg0A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 40E0F67F1D; Mon, 6 Oct 2025 10:55:47 -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 YUFGMJSIAEE1; Mon, 6 Oct 2025 10:55:47 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769742; bh=vxlze09RxGRj3mSlVyvVPdXEMghQGcsD1ZB2LEin8ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qa2CPV7Pn+6gVaRru5RMz71i9ZL1mt5/grJaEAvJkSbiJSTP6bzEmw7QUxgUdSkA8 gdLnRXi74XMZNqI86jcQP4vdCluMQUBW0gP17iH3JLI21qedfi270MnlVPzQdQypC0 XXCSBV9J75NC7sl150ZC7FIiw3sOp5kYHj+awNTgTMptV+PDia70ZW2ryPKbXbG9yf +CB5NLQzzCHc/yJ4hGMwS98/htvUK0Jn/QuA5QvcZNtt9wENPv43w9oPDRdKTu6NVr /74t6PPdIVjAOHYfjtJadHVvOgyumi0JBrK75diNSsNuXEMAwTv5rJMyI77s/g8n6n ZE9vw5t09wB/g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id E87EF67ECE; Mon, 6 Oct 2025 10:55:41 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:44 -0600 Message-ID: <20251006165452.1675349-13-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: 7VEUISXCL7BMDRUWMX3PLF7UMKZUJX4Q X-Message-ID-Hash: 7VEUISXCL7BMDRUWMX3PLF7UMKZUJX4Q 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 12/14] expo: Add a way to calculate the bbox of dirty objects 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 When rendering an expo we should normally only need to draw the objects which are marked dirty. Add a way to calculate the bounding box of these. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/scene.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/boot/scene.c b/boot/scene.c index 242f21bbacf..332d11fc751 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -895,12 +895,53 @@ int scene_render_deps(struct scene *scn, uint id) return 0; } +/** + * scene_get_dirty_bbox() - Get bounding box of all dirty objects in a scene + * + * @scn: Scene to scan + * @bbox: Returns bounding box of all dirty objects + * Return: 0 if dirty objects found, -ENOENT if no dirty objects + */ +static int scene_get_dirty_bbox(struct scene *scn, struct vid_bbox *bbox) +{ + struct scene_obj *obj; + bool found_dirty = false; + + list_for_each_entry(obj, &scn->obj_head, sibling) { + if (obj->flags & SCENEOF_DIRTY) { + if (!found_dirty) { + /* First dirty object - initialize bbox */ + *bbox = obj->bbox; + found_dirty = true; + } else { + /* Expand bbox to include this object */ + if (obj->bbox.x0 < bbox->x0) + bbox->x0 = obj->bbox.x0; + if (obj->bbox.y0 < bbox->y0) + bbox->y0 = obj->bbox.y0; + if (obj->bbox.x1 > bbox->x1) + bbox->x1 = obj->bbox.x1; + if (obj->bbox.y1 > bbox->y1) + bbox->y1 = obj->bbox.y1; + } + } + } + + return found_dirty ? 0 : -ENOENT; +} + int scene_render(struct scene *scn) { struct expo *exp = scn->expo; struct scene_obj *obj; + struct vid_bbox dirty_bbox; int ret; + /* Get bounding box of dirty objects and add to expo damage */ + ret = scene_get_dirty_bbox(scn, &dirty_bbox); + if (!ret) + expo_damage_add(exp, &dirty_bbox); + list_for_each_entry(obj, &scn->obj_head, sibling) { if (!(obj->flags & SCENEOF_HIDE)) { ret = scene_obj_render(obj, exp->text_mode); From patchwork Mon Oct 6 16:54:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 516 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=1759769752; bh=jsYO9Y/KMeV//ETAe6RJRTO2+ro4wKFBL/vYBal7QxQ=; 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=qTGowo4dR9uSACfNFtyDliabGdHf+bjmdfoinPKRKPcBeEmByefn6EPEUFh513Og2 QwFU2ACtGw4FC6K+hACjrY68l0tRT1AslPq3jrpoEChOwti6T+kbxhn0dVsiFBaNQg 7OMyyBpLY8C4sGComJQKr0vAaPPcucTSc4xzgWtRZ+oC6WN3XNs0ZI/PD25WcN1DfE 5kxxxogdihlUJ7KAOB8X2kzA1CmZ0wXmHRhVD4wl8TauUfzBVba1zh0zS+Ulhb9rig uR0uZe4yKEHiggOgask2FgpfwfUog8d2JeZKBEVTQiW+O+zoVWpD2RQb27BpcGoNjp WOFWor3rSd2aA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1797167F8B for ; Mon, 6 Oct 2025 10:55:52 -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 AIc5GHmsCbLY for ; Mon, 6 Oct 2025 10:55:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769752; bh=jsYO9Y/KMeV//ETAe6RJRTO2+ro4wKFBL/vYBal7QxQ=; 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=qTGowo4dR9uSACfNFtyDliabGdHf+bjmdfoinPKRKPcBeEmByefn6EPEUFh513Og2 QwFU2ACtGw4FC6K+hACjrY68l0tRT1AslPq3jrpoEChOwti6T+kbxhn0dVsiFBaNQg 7OMyyBpLY8C4sGComJQKr0vAaPPcucTSc4xzgWtRZ+oC6WN3XNs0ZI/PD25WcN1DfE 5kxxxogdihlUJ7KAOB8X2kzA1CmZ0wXmHRhVD4wl8TauUfzBVba1zh0zS+Ulhb9rig uR0uZe4yKEHiggOgask2FgpfwfUog8d2JeZKBEVTQiW+O+zoVWpD2RQb27BpcGoNjp WOFWor3rSd2aA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 06D5267F03 for ; Mon, 6 Oct 2025 10:55:52 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769749; bh=4qgNW+YeM/VCum37YSYhz//IDOMYSP9OSipEOz80HWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vgU0iNj3I+TgGP/Ls9G1qubXFzW2k8PcY5ogIMqf3bjCg2gPDnGFfS1tr6IWHVHQM fyYoCY0Lw3h8eLpFgvhGHnDpiBktR6FQoKoW3h160ta6sLWSTRtP7uflsbQo0FGOJd UJZyv3RIICHuFZpf41E2XhgclZayLxksJMgPjwCTnStYT2nsqQ6Omnt82vSGelqhYP uRlLpUapBlse4hjWZRGukrQ+acidTJ74x8qDYGUWUuTBTB8Lj7zAnE1IJKFe/BgQiq INWvIA76C97txHU9Nbznh+2nUajw0MAsWnXsE5CSOJVrIUoIqQlKg5AcxTHLUQexEK nFw1b1+HrWOdw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 723AA67F8F; Mon, 6 Oct 2025 10:55:49 -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 EVd8Pc-kUn81; Mon, 6 Oct 2025 10:55:49 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769746; bh=DiDq8pNRdGEvQnKVOHtuqOVtMPLruqRdV6Zph3wUpI8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/dWTu1byy4+zUmDzgS3RXzl3890ec7u67BGE2CetTxjOefcdXU6QwMXAwlu3/++B XI/KkNzauczH9FmMzKYzCh/zRaUQIlWM7EeN1z8/Z/DiGgb3aHyWJS3gw3bJ1dud07 REuAwyLBeUjMC7zDuNH+kk6JSuLE3AXIFkk97lWfwxWE+7ez44Sr2nZ53r6Yn+4Spe CchfUe9G5fJUccWe0WML9xDqZuS/VaRC3ZG1ZhOTD50GqzhQu1RYnJlwutlbwGVI9d 9MTN8abdffkxze/9UklFohe0pvmotkYQAGKilZ5+hxkKNiJRJ/IoZCsYVz3sKHwfCn /bH5H1uHXS1Gg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9701367EE4; Mon, 6 Oct 2025 10:55:46 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:45 -0600 Message-ID: <20251006165452.1675349-14-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: HPFXKDZCS7LYEWBZ4YWB3EGJQ4Z4TNK7 X-Message-ID-Hash: HPFXKDZCS7LYEWBZ4YWB3EGJQ4Z4TNK7 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 , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 13/14] expo: Add selective rendering for dirty objects in scene 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 Support rendering only the dirty objects in a scene. Co-developed-by: Claude Signed-off-by: Simon Glass --- boot/expo.c | 2 +- boot/scene.c | 27 +++++++++++++++++++++++++-- boot/scene_internal.h | 3 ++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 5cbe06b1c28..8423a304eb0 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -320,7 +320,7 @@ int expo_render(struct expo *exp) if (!scn) return log_msg_ret("scn", -ENOENT); - ret = scene_render(scn); + ret = scene_render(scn, false); if (ret) return log_msg_ret("ren", ret); } diff --git a/boot/scene.c b/boot/scene.c index 332d11fc751..ec0c5899bca 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -930,7 +930,21 @@ static int scene_get_dirty_bbox(struct scene *scn, struct vid_bbox *bbox) return found_dirty ? 0 : -ENOENT; } -int scene_render(struct scene *scn) +/** + * bbox_intersects() - Check if two bounding boxes intersect + * + * @bbox1: First bounding box + * @bbox2: Second bounding box + * Return: true if bounding boxes intersect, false otherwise + */ +static bool bbox_intersects(const struct vid_bbox *bbox1, + const struct vid_bbox *bbox2) +{ + return !(bbox1->x1 <= bbox2->x0 || bbox2->x1 <= bbox1->x0 || + bbox1->y1 <= bbox2->y0 || bbox2->y1 <= bbox1->y0); +} + +int scene_render(struct scene *scn, bool dirty_only) { struct expo *exp = scn->expo; struct scene_obj *obj; @@ -943,7 +957,16 @@ int scene_render(struct scene *scn) expo_damage_add(exp, &dirty_bbox); list_for_each_entry(obj, &scn->obj_head, sibling) { - if (!(obj->flags & SCENEOF_HIDE)) { + bool render = true; + + if (obj->flags & SCENEOF_HIDE) + continue; + + /* render objects that intersect with dirty bbox */ + if (dirty_only && !ret) + render = bbox_intersects(&obj->bbox, &dirty_bbox); + + if (render) { ret = scene_obj_render(obj, exp->text_mode); if (ret && ret != -ENOTSUPP) return log_msg_ret("ren", ret); diff --git a/boot/scene_internal.h b/boot/scene_internal.h index 0bc6f45cdcb..00696979f7d 100644 --- a/boot/scene_internal.h +++ b/boot/scene_internal.h @@ -237,9 +237,10 @@ void scene_destroy(struct scene *scn); * This is called from expo_render() * * @scn: Scene to render + * @dirty_only: If true, only render objects that intersect with dirty areas * Returns: 0 if OK, -ve on error */ -int scene_render(struct scene *scn); +int scene_render(struct scene *scn, bool dirty_only); /** * scene_send_key() - set a keypress to a scene From patchwork Mon Oct 6 16:54:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 517 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=1759769756; bh=vulnzYL65Sh8881Yin2dtxaJ8hKPNnUK//V+p0NB0e0=; 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=Z9Ei3xI2Uc75pXCtJY7KkWdD+mPGicqDaFV2QONGYjyIQe4MhOSQ2ZbDLLJvF87Vo yZxgd7hCxN3HlYIsqywJoUwNXwBur9iJLJFtUO2nxOrH+OfxQQXmKu68TUTedlb/RD 5ArGJRtABm+NDcz7jQ82r9avWGffFzxfa4o9RaDsnFXpdq1UMSg2WJfEIdL3FkfNmZ k+INxCcLlwT1S4dKnJ3/LSrHnalU7kxRkf6CnCg4nthV2H5TRKxTihCUGtrLcqaazQ CGFFReEzpQtohZYoRjoAfrpt+rsF4B1Xzu1spzuccnJ+TA4Ar/U8QriVUyt4R8Ugi4 ruId68A7TgwQQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A287D67F10 for ; Mon, 6 Oct 2025 10:55:56 -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 av_nq-M3li2B for ; Mon, 6 Oct 2025 10:55:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769756; bh=vulnzYL65Sh8881Yin2dtxaJ8hKPNnUK//V+p0NB0e0=; 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=Z9Ei3xI2Uc75pXCtJY7KkWdD+mPGicqDaFV2QONGYjyIQe4MhOSQ2ZbDLLJvF87Vo yZxgd7hCxN3HlYIsqywJoUwNXwBur9iJLJFtUO2nxOrH+OfxQQXmKu68TUTedlb/RD 5ArGJRtABm+NDcz7jQ82r9avWGffFzxfa4o9RaDsnFXpdq1UMSg2WJfEIdL3FkfNmZ k+INxCcLlwT1S4dKnJ3/LSrHnalU7kxRkf6CnCg4nthV2H5TRKxTihCUGtrLcqaazQ CGFFReEzpQtohZYoRjoAfrpt+rsF4B1Xzu1spzuccnJ+TA4Ar/U8QriVUyt4R8Ugi4 ruId68A7TgwQQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 909E267EE5 for ; Mon, 6 Oct 2025 10:55:56 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769754; bh=DTdyGq2Y6Xsnuv3xpN5eBr4AQliSMfqTKD8XX0oOdaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gKvcf24nRrK75gDZOhNfVGiHxcCsQHE7LyvR0MRVK+382nG5UWlwYBWFGcI6rKpA2 rQSciP4MGox9qZAvx4Ua+WRvK4WP43GMGwfVsMG7bB9B9PpiGBI4DN0GUpCYMbN5DC 5R3mxeHiu/AOf02cz6ZW+1rWOTfc3ts5TeaFFQweUDOPtybrR9MzglpwGG1byDexaB V5wdnWCXleIA/PNFIDIBDvrN1OofeSWY05Atrn64dAJUDi2GTptPX+1fzA0vsYOPn6 8iEU4G0Loc8FLO5YrO+enQ5YBtJ1gC0uFtTvfQ0F7YCIJ4BGfm+gWDRkZDfU3S0ewm pyjmA/uMtwh3w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 90E3867EE5; Mon, 6 Oct 2025 10:55:54 -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 7iyaCdTT-JwH; Mon, 6 Oct 2025 10:55:54 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1759769748; bh=u/HHM/CyquY38FTF12wN3HapCqszGJr2BMlSceolB4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKYMMihLxmVlBt+XaNnd4IUi79iQz3raygKsNzafMWu4WidtYD3OXqoe4ezS0SEYT 2W/TZ/rwcIKFRUpCflkTZ/bjIkie2u7qMXO0a0VOzti6eUCyUF2OA1JcOY1BuBgzTd eENvL83CGSAXLbF9HpQsTy4ugQDTnbxyc6uQP1DAmDkuK4nCCrTjV/GOkoRCAOuEn9 fZLk73S8we/Y0wHGnxmUTzcNSh3kkc5Fljgan4cWsPsXbrf5YhqROXllK8iJGPFbaZ M/PULEAusu+9kX/2NUutGHUlm1akfqt9CwdC9a/qTvWCegz2/QuiKCRJAallnH77VJ f6txnqqzbWM9A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9C34567ECE; Mon, 6 Oct 2025 10:55:48 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 6 Oct 2025 10:54:46 -0600 Message-ID: <20251006165452.1675349-15-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: JTYKZPHFLXECAJ5MSMILNO5NDBLYCHRG X-Message-ID-Hash: JTYKZPHFLXECAJ5MSMILNO5NDBLYCHRG 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 14/14] expo: Support drawing only the dirty portion of an 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 To optimise drawing on the display, provide a new function which draws only the part of the display which is marked as dirty. Signed-off-by: Simon Glass --- boot/expo.c | 14 ++++++++++++-- include/expo.h | 12 ++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/boot/expo.c b/boot/expo.c index 8423a304eb0..8ec301d4dcf 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -300,7 +300,7 @@ static int render_mouse_pointer(struct expo *exp) return 0; } -int expo_render(struct expo *exp) +static int expo_render_(struct expo *exp, bool dirty_only) { struct udevice *dev = exp->display; struct video_priv *vid_priv = dev_get_uclass_priv(dev); @@ -320,7 +320,7 @@ int expo_render(struct expo *exp) if (!scn) return log_msg_ret("scn", -ENOENT); - ret = scene_render(scn, false); + ret = scene_render(scn, dirty_only); if (ret) return log_msg_ret("ren", ret); } @@ -335,6 +335,16 @@ int expo_render(struct expo *exp) return scn ? 0 : -ECHILD; } +int expo_render(struct expo *exp) +{ + return expo_render_(exp, false); +} + +int expo_render_dirty(struct expo *exp) +{ + return expo_render_(exp, true); +} + int expo_send_key(struct expo *exp, int key) { struct scene *scn = NULL; diff --git a/include/expo.h b/include/expo.h index fcc090d54f1..8ad7415b5a4 100644 --- a/include/expo.h +++ b/include/expo.h @@ -668,6 +668,18 @@ int expo_first_scene_id(struct expo *exp); */ int expo_render(struct expo *exp); +/** + * expo_render_dirty() - render the dirty portion of expo on the display + * + * Only the objects within the damage bbox are rendered. The others are + * assumed to be up-to-date. + * + * @exp: Expo to render + * Return: 0 if OK, -ECHILD if there is no current scene, -ENOENT if the + * current scene is not found, other error if something else goes wrong + */ +int expo_render_dirty(struct expo *exp); + /** * expo_arrange() - Arrange the current scene to deal with object sizes *