[PATCH weston] hmi-controller: remove duplicate commit_changes in random mode

Nobuhiko Tanibata nobuhiko_tanibata at xddp.denso.co.jp
Thu Dec 24 20:47:15 PST 2015


From: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>

Previous code cleaned up surfaces in layer once and then added surfaces
to a layer in random. In this flow, two commitchanges are required.

This patch proposes that it avoids calling add_surface if a surface is
already added to a layer in random. In this flow, cleaning up
surfaces is not required.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
---
 ivi-shell/hmi-controller.c | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 77426bc..8a81f5c 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -418,24 +418,18 @@ mode_random_replace(struct hmi_controller *hmi_ctrl,
 	struct ivi_layout_surface *ivisurf  = NULL;
 	const uint32_t duration = hmi_ctrl->hmi_setting->transition_duration;
 	int32_t i = 0;
+	int32_t j = 0;
 	int32_t layer_idx = 0;
+	int32_t surface_len_on_layer = 0;
+	struct ivi_layout_surface **ivisurfs = NULL;
 
 	layers = MEM_ALLOC(sizeof(*layers) * hmi_ctrl->screen_num);
 
 	wl_list_for_each(application_layer, layer_list, link) {
 		layers[layer_idx] = application_layer;
-		ivi_layout_interface->layer_set_render_order(layers[layer_idx]->ivilayer,
-							NULL, 0);
 		layer_idx++;
 	}
 
-	/*
-	 * This commit change is needed because ivisurface can not belongs to several layers
-	 * at the same time. So ivisurfaces shall be removed from layers once and then set them
-	 * to layers randomly.
-	 */
-	ivi_layout_interface->commit_changes();
-
 	for (i = 0; i < surface_length; i++) {
 		ivisurf = pp_surface[i];
 
@@ -463,6 +457,19 @@ mode_random_replace(struct hmi_controller *hmi_ctrl,
 							     surface_width,
 							     surface_height);
 
+		ivi_layout_interface
+			->get_surfaces_on_layer(layers[layer_idx]->ivilayer,
+						&surface_len_on_layer,
+						&ivisurfs);
+
+		for (j = 0; j < surface_len_on_layer; j++) {
+			if (ivisurf == ivisurfs[j])
+				break;
+		}
+
+		if (j < surface_len_on_layer)
+			continue;
+
 		ivi_layout_interface->layer_add_surface(layers[layer_idx]->ivilayer, ivisurf);
 	}
 
-- 
1.8.3.1



More information about the wayland-devel mailing list