From: Nobuhiko Tanibata <nobuhiko_tanib...@xddp.denso.co.jp>

A layer ID for screen is set by key: base-layer-id at weston.ini. To
support multi screens. It also support offset to offset the layer ID
to next ID for next screen.

For example,
base-layer-id=1000
base-layer-id-offset=10000

Layer id for screen 0: 1000
Layer id for screen 1: 11000
Layer id for screen 2: 21000

To support multi screen, create layers for background and panel bar which
located in the below per screens. At the moment, it is only layers.
Surfaces to be created at next patch in the patch set.

Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanib...@xddp.denso.co.jp>
Reviewed-by: Pekka Paalanen <pekka.paala...@collabora.co.uk>
---
 ivi-shell/hmi-controller.c | 82 +++++++++++++++++++++++++++++++++++-----------
 ivi-shell/weston.ini.in    |  2 ++
 2 files changed, 65 insertions(+), 19 deletions(-)

diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 66dde79..7739aa7 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -72,6 +72,7 @@ struct hmi_controller_layer {
        int32_t y;
        int32_t width;
        int32_t height;
+       struct wl_list link;
 };
 
 struct link_layer {
@@ -89,6 +90,7 @@ struct hmi_server_setting {
        uint32_t    application_layer_id;
        uint32_t    workspace_background_layer_id;
        uint32_t    workspace_layer_id;
+       uint32_t    base_layer_id_offset;
        int32_t     panel_height;
        uint32_t    transition_duration;
        char       *ivi_homescreen;
@@ -107,7 +109,8 @@ struct ui_setting {
 
 struct hmi_controller {
        struct hmi_server_setting          *hmi_setting;
-       struct hmi_controller_layer         base_layer;
+       /* List of struct hmi_controller_layer */
+       struct wl_list                      base_layer_list;
        struct hmi_controller_layer         application_layer;
        struct hmi_controller_layer         workspace_background_layer;
        struct hmi_controller_layer         workspace_layer;
@@ -654,6 +657,9 @@ hmi_server_setting_create(struct weston_compositor *ec)
        weston_config_section_get_uint(shell_section, "application-layer-id",
                                       &setting->application_layer_id, 4000);
 
+       weston_config_section_get_uint(shell_section, "base-layer-id-offset",
+                                      &setting->base_layer_id_offset, 10000);
+
        weston_config_section_get_uint(shell_section, "transition-duration",
                                       &setting->transition_duration, 300);
 
@@ -671,6 +677,8 @@ hmi_controller_destroy(struct wl_listener *listener, void 
*data)
 {
        struct link_layer *link = NULL;
        struct link_layer *next = NULL;
+       struct hmi_controller_layer *ctrl_layer_link = NULL;
+       struct hmi_controller_layer *ctrl_layer_next = NULL;
        struct hmi_controller *hmi_ctrl =
                container_of(listener, struct hmi_controller, destroy_listener);
 
@@ -680,6 +688,12 @@ hmi_controller_destroy(struct wl_listener *listener, void 
*data)
                free(link);
        }
 
+       wl_list_for_each_safe(ctrl_layer_link, ctrl_layer_next,
+                             &hmi_ctrl->base_layer_list, link) {
+               wl_list_remove(&ctrl_layer_link->link);
+               free(ctrl_layer_link);
+       }
+
        wl_array_release(&hmi_ctrl->ui_widgets);
        free(hmi_ctrl->hmi_setting);
        free(hmi_ctrl->pp_screen);
@@ -710,6 +724,9 @@ hmi_controller_create(struct weston_compositor *ec)
        struct link_layer *tmp_link_layer = NULL;
        int32_t panel_height = 0;
        struct hmi_controller *hmi_ctrl = MEM_ALLOC(sizeof(*hmi_ctrl));
+       struct hmi_controller_layer *base_layer = NULL;
+
+       int32_t i = 0;
 
        wl_array_init(&hmi_ctrl->ui_widgets);
        hmi_ctrl->layout_mode = IVI_HMI_CONTROLLER_LAYOUT_MODE_TILING;
@@ -724,18 +741,29 @@ hmi_controller_create(struct weston_compositor *ec)
        }
 
        iviscrn = get_screen(0, hmi_ctrl);
-       ivi_layout_interface->get_screen_resolution(iviscrn, &screen_width,
-                                        &screen_height);
 
        /* init base ivi_layer*/
-       hmi_ctrl->base_layer.x = 0;
-       hmi_ctrl->base_layer.y = 0;
-       hmi_ctrl->base_layer.width = screen_width;
-       hmi_ctrl->base_layer.height = screen_height;
-       hmi_ctrl->base_layer.id_layer = hmi_ctrl->hmi_setting->base_layer_id;
-
-       create_layer(iviscrn, &hmi_ctrl->base_layer);
+       wl_list_init(&hmi_ctrl->base_layer_list);
+       for (i = 0; i < hmi_ctrl->screen_num; i++) {
+               ivi_layout_interface->get_screen_resolution(get_screen(i, 
hmi_ctrl),
+                                                &screen_width,
+                                                &screen_height);
+
+               base_layer = MEM_ALLOC(1 * sizeof(struct hmi_controller_layer));
+               base_layer->x = 0;
+               base_layer->y = 0;
+               base_layer->width = screen_width;
+               base_layer->height = screen_height;
+               base_layer->id_layer =
+                       hmi_ctrl->hmi_setting->base_layer_id +
+                                               (i * 
hmi_ctrl->hmi_setting->base_layer_id_offset);
+               wl_list_insert(&hmi_ctrl->base_layer_list, &base_layer->link);
+
+               create_layer(get_screen(i, hmi_ctrl), base_layer);
+       }
 
+       ivi_layout_interface->get_screen_resolution(iviscrn, &screen_width,
+                                        &screen_height);
        panel_height = hmi_ctrl->hmi_setting->panel_height;
 
        /* init application ivi_layer */
@@ -802,7 +830,11 @@ ivi_hmi_controller_set_background(struct hmi_controller 
*hmi_ctrl,
                                  uint32_t id_surface)
 {
        struct ivi_layout_surface *ivisurf = NULL;
-       struct ivi_layout_layer   *ivilayer = hmi_ctrl->base_layer.ivilayer;
+       struct hmi_controller_layer *base_layer =
+                                       
wl_container_of(hmi_ctrl->base_layer_list.prev,
+                                                       base_layer,
+                                                       link);
+       struct ivi_layout_layer   *ivilayer = base_layer->ivilayer;
        const int32_t dstx = hmi_ctrl->application_layer.x;
        const int32_t dsty = hmi_ctrl->application_layer.y;
        const int32_t width  = hmi_ctrl->application_layer.width;
@@ -839,8 +871,12 @@ ivi_hmi_controller_set_panel(struct hmi_controller 
*hmi_ctrl,
                             uint32_t id_surface)
 {
        struct ivi_layout_surface *ivisurf  = NULL;
-       struct ivi_layout_layer   *ivilayer = hmi_ctrl->base_layer.ivilayer;
-       const int32_t width  = hmi_ctrl->base_layer.width;
+       struct hmi_controller_layer *base_layer =
+                                       
wl_container_of(hmi_ctrl->base_layer_list.prev,
+                                                       base_layer,
+                                                       link);
+       struct ivi_layout_layer   *ivilayer = base_layer->ivilayer;
+       const int32_t width  = base_layer->width;
        int32_t ret = 0;
        int32_t panel_height = 0;
        const int32_t dstx = 0;
@@ -858,7 +894,7 @@ ivi_hmi_controller_set_panel(struct hmi_controller 
*hmi_ctrl,
 
        panel_height = hmi_ctrl->hmi_setting->panel_height;
 
-       dsty = hmi_ctrl->base_layer.height - panel_height;
+       dsty = base_layer->height - panel_height;
 
        ret = ivi_layout_interface->surface_set_destination_rectangle(
                ivisurf, dstx, dsty, width, panel_height);
@@ -882,7 +918,11 @@ ivi_hmi_controller_set_button(struct hmi_controller 
*hmi_ctrl,
                              uint32_t id_surface, int32_t number)
 {
        struct ivi_layout_surface *ivisurf  = NULL;
-       struct ivi_layout_layer   *ivilayer = hmi_ctrl->base_layer.ivilayer;
+       struct hmi_controller_layer *base_layer =
+                                       
wl_container_of(hmi_ctrl->base_layer_list.prev,
+                                                       base_layer,
+                                                       link);
+       struct ivi_layout_layer   *ivilayer = base_layer->ivilayer;
        const int32_t width  = 48;
        const int32_t height = 48;
        int32_t ret = 0;
@@ -902,7 +942,7 @@ ivi_hmi_controller_set_button(struct hmi_controller 
*hmi_ctrl,
        panel_height = hmi_ctrl->hmi_setting->panel_height;
 
        dstx = (60 * number) + 15;
-       dsty = (hmi_ctrl->base_layer.height - panel_height) + 5;
+       dsty = (base_layer->height - panel_height) + 5;
 
        ret = ivi_layout_interface->surface_set_destination_rectangle(
                ivisurf,dstx, dsty, width, height);
@@ -924,12 +964,16 @@ ivi_hmi_controller_set_home_button(struct hmi_controller 
*hmi_ctrl,
                                   uint32_t id_surface)
 {
        struct ivi_layout_surface *ivisurf  = NULL;
-       struct ivi_layout_layer   *ivilayer = hmi_ctrl->base_layer.ivilayer;
+       struct hmi_controller_layer *base_layer =
+                                       
wl_container_of(hmi_ctrl->base_layer_list.prev,
+                                                       base_layer,
+                                                       link);
+       struct ivi_layout_layer   *ivilayer = base_layer->ivilayer;
        int32_t ret = 0;
        int32_t size = 48;
        int32_t panel_height = hmi_ctrl->hmi_setting->panel_height;
-       const int32_t dstx = (hmi_ctrl->base_layer.width - size) / 2;
-       const int32_t dsty = (hmi_ctrl->base_layer.height - panel_height) + 5;
+       const int32_t dstx = (base_layer->width - size) / 2;
+       const int32_t dsty = (base_layer->height - panel_height) + 5;
 
        uint32_t *add_surface_id = wl_array_add(&hmi_ctrl->ui_widgets,
                                                sizeof(*add_surface_id));
diff --git a/ivi-shell/weston.ini.in b/ivi-shell/weston.ini.in
index 6c22633..17524aa 100644
--- a/ivi-shell/weston.ini.in
+++ b/ivi-shell/weston.ini.in
@@ -11,6 +11,8 @@ cursor-theme=default
 cursor-size=32
 
 base-layer-id=1000
+base-layer-id-offset=10000
+
 workspace-background-layer-id=2000
 workspace-layer-id=3000
 application-layer-id=4000
-- 
1.8.3.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to