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);