Add package group and bitbake target for Quality Assurance
[AGL/meta-agl.git] / meta-ivi-common / recipes-graphics / wayland / wayland-ivi-extension / apply_weston-1.5.x.patch
1 From fb66405f4f8ee200a443e22d3b4f56a0e917f785 Mon Sep 17 00:00:00 2001
2 From: Manuel Bachmann <mbc@iot.bzh>
3 Date: Wed, 30 Sep 2015 05:22:25 +0200
4 Subject: [PATCH] Backport to Wayland/Weston 1.9.0 > 1.5.0.
5
6 Downgrade requirements to Wayland/Weston 1.9.0 > 1.5.0.
7
8 "wl_display_roundtrip_queue()" did not exist at the time,
9 so just use the wrapper functions instead.
10
11 Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
12 ---
13  .../ilmClient/src/ilm_client_wayland_platform.c    | 15 ++-----
14  .../ilmControl/src/ilm_control_wayland_platform.c  | 52 +++++++++++++++++++---
15  protocol/CMakeLists.txt                            |  4 +-
16  weston-ivi-shell/CMakeLists.txt                    |  4 +-
17  4 files changed, 53 insertions(+), 22 deletions(-)
18
19 diff --git a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c
20 index 55b1621..8730616 100644
21 --- a/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c
22 +++ b/ivi-layermanagement-api/ilmClient/src/ilm_client_wayland_platform.c
23 @@ -61,7 +61,6 @@ struct ilm_client_context {
24      struct wl_registry *registry;
25      struct wl_compositor *compositor;
26      struct ivi_application *ivi_application;
27 -    struct wl_event_queue *queue;
28  
29      struct wl_list list_surface;
30  
31 @@ -167,12 +166,6 @@ destroy_client_resouses(void)
32          ctx->ivi_application = NULL;
33      }
34  
35 -    if (ctx->queue)
36 -    {
37 -        wl_event_queue_destroy(ctx->queue);
38 -        ctx->queue = NULL;
39 -    }
40 -
41      if (ctx->registry)
42      {
43          wl_registry_destroy(ctx->registry);
44 @@ -203,21 +196,19 @@ init_client(void)
45  
46      wl_list_init(&ctx->list_surface);
47  
48 -    ctx->queue = wl_display_create_queue(ctx->display);
49      ctx->registry = wl_display_get_registry(ctx->display);
50      if (ctx->registry == NULL) {
51 -        wl_event_queue_destroy(ctx->queue);
52          fprintf(stderr, "Failed to get registry\n");
53          return;
54      }
55  
56 -    wl_proxy_set_queue((void*)ctx->registry, ctx->queue);
57      if (wl_registry_add_listener(ctx->registry,
58                               &registry_client_listener, ctx)) {
59          fprintf(stderr, "Failed to add registry listener\n");
60          return;
61      }
62 -    wl_display_roundtrip_queue(ctx->display, ctx->queue);
63 +    wl_display_dispatch(ctx->display);
64 +    wl_display_roundtrip(ctx->display);
65  
66      if ((ctx->display == NULL) || (ctx->ivi_application == NULL)) {
67          fprintf(stderr, "Failed to connect display at ilm_client\n");
68 @@ -239,7 +230,7 @@ get_client_instance(void)
69          exit(0);
70      }
71  
72 -    wl_display_roundtrip_queue(ctx->display, ctx->queue);
73 +    wl_display_roundtrip(ctx->display);
74  
75      return ctx;
76  }
77 diff --git a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
78 index 8910df5..61bdfc5 100644
79 --- a/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
80 +++ b/ivi-layermanagement-api/ilmControl/src/ilm_control_wayland_platform.c
81 @@ -76,6 +76,46 @@ struct screen_context {
82      struct ilm_control_context *ctx;
83  };
84  
85 +static void roundtrip_done(void *data, struct wl_callback *callback,
86 +                           uint32_t serial)
87 +{
88 +    (void) serial;
89 +
90 +    *(int *)data = 1;
91 +
92 +    wl_callback_destroy(callback);
93 +}
94 +
95 +static struct wl_callback_listener roundtrip_listener = {roundtrip_done};
96 +
97 +int display_roundtrip_queue(struct wl_display *display,
98 +                            struct wl_event_queue *queue)
99 +{
100 +    int done = 0;
101 +    int ret = 0;
102 +    struct wl_callback *callback = wl_display_sync(display);
103 +
104 +    if (! callback)
105 +    {
106 +        return -1;
107 +    }
108 +
109 +    wl_proxy_set_queue((void *)callback, queue);
110 +    wl_callback_add_listener(callback, &roundtrip_listener, &done);
111 +
112 +    while (ret != -1 && !done)
113 +    {
114 +        ret = wl_display_dispatch_queue(display, queue);
115 +    }
116 +
117 +    if (ret == -1 && !done)
118 +    {
119 +        wl_callback_destroy(callback);
120 +    }
121 +
122 +    return ret;
123 +}
124 +
125  static inline void lock_context(struct ilm_control_context *ctx)
126  {
127     pthread_mutex_lock(&ctx->mutex);
128 @@ -1304,11 +1344,11 @@ init_control(void)
129  
130      if (
131         // first level objects; ivi_controller
132 -       wl_display_roundtrip_queue(wl->display, wl->queue) == -1 ||
133 +       display_roundtrip_queue(wl->display, wl->queue) == -1 ||
134         // second level object: ivi_controller_surfaces/layers
135 -       wl_display_roundtrip_queue(wl->display, wl->queue) == -1 ||
136 +       display_roundtrip_queue(wl->display, wl->queue) == -1 ||
137         // third level objects: ivi_controller_surfaces/layers properties
138 -       wl_display_roundtrip_queue(wl->display, wl->queue) == -1)
139 +       display_roundtrip_queue(wl->display, wl->queue) == -1)
140      {
141          fprintf(stderr, "Failed to initialize wayland connection: %s\n", strerror(errno));
142          return -1;
143 @@ -1349,7 +1389,7 @@ ilmErrorTypes impl_sync_and_acquire_instance(struct ilm_control_context *ctx)
144  
145      lock_context(ctx);
146  
147 -    if (wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) == -1) {
148 +    if (display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) == -1) {
149          int err = wl_display_get_error(ctx->wl.display);
150          fprintf(stderr, "Error communicating with wayland: %s\n", strerror(err));
151          unlock_context(ctx);
152 @@ -2454,7 +2494,7 @@ ilm_getPropertiesOfSurface(t_ilm_uint surfaceID,
153              // request statistics for surface
154              ivi_controller_surface_send_stats(ctx_surf->controller);
155              // force submission
156 -            int ret = wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue);
157 +            int ret = display_roundtrip_queue(ctx->wl.display, ctx->wl.queue);
158  
159              // If we got an error here, there is really no sense
160              // in returning the properties as something is fundamentally
161 @@ -2567,7 +2607,7 @@ ilm_commitChanges(void)
162      if (ctx->wl.controller != NULL) {
163          ivi_controller_commit_changes(ctx->wl.controller);
164  
165 -        if (wl_display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) != -1)
166 +        if (display_roundtrip_queue(ctx->wl.display, ctx->wl.queue) != -1)
167          {
168              returnValue = ILM_SUCCESS;
169          }
170 diff --git a/protocol/CMakeLists.txt b/protocol/CMakeLists.txt
171 index 6842131..207b8f1 100644
172 --- a/protocol/CMakeLists.txt
173 +++ b/protocol/CMakeLists.txt
174 @@ -22,8 +22,8 @@ cmake_minimum_required (VERSION 2.6)
175  project(ivi-extension-protocol)
176  
177  find_package(PkgConfig REQUIRED)
178 -pkg_check_modules(WAYLAND_CLIENT wayland-client>=1.9.0 REQUIRED)
179 -pkg_check_modules(WAYLAND_SERVER wayland-server>=1.9.0 REQUIRED)
180 +pkg_check_modules(WAYLAND_CLIENT wayland-client>=1.5.0 REQUIRED)
181 +pkg_check_modules(WAYLAND_SERVER wayland-server>=1.5.0 REQUIRED)
182  
183  find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
184  
185 diff --git a/weston-ivi-shell/CMakeLists.txt b/weston-ivi-shell/CMakeLists.txt
186 index c2664df..927e3f5 100644
187 --- a/weston-ivi-shell/CMakeLists.txt
188 +++ b/weston-ivi-shell/CMakeLists.txt
189 @@ -23,8 +23,8 @@ cmake_minimum_required (VERSION 2.6)
190  project(ivi-controller)
191  
192  find_package(PkgConfig REQUIRED)
193 -pkg_check_modules(WAYLAND_SERVER wayland-server>=1.9.0 REQUIRED)
194 -pkg_check_modules(WESTON weston>=1.9.0 REQUIRED)
195 +pkg_check_modules(WAYLAND_SERVER wayland-server>=1.5.0 REQUIRED)
196 +pkg_check_modules(WESTON weston>=1.5.0 REQUIRED)
197  pkg_check_modules(PIXMAN pixman-1 REQUIRED)
198  
199  GET_TARGET_PROPERTY(IVI_EXTENSION_INCLUDE_DIRS ivi-extension-protocol INCLUDE_DIRECTORIES)
200 -- 
201 1.8.3.1
202