[PATCH 2/5] ivi-shell: remove struct link_layer
Nobuhiko Tanibata
nobuhiko_tanibata at xddp.denso.co.jp
Thu Oct 1 01:15:06 PDT 2015
Hi,
Tested-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
BR,
Nobuhiko Tanibata
2015-08-28 21:58 に Ucan, Emre (ADITG/SW1) さんは書きました:
> link_layer's sole purpose is to link a surface to multiple layers, if
> the surface should be shown in multiple layers.
> This can be only achieved, if the surface has multiple weston_views
> with different transformation matrices.
>
> Current implementation assumes in many places that a ivi_surface has
> only one weston_view.
> Therefore, a surface can be only shown on one layer.
>
> Although this (a surface on multiple layers) is a nice to have feature
> for ivi-shell, it is not very crucial.
> In any case, it is not an easy task to implement this feature, because
> it has lot of corner cases.
>
> I removed with this patch the link_layer data structure, because it
> does not have any purpose in current implementation.
>
> Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
> ---
> ivi-shell/ivi-layout-private.h | 3 +-
> ivi-shell/ivi-layout.c | 92
> +++-------------------------------------
> 2 files changed, 7 insertions(+), 88 deletions(-)
>
> diff --git a/ivi-shell/ivi-layout-private.h
> b/ivi-shell/ivi-layout-private.h
> index a9dbdde..3244390 100644
> --- a/ivi-shell/ivi-layout-private.h
> +++ b/ivi-shell/ivi-layout-private.h
> @@ -32,11 +32,11 @@
> struct ivi_layout_surface {
> struct wl_list link;
> struct wl_signal property_changed;
> - struct wl_list layer_list;
> int32_t update_count;
> uint32_t id_surface;
>
> struct ivi_layout *layout;
> + struct ivi_layout_layer *on_layer;
> struct weston_surface *surface;
>
> struct weston_transform transform;
> @@ -65,7 +65,6 @@ struct ivi_layout_surface {
> struct ivi_layout_layer {
> struct wl_list link;
> struct wl_signal property_changed;
> - struct wl_list link_to_surface;
> uint32_t id_layer;
>
> struct ivi_layout *layout;
> diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
> index 087f94c..2a33b3e 100644
> --- a/ivi-shell/ivi-layout.c
> +++ b/ivi-shell/ivi-layout.c
> @@ -69,12 +69,6 @@
>
> #define max(a, b) ((a) > (b) ? (a) : (b))
>
> -struct link_layer {
> - struct ivi_layout_layer *ivilayer;
> - struct wl_list link;
> - struct wl_list link_to_layer;
> -};
> -
> struct listener_layout_notification {
> void *userdata;
> struct wl_listener listener;
> @@ -126,72 +120,6 @@ get_instance(void)
> }
>
> /**
> - * Internal API to add/remove a link to ivi_surface from ivi_layer.
> - */
> -static void
> -add_link_to_surface(struct ivi_layout_layer *ivilayer,
> - struct link_layer *link_layer)
> -{
> - struct link_layer *link = NULL;
> -
> - wl_list_for_each(link, &ivilayer->link_to_surface, link_to_layer) {
> - if (link == link_layer)
> - return;
> - }
> -
> - wl_list_insert(&ivilayer->link_to_surface,
> &link_layer->link_to_layer);
> -}
> -
> -static void
> -remove_link_to_surface(struct ivi_layout_layer *ivilayer)
> -{
> - struct link_layer *link = NULL;
> - struct link_layer *next = NULL;
> -
> - wl_list_for_each_safe(link, next, &ivilayer->link_to_surface,
> link_to_layer) {
> - wl_list_remove(&link->link_to_layer);
> - wl_list_remove(&link->link);
> - free(link);
> - }
> -
> - wl_list_init(&ivilayer->link_to_surface);
> -}
> -
> -/**
> - * Internal API to add/remove a ivi_surface from ivi_layer.
> - */
> -static void
> -add_ordersurface_to_layer(struct ivi_layout_surface *ivisurf,
> - struct ivi_layout_layer *ivilayer)
> -{
> - struct link_layer *link_layer = NULL;
> -
> - link_layer = malloc(sizeof *link_layer);
> - if (link_layer == NULL) {
> - weston_log("fails to allocate memory\n");
> - return;
> - }
> -
> - link_layer->ivilayer = ivilayer;
> - wl_list_insert(&ivisurf->layer_list, &link_layer->link);
> - add_link_to_surface(ivilayer, link_layer);
> -}
> -
> -static void
> -remove_ordersurface_from_layer(struct ivi_layout_surface *ivisurf)
> -{
> - struct link_layer *link_layer = NULL;
> - struct link_layer *next = NULL;
> -
> - wl_list_for_each_safe(link_layer, next, &ivisurf->layer_list, link) {
> - wl_list_remove(&link_layer->link);
> - wl_list_remove(&link_layer->link_to_layer);
> - free(link_layer);
> - }
> - wl_list_init(&ivisurf->layer_list);
> -}
> -
> -/**
> * Internal API to add/remove a ivi_layer to/from ivi_screen.
> */
> static struct ivi_layout_surface *
> @@ -294,7 +222,6 @@ ivi_layout_surface_destroy(struct
> ivi_layout_surface *ivisurf)
> wl_list_remove(&ivisurf->pending.link);
> wl_list_remove(&ivisurf->order.link);
> wl_list_remove(&ivisurf->link);
> - remove_ordersurface_from_layer(ivisurf);
>
> wl_signal_emit(&layout->surface_notification.removed, ivisurf);
>
> @@ -878,7 +805,7 @@ commit_layer_list(struct ivi_layout *layout)
>
> wl_list_for_each_safe(ivisurf, next, &ivilayer->order.surface_list,
> order.link) {
> - remove_ordersurface_from_layer(ivisurf);
> + ivisurf->on_layer = NULL;
> wl_list_remove(&ivisurf->order.link);
> wl_list_init(&ivisurf->order.link);
> ivisurf->event_mask |= IVI_NOTIFICATION_REMOVE;
> @@ -891,7 +818,7 @@ commit_layer_list(struct ivi_layout *layout)
> wl_list_remove(&ivisurf->order.link);
> wl_list_insert(&ivilayer->order.surface_list,
> &ivisurf->order.link);
> - add_ordersurface_to_layer(ivisurf, ivilayer);
> + ivisurf->on_layer = ivilayer;
> ivisurf->event_mask |= IVI_NOTIFICATION_ADD;
> }
>
> @@ -1641,7 +1568,6 @@ ivi_layout_get_layers_under_surface(struct
> ivi_layout_surface *ivisurf,
> int32_t *pLength,
> struct ivi_layout_layer ***ppArray)
> {
> - struct link_layer *link_layer = NULL;
> int32_t length = 0;
> int32_t n = 0;
>
> @@ -1650,19 +1576,16 @@ ivi_layout_get_layers_under_surface(struct
> ivi_layout_surface *ivisurf,
> return IVI_FAILED;
> }
>
> - length = wl_list_length(&ivisurf->layer_list);
> -
> - if (length != 0) {
> + if (ivisurf->on_layer != NULL) {
> /* the Array must be free by module which called this function */
> - *ppArray = calloc(length, sizeof(struct ivi_layout_layer *));
> + length = 1;
> + *ppArray = calloc(length, sizeof(struct ivi_layout_screen *));
> if (*ppArray == NULL) {
> weston_log("fails to allocate memory\n");
> return IVI_FAILED;
> }
>
> - wl_list_for_each(link_layer, &ivisurf->layer_list, link) {
> - (*ppArray)[n++] = link_layer->ivilayer;
> - }
> + (*ppArray)[n++] = ivisurf->on_layer;
> }
>
> *pLength = length;
> @@ -1760,7 +1683,6 @@ ivi_layout_layer_create_with_dimension(uint32_t
> id_layer,
>
> ivilayer->ref_count = 1;
> wl_signal_init(&ivilayer->property_changed);
> - wl_list_init(&ivilayer->link_to_surface);
> ivilayer->layout = layout;
> ivilayer->id_layer = id_layer;
>
> @@ -1827,7 +1749,6 @@ ivi_layout_layer_destroy(struct ivi_layout_layer
> *ivilayer)
> wl_list_remove(&ivilayer->order.link);
> wl_list_remove(&ivilayer->link);
>
> - remove_link_to_surface(ivilayer);
> ivi_layout_layer_remove_notification(ivilayer);
>
> free(ivilayer);
> @@ -2740,7 +2661,6 @@ ivi_layout_surface_create(struct weston_surface
> *wl_surface,
>
> wl_signal_init(&ivisurf->property_changed);
> wl_signal_init(&ivisurf->configured);
> - wl_list_init(&ivisurf->layer_list);
> ivisurf->id_surface = id_surface;
> ivisurf->layout = layout;
More information about the wayland-devel
mailing list