From: Toshi Umemura Date: Mon, 19 Dec 2016 08:54:11 +0000 (+0900) Subject: ivi-shell multi screen support X-Git-Tag: 3.0.0~30 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=AGL%2Fmeta-agl-demo.git;a=commitdiff_plain;h=f67ced704936562eba6e43455739611bbdd7b599 ivi-shell multi screen support This patch enables ivi-shell to manage multi screen. This solves SPEC-360 ivi-shell fails to manage two screens. CES2017 cluster demo also requires multi screen support. Bug-AGL: SPEC-360 Change-Id: Ie0f71855af70de28068cb9deee1a6c415eaea88e Signed-off-by: ynakamura Signed-off-by: Jan-Simon Moeller --- diff --git a/recipes-graphics/wayland/weston/0001-ivi-shell-fix-TODO-which-expects-only-one-screen-in-.patch b/recipes-graphics/wayland/weston/0001-ivi-shell-fix-TODO-which-expects-only-one-screen-in-.patch new file mode 100644 index 000000000..273585d64 --- /dev/null +++ b/recipes-graphics/wayland/weston/0001-ivi-shell-fix-TODO-which-expects-only-one-screen-in-.patch @@ -0,0 +1,32 @@ +From ed7dbe7747f71ce718ba7cf43fe160c318405db7 Mon Sep 17 00:00:00 2001 +From: Nobuhiko Tanibata +Date: Mon, 9 Nov 2015 13:06:18 +0900 +Subject: [PATCH] ivi-shell: fix TODO which expects only one screen in the + system. + +It just return the first screen found in screen list. + +Signed-off-by: Nobuhiko Tanibata +--- + ivi-shell/ivi-layout.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index a04076e..efc0da5 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -1484,9 +1484,8 @@ ivi_layout_get_screen_from_id(uint32_t id_screen) + struct ivi_layout_screen *iviscrn = NULL; + + wl_list_for_each(iviscrn, &layout->screen_list, link) { +-/* FIXME : select iviscrn from screen_list by id_screen */ +- return iviscrn; +- break; ++ if (iviscrn->id_screen == id_screen) ++ return iviscrn; + } + + return NULL; +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston/0002-ivi-shell-avoid-inserting-a-ivi_layer-to-multiple-sc.patch b/recipes-graphics/wayland/weston/0002-ivi-shell-avoid-inserting-a-ivi_layer-to-multiple-sc.patch new file mode 100644 index 000000000..f0a25efcd --- /dev/null +++ b/recipes-graphics/wayland/weston/0002-ivi-shell-avoid-inserting-a-ivi_layer-to-multiple-sc.patch @@ -0,0 +1,39 @@ +From 46969606558dc378042de125fa85efa6a658aa18 Mon Sep 17 00:00:00 2001 +From: Koji Ohira +Date: Thu, 24 Nov 2016 21:04:43 +0900 +Subject: [PATCH] ivi-shell: avoid inserting a ivi_layer to multiple screens. + +In just previous wl_list_for_each_safe, list of layer in a screen is +cleaned up. And then, the list is re-constructed from +pending.layer_list. + +In this re-construction, if order.link of a layer were inserted into a +screen whose number is later one of current screen, the order.link will +inserted into layer_list of two screens. This shall be avoided. + +However, if we want to implement a feature to allow a layer to be added +to multiple screens. A layer shall have several order.link per screens. +So, I marked here as TODO. + +Signed-off-by: Koji Ohira +--- + ivi-shell/ivi-layout.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index efc0da5..1139590 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -974,6 +974,9 @@ commit_screen_list(struct ivi_layout *layout) + + wl_list_for_each(ivilayer, &iviscrn->pending.layer_list, + pending.link) { ++ /* FIXME: avoid to insert order.link to multiple screens */ ++ wl_list_remove(&ivilayer->order.link); ++ + wl_list_insert(&iviscrn->order.layer_list, + &ivilayer->order.link); + add_orderlayer_to_screen(ivilayer, iviscrn); +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston/0003-ivi-shell-fix-layout_layer.view_list-is-not-initiliz.patch b/recipes-graphics/wayland/weston/0003-ivi-shell-fix-layout_layer.view_list-is-not-initiliz.patch new file mode 100644 index 000000000..e828493de --- /dev/null +++ b/recipes-graphics/wayland/weston/0003-ivi-shell-fix-layout_layer.view_list-is-not-initiliz.patch @@ -0,0 +1,43 @@ +From 83b1873a62c991f15a698e4de50182e4cf452be0 Mon Sep 17 00:00:00 2001 +From: Koji Ohira +Date: Thu, 24 Nov 2016 21:06:56 +0900 +Subject: [PATCH] ivi-shell: fix layout_layer.view_list is not initilized per a + screen. + +This is potential bug when it supports several screens. If view_list is +initilized here, the views, which are set by the previous screen, are +cleared. So View list shall be initilized in front of wl_list_for_each +of all screens. + +Signed-off-by: Koji Ohira +--- + ivi-shell/ivi-layout.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index 1139590..b14726e 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -960,6 +960,9 @@ commit_screen_list(struct ivi_layout *layout) + struct ivi_layout_layer *next = NULL; + struct ivi_layout_surface *ivisurf = NULL; + ++ /* Clear view list of layout ivi_layer */ ++ wl_list_init(&layout->layout_layer.view_list.link); ++ + wl_list_for_each(iviscrn, &layout->screen_list, link) { + if (iviscrn->order.dirty) { + wl_list_for_each_safe(ivilayer, next, +@@ -986,9 +989,6 @@ commit_screen_list(struct ivi_layout *layout) + iviscrn->order.dirty = 0; + } + +- /* Clear view list of layout ivi_layer */ +- wl_list_init(&layout->layout_layer.view_list.link); +- + wl_list_for_each(ivilayer, &iviscrn->order.layer_list, order.link) { + if (ivilayer->prop.visibility == false) + continue; +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston/0004-ivi-shell-remove-a-code-which-expects-only-a-screen-.patch b/recipes-graphics/wayland/weston/0004-ivi-shell-remove-a-code-which-expects-only-a-screen-.patch new file mode 100644 index 000000000..487d8b96f --- /dev/null +++ b/recipes-graphics/wayland/weston/0004-ivi-shell-remove-a-code-which-expects-only-a-screen-.patch @@ -0,0 +1,29 @@ +From 34200aa2bea0a400aa063d2233c8e4c6e44fa8a6 Mon Sep 17 00:00:00 2001 +From: Nobuhiko Tanibata +Date: Mon, 9 Nov 2015 13:38:23 +0900 +Subject: [PATCH] ivi-shell: remove a code which expects only a screen in the + system. + +It breaks from wl_list_for_each of screens when the frist screen found. + +Signed-off-by: Nobuhiko Tanibata +--- + ivi-shell/ivi-layout.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index b14726e..31b5def 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -1012,8 +1012,6 @@ commit_screen_list(struct ivi_layout *layout) + ivisurf->surface->output = iviscrn->output; + } + } +- +- break; + } + } + +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston/0005-ivi-shell-multi-screen-support.-ivi_layout_screen-to.patch b/recipes-graphics/wayland/weston/0005-ivi-shell-multi-screen-support.-ivi_layout_screen-to.patch new file mode 100644 index 000000000..de795432f --- /dev/null +++ b/recipes-graphics/wayland/weston/0005-ivi-shell-multi-screen-support.-ivi_layout_screen-to.patch @@ -0,0 +1,74 @@ +From e8bfcbd7e64a296d2aba63a80d8e181055587f76 Mon Sep 17 00:00:00 2001 +From: Nobuhiko Tanibata +Date: Mon, 30 Nov 2015 11:05:37 +0900 +Subject: [PATCH] ivi-shell: multi screen support. ivi_layout_screen to be + taken account into property change in commitChanges. + +Property change is now done in update_prop so to consider ivi_screen +property for caluculating transform of weston surface, ivi_layout_screen + is added as a parameter of update_prop. + +However, update_prop of weston_view of a ivi_surface can not be done +even if it is set on a screen. The propoerty change shall be done only +when a visibility of ivi_surface or ivi_layer which contains the +ivi_surface is ON. Such a condition shall be checked at commit_changes +as well to avoid calling update_prop, which actually updates +weston_views. + +Signed-off-by: Nobuhiko Tanibata +--- + ivi-shell/ivi-layout.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index 31b5def..1773af8 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -737,16 +737,17 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface( + } + + static void +-update_prop(struct ivi_layout_layer *ivilayer, ++update_prop(struct ivi_layout_screen *iviscrn, ++ struct ivi_layout_layer *ivilayer, + struct ivi_layout_surface *ivisurf) + { + struct weston_view *tmpview; + struct ivi_rectangle r; + bool can_calc = true; + +- if (!ivilayer->event_mask && !ivisurf->event_mask) { ++ /*In case of no prop change, this just returns*/ ++ if (!ivilayer->event_mask && !ivisurf->event_mask) + return; +- } + + update_opacity(ivilayer, ivisurf); + +@@ -802,8 +803,22 @@ commit_changes(struct ivi_layout *layout) + + wl_list_for_each(iviscrn, &layout->screen_list, link) { + wl_list_for_each(ivilayer, &iviscrn->order.layer_list, order.link) { ++ /* ++ * If ivilayer is invisible, weston_view of ivisurf doesn't ++ * need to be modified. ++ */ ++ if (ivilayer->prop.visibility == false) ++ continue; ++ + wl_list_for_each(ivisurf, &ivilayer->order.surface_list, order.link) { +- update_prop(ivilayer, ivisurf); ++ /* ++ * If ivilayer is invisible, weston_view of ivisurf doesn't ++ * need to be modified. ++ */ ++ if (ivisurf->prop.visibility == false) ++ continue; ++ ++ update_prop(iviscrn, ivilayer, ivisurf); + } + } + } +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston/0006-ivi-shell-transforming-from-a-single-screen-coordina.patch b/recipes-graphics/wayland/weston/0006-ivi-shell-transforming-from-a-single-screen-coordina.patch new file mode 100644 index 000000000..0ae758ac4 --- /dev/null +++ b/recipes-graphics/wayland/weston/0006-ivi-shell-transforming-from-a-single-screen-coordina.patch @@ -0,0 +1,61 @@ +From 2a3b8a213d5076aa6f051e88858b65ebfc53f64a Mon Sep 17 00:00:00 2001 +From: Nobuhiko Tanibata +Date: Mon, 30 Nov 2015 15:08:32 +0900 +Subject: [PATCH] ivi-shell: transforming from a single screen coordinates to + multi screen coordinates: global coordinates. + +In single screen, the coordinates of layer local coordinates are the +same as global coordinates. However, to support multi screens, the +layer-local coordinates shall be transformed to multi screen coordinates, +which is global coordinates. The abosolute coordinates of a screen in global +stored in (x,y) of output of its weston output so it shall be used to +transform layer-local to global coordinates. + +Signed-off-by: Nobuhiko Tanibata +--- + ivi-shell/ivi-layout.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index 1773af8..65c2735 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -679,6 +679,7 @@ calc_inverse_matrix_transform(const struct weston_matrix *matrix, + */ + static void + calc_surface_to_global_matrix_and_mask_to_weston_surface( ++ struct ivi_layout_screen *iviscrn, + struct ivi_layout_layer *ivilayer, + struct ivi_layout_surface *ivisurf, + struct weston_matrix *m, +@@ -686,6 +687,7 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface( + { + const struct ivi_layout_surface_properties *sp = &ivisurf->prop; + const struct ivi_layout_layer_properties *lp = &ivilayer->prop; ++ struct weston_output *output = iviscrn->output; + struct ivi_rectangle weston_surface_rect = { 0, + 0, + ivisurf->surface->width, +@@ -713,7 +715,9 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface( + * coordinates to global coordinates, which is computed by + * two steps, + * - surface-local coordinates to layer-local coordinates +- * - layer-local coordinates to global coordinates ++ * - layer-local coordinates to a single screen-local coordinates ++ * - a single screen-local coordinates to multi screen coordinates, ++ * which is global coordinates. + */ + calc_transformation_matrix(&surface_source_rect, + &surface_dest_rect, +@@ -723,6 +727,8 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface( + &layer_dest_rect, + lp->orientation, m); + ++ weston_matrix_translate(m, output->x, output->y, 0.0f); ++ + /* this intersected ivi_rectangle would be used for masking + * weston_surface + */ +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston/0007-RFR-ivi-shell-multi-screen-support-to-calcuration-of.patch b/recipes-graphics/wayland/weston/0007-RFR-ivi-shell-multi-screen-support-to-calcuration-of.patch new file mode 100644 index 000000000..7747115ac --- /dev/null +++ b/recipes-graphics/wayland/weston/0007-RFR-ivi-shell-multi-screen-support-to-calcuration-of.patch @@ -0,0 +1,103 @@ +From b995f26e62de2ba8965700062ccf98a8f65fffd0 Mon Sep 17 00:00:00 2001 +From: Koji Ohira +Date: Thu, 24 Nov 2016 21:14:38 +0900 +Subject: [PATCH] [RFR] ivi-shell: multi screen support to calcuration of a + mask of weston_surface. + +A weston_surface is transformed to multi screen coordinate, global +coordinate by matrix:m now. + +Additionally, a mask needs to be calucated, taking account into, +- multi screen coordination: a destination rectangle of layer in the + coordination is easily calcurated by adding weston_output.{x,y} in + simple. This is because there is no scaled and rotated transformation. +- intersect inside of a screen the layer is assigned to. This is because + overlapped region of weston surface in another screen shall not be + displayed according to ivi use case. + +Signed-off-by: Koji Ohira +--- + ivi-shell/ivi-layout.c | 38 ++++++++++++++++++++++++++++++++------ + 1 file changed, 32 insertions(+), 6 deletions(-) + +diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c +index 65c2735..008fbe5 100644 +--- a/ivi-shell/ivi-layout.c ++++ b/ivi-shell/ivi-layout.c +@@ -665,15 +665,24 @@ calc_inverse_matrix_transform(const struct weston_matrix *matrix, + + /** + * This computes the whole transformation matrix:m from surface-local +- * coordinates to global coordinates. It is assumed that +- * weston_view::geometry.{x,y} are zero. ++ * coordinates to multi screens coordinate, which is global coordinates. ++ * It is assumed that weston_view::geometry.{x,y} are zero. + * + * Additionally, this computes the mask on surface-local coordinates as a + * ivi_rectangle. This can be set to weston_view_set_mask. + * + * The mask is computed by following steps +- * - destination rectangle of layer is inversed to surface-local cooodinates +- * by inversed matrix:m. ++ * - destination rectangle of layer is tansformed to multi screen coordinate, ++ * global coordinates. This is done by adding weston_output.{x,y} in simple ++ * because there is no scaled and rotated transformation. ++ * - destination rectangle of layer in multi screens coordinate needs to be ++ * intersected inside of a screen the layer is assigned to. This is because ++ * overlapped region of weston surface in another screen shall not be ++ * displayed according to ivi use case. ++ * - destination rectangle of layer ++ * - in multi screen coordinates, ++ * - and intersected inside of an assigned screen, ++ * is inversed to surface-local cooodinates by inversed matrix:m. + * - the area is intersected by intersected area between weston_surface and + * source rectangle of ivi_surface. + */ +@@ -708,7 +717,17 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface( + lp->dest_y, + lp->dest_width, + lp->dest_height }; ++ struct ivi_rectangle screen_dest_rect = { output->x, ++ output->y, ++ output->width, ++ output->height }; ++ struct ivi_rectangle layer_dest_rect_in_global = ++ { lp->dest_x + output->x, ++ lp->dest_y + output->y, ++ lp->dest_width, ++ lp->dest_height }; + struct ivi_rectangle surface_result; ++ struct ivi_rectangle layer_dest_rect_in_global_intersected; + + /* + * the whole transformation matrix:m from surface-local +@@ -735,9 +754,16 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface( + ivi_rectangle_intersect(&surface_source_rect, &weston_surface_rect, + &surface_result); + ++ /* ++ * destination rectangle of layer in multi screens coordinate ++ * is intersected to avoid displaying outside of an assigned screen. ++ */ ++ ivi_rectangle_intersect(&layer_dest_rect_in_global, &screen_dest_rect, ++ &layer_dest_rect_in_global_intersected); ++ + /* calc masking area of weston_surface from m */ + calc_inverse_matrix_transform(m, +- &layer_dest_rect, ++ &layer_dest_rect_in_global_intersected, + &surface_result, + result); + } +@@ -778,7 +804,7 @@ update_prop(struct ivi_layout_screen *iviscrn, + weston_matrix_init(&ivisurf->transform.matrix); + + calc_surface_to_global_matrix_and_mask_to_weston_surface( +- ivilayer, ivisurf, &ivisurf->transform.matrix, &r); ++ iviscrn, ivilayer, ivisurf, &ivisurf->transform.matrix, &r); + + if (tmpview != NULL) { + weston_view_set_mask(tmpview, r.x, r.y, r.width, r.height); +-- +2.7.4 + diff --git a/recipes-graphics/wayland/weston_%.bbappend b/recipes-graphics/wayland/weston_%.bbappend index ee9422ff7..b6990cc56 100644 --- a/recipes-graphics/wayland/weston_%.bbappend +++ b/recipes-graphics/wayland/weston_%.bbappend @@ -2,4 +2,11 @@ FILESEXTRAPATHS_append := ":${THISDIR}/${PN}" SRC_URI_append = "\ file://0001-weston-patch-for-wl-shell-emulator.patch \ + file://0001-ivi-shell-fix-TODO-which-expects-only-one-screen-in-.patch \ + file://0002-ivi-shell-avoid-inserting-a-ivi_layer-to-multiple-sc.patch \ + file://0003-ivi-shell-fix-layout_layer.view_list-is-not-initiliz.patch \ + file://0004-ivi-shell-remove-a-code-which-expects-only-a-screen-.patch \ + file://0005-ivi-shell-multi-screen-support.-ivi_layout_screen-to.patch \ + file://0006-ivi-shell-transforming-from-a-single-screen-coordina.patch \ + file://0007-RFR-ivi-shell-multi-screen-support-to-calcuration-of.patch \ "