Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00B72C7EE23 for ; Thu, 1 Jun 2023 16:27:11 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6000986389; Thu, 1 Jun 2023 18:25:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NakV0eFd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 77EFA86345; Thu, 1 Jun 2023 18:24:42 +0200 (CEST) Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 119AB8634E for ; Thu, 1 Jun 2023 18:24:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-777094e3d7bso2266839f.1 for ; Thu, 01 Jun 2023 09:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685636675; x=1688228675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aJbcp783FHp3bjCFsi4mpGbNBo3e2JVxVJvzkauLzBY=; b=NakV0eFdqxe9YbBmFBAP1QyWU0liG/STX15YsGoqLa7IZtE/xIdciqRLS01fYkRryp VLoRAzR9AoZx9TQGSNel3neu0lpVE0lf//rMX5laTgekRkWTz6+Z44pJ27+lTUGcQMSd qT7uMJwDnhTvf+tsM6cKLTVjvoBOteE4LPZ+M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685636675; x=1688228675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aJbcp783FHp3bjCFsi4mpGbNBo3e2JVxVJvzkauLzBY=; b=W0SkjFDPCXJhVLYWujvJUueWeqI9ZG0m+oiMMFwAZG+h21E3Q4Y75I719pVAr+WaOe udFrrqlfvU6w3OxWG68o2zQgk2TnaJ6KxN0RiaDLfXu1OfG7lPrDNP2PnUOjQ8guwZix gGXWL/S0Aya+H0lxk2XRtglIEnCHza6oTzhC7gqw+dQh7kCcFMx4wGFQTNYfeX4FmarB bcjwNLACpxxh3BKfykloQqAZRP2dRGOODf3ndo9+OU7AabWdEQhb5auFXuQESgwhrih8 4Ukv4rfbnEFUbRqT39NcW2nvM0UQBMDjDN5dD+xGPZgUwf9CskOWRK+hKO0dla7Xs7QL r6kQ== X-Gm-Message-State: AC+VfDyiQGMLdcZAsKFLCU39eK0oXJAtWEAcbbcaAMweVejj1Q7o9DbW QoKqxS1wKNoFOVUj+Lzd432NWraF/iAKhx/lk88= X-Google-Smtp-Source: ACHHUZ62YbWXWp/3IIVODRmE2eo9pC8wqaDzRLyWnt8ZSZ3Ykm0XNayv3nfMBXI7/IHKw65oi7j5Ng== X-Received: by 2002:a92:dc48:0:b0:33b:4518:855b with SMTP id x8-20020a92dc48000000b0033b4518855bmr4571205ilq.31.1685636675088; Thu, 01 Jun 2023 09:24:35 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id l1-20020a922901000000b0033a6e7ee4e3sm3862098ilg.1.2023.06.01.09.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jun 2023 09:24:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH 11/40] expo: Avoid automatically arranging the scene Date: Thu, 1 Jun 2023 10:22:35 -0600 Message-ID: <20230601162404.220488-10-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.rc0.172.g3f132b7071-goog In-Reply-To: <20230601162404.220488-1-sjg@chromium.org> References: <20230601162404.220488-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This should ideally be done once after all scene changes have been made. Require an explicit call when everything is ready. Always arrange after a key it sent, just for convenience. Signed-off-by: Simon Glass --- boot/bootflow_menu.c | 4 ++++ boot/expo.c | 15 ++++++++++++++- boot/scene.c | 7 ------- boot/scene_menu.c | 9 --------- test/boot/expo.c | 4 +++- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c index 7f06dac0af77..de0f44535690 100644 --- a/boot/bootflow_menu.c +++ b/boot/bootflow_menu.c @@ -124,6 +124,10 @@ int bootflow_menu_new(struct expo **expp) priv->num_bootflows++; } + ret = scene_arrange(scn); + if (ret) + return log_msg_ret("arr", ret); + *expp = exp; return 0; diff --git a/boot/expo.c b/boot/expo.c index cd1b1a3de50c..bfdda9570c60 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -116,8 +116,16 @@ struct scene *expo_lookup_scene_id(struct expo *exp, uint scene_id) int expo_set_scene_id(struct expo *exp, uint scene_id) { - if (!expo_lookup_scene_id(exp, scene_id)) + struct scene *scn; + int ret; + + scn = expo_lookup_scene_id(exp, scene_id); + if (!scn) return log_msg_ret("id", -ENOENT); + ret = scene_arrange(scn); + if (ret) + return log_msg_ret("arr", ret); + exp->scene_id = scene_id; return 0; @@ -165,6 +173,11 @@ int expo_send_key(struct expo *exp, int key) ret = scene_send_key(scn, key, &exp->action); if (ret) return log_msg_ret("key", ret); + + /* arrange it to get any changes */ + ret = scene_arrange(scn); + if (ret) + return log_msg_ret("arr", ret); } return scn ? 0 : -ECHILD; diff --git a/boot/scene.c b/boot/scene.c index 7e9ba047f2d4..1383be20321f 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -211,8 +211,6 @@ int scene_obj_set_pos(struct scene *scn, uint id, int x, int y) return log_msg_ret("find", -ENOENT); obj->x = x; obj->y = y; - if (obj->type == SCENEOBJT_MENU) - scene_menu_arrange(scn, (struct scene_obj_menu *)obj); return 0; } @@ -391,11 +389,6 @@ int scene_send_key(struct scene *scn, int key, struct expo_action *event) ret = scene_menu_send_key(scn, menu, key, event); if (ret) return log_msg_ret("key", ret); - - /* only allow one menu */ - ret = scene_menu_arrange(scn, menu); - if (ret) - return log_msg_ret("arr", ret); break; } } diff --git a/boot/scene_menu.c b/boot/scene_menu.c index 18998e862ab3..9ee911f2fa38 100644 --- a/boot/scene_menu.c +++ b/boot/scene_menu.c @@ -158,10 +158,6 @@ int scene_menu(struct scene *scn, const char *name, uint id, *menup = menu; INIT_LIST_HEAD(&menu->item_head); - ret = scene_menu_arrange(scn, menu); - if (ret) - return log_msg_ret("pos", ret); - return menu->obj.id; } @@ -258,7 +254,6 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id, { struct scene_obj_menu *menu; struct scene_menitem *item; - int ret; menu = scene_obj_find(scn, menu_id, SCENEOBJT_MENU); if (!menu) @@ -285,10 +280,6 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id, item->flags = flags; list_add_tail(&item->sibling, &menu->item_head); - ret = scene_menu_arrange(scn, menu); - if (ret) - return log_msg_ret("pos", ret); - if (itemp) *itemp = item; diff --git a/test/boot/expo.c b/test/boot/expo.c index 3c0bc78bb7a4..56a22ba9b066 100644 --- a/test/boot/expo.c +++ b/test/boot/expo.c @@ -348,7 +348,9 @@ static int expo_object_menu(struct unit_test_state *uts) ut_asserteq(desc_id, item->desc_id); ut_asserteq(preview_id, item->preview_id); - /* adding an item should cause the first item to become current */ + ut_assertok(scene_arrange(scn)); + + /* arranging the scene should cause the first item to become current */ ut_asserteq(id, menu->cur_item_id); /* the title should be at the top */ -- 2.41.0.rc0.172.g3f132b7071-goog