dra7xx-evm: weston: add changes for AGL home screen
[AGL/meta-agl.git] / meta-agl-bsp / meta-ti / recipes-arago / weston / weston / 0002-ivi-shell-multi-screen-support-to-calcuration-of-a-m.patch
1 From 5c3c97aecadd59231e3b99a021080b019e1bbea4 Mon Sep 17 00:00:00 2001
2 From: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
3 Date: Wed, 9 Dec 2015 15:39:26 +0900
4 Subject: [PATCH 2/7] ivi-shell: multi screen support to calcuration of a mask
5  of weston_surface.
6
7 A weston_surface is transformed to multi screen coordinate, global
8 coordinate by matrix:m now.
9
10 Additionally, a mask needs to be calucated, taking account into,
11 - multi screen coordination: a destination rectangle of layer in the
12   coordination is easily calcurated by adding weston_output.{x,y} in
13   simple. This is because there is no scaled and rotated transformation.
14 - intersect inside of a screen the layer is assigned to. This is because
15   overlapped region of weston surface in another screen shall not be
16   displayed according to ivi use case.
17
18 Signed-off-by: Nobuhiko Tanibata <nobuhiko_tanibata@xddp.denso.co.jp>
19 Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
20 ---
21  ivi-shell/ivi-layout.c | 36 +++++++++++++++++++++++++++++++-----
22  1 file changed, 31 insertions(+), 5 deletions(-)
23
24 diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
25 index efc0da5..c8ea270 100644
26 --- a/ivi-shell/ivi-layout.c
27 +++ b/ivi-shell/ivi-layout.c
28 @@ -665,15 +665,24 @@ calc_inverse_matrix_transform(const struct weston_matrix *matrix,
29  
30  /**
31   * This computes the whole transformation matrix:m from surface-local
32 - * coordinates to global coordinates. It is assumed that
33 - * weston_view::geometry.{x,y} are zero.
34 + * coordinates to multi screens coordinate, which is global coordinates.
35 + * It is assumed that weston_view::geometry.{x,y} are zero.
36   *
37   * Additionally, this computes the mask on surface-local coordinates as a
38   * ivi_rectangle. This can be set to weston_view_set_mask.
39   *
40   * The mask is computed by following steps
41 - * - destination rectangle of layer is inversed to surface-local cooodinates
42 - *   by inversed matrix:m.
43 + * - destination rectangle of layer is tansformed to multi screen coordinate,
44 + *   global coordinates. This is done by adding weston_output.{x,y} in simple
45 + *   because there is no scaled and rotated transformation.
46 + * - destination rectangle of layer in multi screens coordinate needs to be
47 + *   intersected inside of a screen the layer is assigned to. This is because
48 + *   overlapped region of weston surface in another screen shall not be
49 + *   displayed according to ivi use case.
50 + * - destination rectangle of layer
51 + *   - in multi screen coordinates,
52 + *   - and intersected inside of an assigned screen,
53 + *   is inversed to surface-local cooodinates by inversed matrix:m.
54   * - the area is intersected by intersected area between weston_surface and
55   *   source rectangle of ivi_surface.
56   */
57 @@ -706,7 +715,17 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
58                                                      lp->dest_y,
59                                                      lp->dest_width,
60                                                      lp->dest_height };
61 +       struct ivi_rectangle screen_dest_rect =    { output->x,
62 +                                                    output->y,
63 +                                                    output->width,
64 +                                                    output->height };
65 +       struct ivi_rectangle layer_dest_rect_in_global =
66 +                                                  { lp->dest_x + output->x,
67 +                                                    lp->dest_y + output->y,
68 +                                                    lp->dest_width,
69 +                                                    lp->dest_height };
70         struct ivi_rectangle surface_result;
71 +       struct ivi_rectangle layer_dest_rect_in_global_intersected;
72  
73         /*
74          * the whole transformation matrix:m from surface-local
75 @@ -729,9 +748,16 @@ calc_surface_to_global_matrix_and_mask_to_weston_surface(
76         ivi_rectangle_intersect(&surface_source_rect, &weston_surface_rect,
77                                 &surface_result);
78  
79 +       /*
80 +        * destination rectangle of layer in multi screens coordinate
81 +        * is intersected to avoid displaying outside of an assigned screen.
82 +        */
83 +       ivi_rectangle_intersect(&layer_dest_rect_in_global, &screen_dest_rect,
84 +                               &layer_dest_rect_in_global_intersected);
85 +
86         /* calc masking area of weston_surface from m */
87         calc_inverse_matrix_transform(m,
88 -                                     &layer_dest_rect,
89 +                                     &layer_dest_rect_in_global_intersected,
90                                       &surface_result,
91                                       result);
92  }
93 -- 
94 2.4.5
95