]> git.pld-linux.org Git - packages/libva.git/blob - libva-wayland.patch
- updated to 1.1.0; new source URL
[packages/libva.git] / libva-wayland.patch
1 From eb2ba290f679c6cefe621ee6d9fa4302acbadc51 Mon Sep 17 00:00:00 2001
2 From: Rob Bradford <rob@linux.intel.com>
3 Date: Fri, 02 Nov 2012 11:39:33 +0000
4 Subject: tests: fix printf in putsurface_wayland test
5
6 Signed-off-by: Rob Bradford <rob@linux.intel.com>
7 ---
8 diff --git a/test/putsurface/putsurface_common.c b/test/putsurface/putsurface_common.c
9 index 06f394f..2116ce4 100644
10 --- a/test/putsurface/putsurface_common.c
11 +++ b/test/putsurface/putsurface_common.c
12 @@ -190,7 +190,7 @@ static void* putsurface_thread(void *data)
13          while (surface_id == VA_INVALID_SURFACE)
14              surface_id = get_next_free_surface(&index);
15  
16 -        if (verbose) printf("Thread %x Display surface 0x%p,\n", (unsigned int)drawable, (void *)surface_id);
17 +        if (verbose) printf("Thread: %p Display surface 0x%x,\n", drawable, surface_id);
18  
19          if (multi_thread)
20              upload_surface(va_dpy, surface_id, box_width, row_shift, display_field);
21 --
22 cgit v0.9.0.2-2-gbebe
23 From b1cf861a087234eb797c402040403a538adbe0cc Mon Sep 17 00:00:00 2001
24 From: Rob Bradford <rob@linux.intel.com>
25 Date: Fri, 02 Nov 2012 10:57:47 +0000
26 Subject: wayland: port to 1.0 protocol.
27
28 With the change in protocol the hash of globals maintained by the client was
29 dropped. Instead we must setup a listener on the registry and get the globals
30 in a stream from that.
31
32 Signed-off-by: Rob Bradford <rob@linux.intel.com>
33 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
34 ---
35 diff --git a/configure.ac b/configure.ac
36 index de83e35..257964d 100644
37 --- a/configure.ac
38 +++ b/configure.ac
39 @@ -78,7 +78,7 @@ m4_define([libva_lt_age],
40  m4_define([libdrm_version], [2.4])
41  
42  # Wayland minimum version number
43 -m4_define([wayland_api_version], [0.95.0])
44 +m4_define([wayland_api_version], [1.0.0])
45  
46  AC_PREREQ(2.57)
47  AC_INIT([libva], [libva_version], [waldo.bastian@intel.com], libva)
48 diff --git a/test/common/va_display_wayland.c b/test/common/va_display_wayland.c
49 index 332d16d..abcb2b6 100644
50 --- a/test/common/va_display_wayland.c
51 +++ b/test/common/va_display_wayland.c
52 @@ -33,42 +33,39 @@
53  
54  struct display {
55      struct wl_display          *display;
56 +    struct wl_registry         *registry;
57      struct wl_compositor       *compositor;
58      struct wl_shell            *shell;
59      struct wl_shell_surface    *shell_surface;
60      struct wl_surface          *surface;
61      unsigned int                ref_count;
62      int                         event_fd;
63 -    unsigned int                event_mask;
64  };
65  
66  static struct display *g_display;
67  
68  static void
69 -display_handle_global(
70 -    struct wl_display *display,
71 -    uint32_t           id,
72 -    const char        *interface,
73 -    uint32_t           version,
74 -    void              *data
75 +registry_handle_global(
76 +    void               *data,
77 +    struct wl_registry *registry,
78 +    uint32_t            id,
79 +    const char         *interface,
80 +    uint32_t            version
81  )
82  {
83      struct display * const d = data;
84  
85      if (strcmp(interface, "wl_compositor") == 0)
86 -        d->compositor = wl_display_bind(display, id, &wl_compositor_interface);
87 +        d->compositor =
88 +            wl_registry_bind(registry, id, &wl_compositor_interface, 1);
89      else if (strcmp(interface, "wl_shell") == 0)
90 -        d->shell = wl_display_bind(display, id, &wl_shell_interface);
91 +        d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
92  }
93  
94 -static int
95 -event_mask_update(uint32_t mask, void *data)
96 -{
97 -    struct display * const d = data;
98 -
99 -    d->event_mask = mask;
100 -    return 0;
101 -}
102 +static const struct wl_registry_listener registry_listener = {
103 +    registry_handle_global,
104 +    NULL,
105 +};
106  
107  static VADisplay
108  va_open_display_wayland(void)
109 @@ -91,9 +88,10 @@ va_open_display_wayland(void)
110              return NULL;
111          }
112          wl_display_set_user_data(d->display, d);
113 -        wl_display_add_global_listener(d->display, display_handle_global, d);
114 -        d->event_fd = wl_display_get_fd(d->display, event_mask_update, d);
115 -        wl_display_iterate(d->display, d->event_mask);
116 +        d->registry = wl_display_get_registry(d->display);
117 +        wl_registry_add_listener(d->registry, &registry_listener, d);
118 +        d->event_fd = wl_display_get_fd(d->display);
119 +        wl_display_dispatch(d->display);
120  
121          d->ref_count = 1;
122          g_display = d;
123 @@ -182,6 +180,7 @@ va_put_surface_wayland(
124           dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height
125       );
126  
127 +    wl_surface_commit(d->surface);
128      wl_display_flush(d->display);
129      return VA_STATUS_SUCCESS;
130  }
131 diff --git a/test/putsurface/putsurface_wayland.c b/test/putsurface/putsurface_wayland.c
132 index 3e1d495..b93334d 100644
133 --- a/test/putsurface/putsurface_wayland.c
134 +++ b/test/putsurface/putsurface_wayland.c
135 @@ -102,7 +102,7 @@ struct display {
136      struct wl_display  *display;
137      struct wl_compositor *compositor;
138      struct wl_shell    *shell;
139 -    uint32_t            mask;
140 +    struct wl_registry *registry;
141      int                 event_fd;
142  };
143  
144 @@ -153,7 +153,7 @@ va_put_surface(
145      if (wl_drawable->redraw_pending) {
146          wl_display_flush(d->display);
147          while (wl_drawable->redraw_pending)
148 -            wl_display_iterate(wl_drawable->display, WL_DISPLAY_READABLE);
149 +            wl_display_dispatch(wl_drawable->display);
150      }
151  
152      va_status = vaGetSurfaceBufferWl(va_dpy, va_surface, VA_FRAME_PICTURE, &buffer);
153 @@ -169,35 +169,33 @@ va_put_surface(
154      wl_display_flush(d->display);
155      wl_drawable->redraw_pending = 1;
156      callback = wl_surface_frame(wl_drawable->surface);
157 +    wl_surface_commit(wl_drawable->surface);
158      wl_callback_add_listener(callback, &frame_callback_listener, wl_drawable);
159      return VA_STATUS_SUCCESS;
160  }
161  
162  static void
163 -display_handle_global(
164 -    struct wl_display *display,
165 -    uint32_t           id,
166 -    const char        *interface,
167 -    uint32_t           version,
168 -    void              *data
169 +registry_handle_global(
170 +    void               *data,
171 +    struct wl_registry *registry,
172 +    uint32_t            id,
173 +    const char         *interface,
174 +    uint32_t            version
175  )
176  {
177      struct display * const d = data;
178  
179      if (strcmp(interface, "wl_compositor") == 0)
180 -        d->compositor = wl_display_bind(display, id, &wl_compositor_interface);
181 +        d->compositor =
182 +            wl_registry_bind(registry, id, &wl_compositor_interface, 1);
183      else if (strcmp(interface, "wl_shell") == 0)
184 -        d->shell = wl_display_bind(display, id, &wl_shell_interface);
185 +        d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
186  }
187  
188 -static int
189 -event_mask_update(uint32_t mask, void *data)
190 -{
191 -    struct display * const d = data;
192 -
193 -    d->mask = mask;
194 -    return 0;
195 -}
196 +static const struct wl_registry_listener registry_listener = {
197 +    registry_handle_global,
198 +    NULL,
199 +};
200  
201  static void *
202  open_display(void)
203 @@ -213,9 +211,10 @@ open_display(void)
204          return NULL;
205  
206      wl_display_set_user_data(d->display, d);
207 -    wl_display_add_global_listener(d->display, display_handle_global, d);
208 -    d->event_fd = wl_display_get_fd(d->display, event_mask_update, d);
209 -    wl_display_iterate(d->display, d->mask);
210 +    d->registry = wl_display_get_registry(d->display);
211 +    wl_registry_add_listener(d->registry, &registry_listener, d);
212 +    d->event_fd = wl_display_get_fd(d->display);
213 +    wl_display_dispatch(d->display);
214      return d->display;
215  }
216  
217 @@ -298,9 +297,6 @@ check_window_event(
218      if (check_event == 0)
219          return 0;
220  
221 -    if (!(d->mask & WL_DISPLAY_READABLE))
222 -        return 0;
223 -
224      tv.tv_sec  = 0;
225      tv.tv_usec = 0;
226      do {
227 @@ -313,7 +309,7 @@ check_window_event(
228              break;
229          }
230          if (retval == 1)
231 -            wl_display_iterate(d->display, WL_DISPLAY_READABLE);
232 +            wl_display_dispatch(d->display);
233      } while (retval > 0);
234  
235  #if 0
236 diff --git a/va/wayland/va_wayland_drm.c b/va/wayland/va_wayland_drm.c
237 index 30c3953..d292316 100644
238 --- a/va/wayland/va_wayland_drm.c
239 +++ b/va/wayland/va_wayland_drm.c
240 @@ -44,6 +44,7 @@ typedef struct va_wayland_drm_context {
241      struct va_wayland_context   base;
242      void                       *handle;
243      struct wl_drm              *drm;
244 +    struct wl_registry         *registry;
245      void                       *drm_interface;
246      unsigned int                is_authenticated        : 1;
247  } VADisplayContextWaylandDRM;
248 @@ -142,6 +143,28 @@ va_wayland_drm_destroy(VADisplayContextP pDisplayContext)
249      }
250  }
251  
252 +static void
253 +registry_handle_global(
254 +    void               *data,
255 +    struct wl_registry *registry,
256 +    uint32_t            id,
257 +    const char         *interface,
258 +    uint32_t            version
259 +)
260 +{
261 +    struct va_wayland_drm_context *wl_drm_ctx = data;
262 +
263 +    if (strcmp(interface, "wl_drm") == 0) {
264 +        wl_drm_ctx->drm =
265 +            wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface, 1);
266 +    }
267 +}
268 +
269 +static const struct wl_registry_listener registry_listener = {
270 +    registry_handle_global,
271 +    NULL,
272 +};
273 +
274  bool
275  va_wayland_drm_create(VADisplayContextP pDisplayContext)
276  {
277 @@ -168,14 +191,6 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
278      drm_state->auth_type = 0;
279      ctx->drm_state       = drm_state;
280  
281 -    id = wl_display_get_global(ctx->native_dpy, "wl_drm", 1);
282 -    if (!id) {
283 -        wl_display_roundtrip(ctx->native_dpy);
284 -        id = wl_display_get_global(ctx->native_dpy, "wl_drm", 1);
285 -        if (!id)
286 -            return false;
287 -    }
288 -
289      wl_drm_ctx->handle = dlopen(LIBWAYLAND_DRM_NAME, RTLD_LAZY|RTLD_LOCAL);
290      if (!wl_drm_ctx->handle)
291          return false;
292 @@ -185,8 +200,14 @@ va_wayland_drm_create(VADisplayContextP pDisplayContext)
293      if (!wl_drm_ctx->drm_interface)
294          return false;
295  
296 -    wl_drm_ctx->drm =
297 -        wl_display_bind(ctx->native_dpy, id, wl_drm_ctx->drm_interface);
298 +    wl_drm_ctx->registry = wl_display_get_registry(ctx->native_dpy);
299 +    wl_registry_add_listener(wl_drm_ctx->registry, &registry_listener, wl_drm_ctx);
300 +    wl_display_roundtrip(ctx->native_dpy);
301 +
302 +    /* registry_handle_global should have been called by the
303 +     * wl_display_roundtrip above
304 +     */
305 +
306      if (!wl_drm_ctx->drm)
307          return false;
308  
309 diff --git a/va/wayland/va_wayland_emgd.c b/va/wayland/va_wayland_emgd.c
310 index 73e6802..cb885d1 100644
311 --- a/va/wayland/va_wayland_emgd.c
312 +++ b/va/wayland/va_wayland_emgd.c
313 @@ -40,6 +40,7 @@ typedef struct va_wayland_emgd_context {
314      struct wl_emgd             *emgd;
315      void                       *emgd_interface;
316      unsigned int                is_created      : 1;
317 +    struct wl_registry         *registry;
318  } VADisplayContextWaylandEMGD;
319  
320  static inline void
321 @@ -86,6 +87,28 @@ va_wayland_emgd_destroy(VADisplayContextP pDisplayContext)
322      }
323  }
324  
325 +static void
326 +registry_handle_global(
327 +    void               *data,
328 +    struct wl_registry *registry,
329 +    uint32_t            id,
330 +    const char         *interface,
331 +    uint32_t            version
332 +)
333 +{
334 +    VADisplayContextWaylandEMGD *wl_emgd_ctx = data;
335 +
336 +    if (strcmp(interface, "wl_emgd") == 0) {
337 +        wl_emgd_ctx->emgd =
338 +            wl_registry_bind(registry, id, wl_emgd_ctx->emgd_interface, 1);
339 +    }
340 +}
341 +
342 +static const struct wl_registry_listener registry_listener = {
343 +    registry_handle_global,
344 +    NULL,
345 +};
346 +
347  bool
348  va_wayland_emgd_create(VADisplayContextP pDisplayContext)
349  {
350 @@ -112,14 +135,6 @@ va_wayland_emgd_create(VADisplayContextP pDisplayContext)
351      drm_state->auth_type = 0;
352      ctx->drm_state       = drm_state;
353  
354 -    id = wl_display_get_global(ctx->native_dpy, "wl_emgd", 1);
355 -    if (!id) {
356 -        wl_display_roundtrip(ctx->native_dpy);
357 -        id = wl_display_get_global(ctx->native_dpy, "wl_emgd", 1);
358 -        if (!id)
359 -            return false;
360 -    }
361 -
362      wl_emgd_ctx->handle = dlopen(LIBWAYLAND_EMGD_NAME, RTLD_LAZY|RTLD_LOCAL);
363      if (!wl_emgd_ctx->handle)
364          return false;
365 @@ -129,8 +144,13 @@ va_wayland_emgd_create(VADisplayContextP pDisplayContext)
366      if (!wl_emgd_ctx->emgd_interface)
367          return false;
368  
369 -    wl_emgd_ctx->emgd =
370 -        wl_display_bind(ctx->native_dpy, id, wl_emgd_ctx->emgd_interface);
371 +    wl_emgd_ctx->registry = wl_display_get_registry(ctx->native_dpy);
372 +    wl_registry_add_listener(wl_emgd_ctx->registry, &registry_listener, wl_emgd_ctx);
373 +    wl_display_roundtrip(ctx->native_dpy);
374 +
375 +    /* registry_handle_global should have been called by the
376 +     * wl_display_roundtrip above
377 +     */
378      if (!wl_emgd_ctx->emgd)
379          return false;
380      return true;
381 --
382 cgit v0.9.0.2-2-gbebe
This page took 0.129685 seconds and 3 git commands to generate.