Fix Weston IVI-Shell layout on Renesas R-Car E2 Silk
[AGL/meta-agl.git] / meta-ivi-common / recipes-graphics / wayland / weston-ivi-shell / 0002-IVI-Shell-use-primary-screen-for-resolution.patch
1 From: Manuel Bachmann <manuel.bachmann@iot.bzh>
2 Date: Thu, Nov 5 10:17:00 2015 +0000
3 Subject: ivi-shell: use primary screen for resolution values
4
5 Screen resolution values (width, height) are always grabbed
6 from the first screen, n.0, which can be a bad choice if it
7 is not the one really used as main display.
8
9 This mostly happens on hardware with a VGA adapter, such as
10 laptops or Renesas R-Car E2 "Silk", and prevents correct
11 layout stretching (black borders).
12
13 Discover the primary screen and use its values.
14
15 Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
16 ---
17
18 --- a/ivi-shell/hmi-controller.c        2015-11-05 09:57:55.740942450 +0000
19 +++ b/ivi-shell/hmi-controller.c        2015-11-05 10:00:23.545912494 +0000
20 @@ -676,6 +676,8 @@
21         struct link_layer *tmp_link_layer = NULL;
22         int32_t panel_height = 0;
23         struct hmi_controller *hmi_ctrl = MEM_ALLOC(sizeof(*hmi_ctrl));
24 +       struct weston_output *output = NULL;
25 +       int i = 0;
26  
27         wl_array_init(&hmi_ctrl->ui_widgets);
28         hmi_ctrl->layout_mode = IVI_HMI_CONTROLLER_LAYOUT_MODE_TILING;
29 @@ -684,11 +686,19 @@
30  
31         ivi_controller_interface->get_screens(&screen_length, &pp_screen);
32  
33 -       iviscrn = pp_screen[0];
34 +       /* find primary screen */
35 +       for (i = 0; i < screen_length; i++) {
36 +               iviscrn = pp_screen[i];
37 +               output = ivi_controller_interface->screen_get_output(iviscrn);
38 +               if (output->x == 0)
39 +                       break;
40 +       }
41  
42         ivi_controller_interface->get_screen_resolution(iviscrn, &screen_width,
43                                          &screen_height);
44  
45 +       iviscrn = pp_screen[0];
46 +
47         /* init base ivi_layer*/
48         hmi_ctrl->base_layer.x = 0;
49         hmi_ctrl->base_layer.y = 0;