1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
|
--- libva-1.1.0.orig/configure.ac 2012-10-04 08:30:51.000000000 -0500
+++ libva-1.1.0/configure.ac 2013-03-05 14:20:21.109767813 -0500
@@ -78,7 +78,7 @@
m4_define([libdrm_version], [2.4])
# Wayland minimum version number
-m4_define([wayland_api_version], [0.95.0])
+m4_define([wayland_api_version], [1.0.0])
AC_PREREQ(2.57)
AC_INIT([libva], [libva_version], [waldo.bastian@intel.com], libva)
--- libva-1.1.0.orig/test/common/va_display_wayland.c 2012-09-28 09:04:28.000000000 -0500
+++ libva-1.1.0/test/common/va_display_wayland.c 2013-03-05 15:06:59.082134052 -0500
@@ -33,42 +33,39 @@
struct display {
struct wl_display *display;
+ struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shell *shell;
struct wl_shell_surface *shell_surface;
struct wl_surface *surface;
unsigned int ref_count;
int event_fd;
- unsigned int event_mask;
};
static struct display *g_display;
static void
-display_handle_global(
- struct wl_display *display,
- uint32_t id,
- const char *interface,
- uint32_t version,
- void *data
+registry_handle_global(
+ void *data,
+ struct wl_registry *registry,
+ uint32_t id,
+ const char *interface,
+ uint32_t version
)
{
struct display * const d = data;
if (strcmp(interface, "wl_compositor") == 0)
- d->compositor = wl_display_bind(display, id, &wl_compositor_interface);
+ d->compositor =
+ wl_registry_bind(registry, id, &wl_compositor_interface, 1);
else if (strcmp(interface, "wl_shell") == 0)
- d->shell = wl_display_bind(display, id, &wl_shell_interface);
+ d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
}
-static int
-event_mask_update(uint32_t mask, void *data)
-{
- struct display * const d = data;
-
- d->event_mask = mask;
- return 0;
-}
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ NULL,
+};
static VADisplay
va_open_display_wayland(void)
@@ -91,9 +88,10 @@
return NULL;
}
wl_display_set_user_data(d->display, d);
- wl_display_add_global_listener(d->display, display_handle_global, d);
- d->event_fd = wl_display_get_fd(d->display, event_mask_update, d);
- wl_display_iterate(d->display, d->event_mask);
+ d->registry = wl_display_get_registry(d->display);
+ wl_registry_add_listener(d->registry, ®istry_listener, d);
+ d->event_fd = wl_display_get_fd(d->display);
+ wl_display_dispatch(d->display);
d->ref_count = 1;
g_display = d;
@@ -182,6 +180,7 @@
dst_rect->x, dst_rect->y, dst_rect->width, dst_rect->height
);
+ wl_surface_commit(d->surface);
wl_display_flush(d->display);
return VA_STATUS_SUCCESS;
}
--- libva-1.1.0.orig/test/putsurface/putsurface_wayland.c 2012-09-28 09:04:28.000000000 -0500
+++ libva-1.1.0/test/putsurface/putsurface_wayland.c 2013-03-05 14:45:49.783865254 -0500
@@ -102,7 +102,7 @@
struct wl_display *display;
struct wl_compositor *compositor;
struct wl_shell *shell;
- uint32_t mask;
+ struct wl_registry *registry;
int event_fd;
};
@@ -153,7 +153,7 @@
if (wl_drawable->redraw_pending) {
wl_display_flush(d->display);
while (wl_drawable->redraw_pending)
- wl_display_iterate(wl_drawable->display, WL_DISPLAY_READABLE);
+ wl_display_dispatch(wl_drawable->display);
}
va_status = vaGetSurfaceBufferWl(va_dpy, va_surface, VA_FRAME_PICTURE, &buffer);
@@ -169,35 +169,33 @@
wl_display_flush(d->display);
wl_drawable->redraw_pending = 1;
callback = wl_surface_frame(wl_drawable->surface);
+ wl_surface_commit(wl_drawable->surface);
wl_callback_add_listener(callback, &frame_callback_listener, wl_drawable);
return VA_STATUS_SUCCESS;
}
static void
-display_handle_global(
- struct wl_display *display,
- uint32_t id,
- const char *interface,
- uint32_t version,
- void *data
+registry_handle_global(
+ void *data,
+ struct wl_registry *registry,
+ uint32_t id,
+ const char *interface,
+ uint32_t version
)
{
struct display * const d = data;
if (strcmp(interface, "wl_compositor") == 0)
- d->compositor = wl_display_bind(display, id, &wl_compositor_interface);
+ d->compositor =
+ wl_registry_bind(registry, id, &wl_compositor_interface, 1);
else if (strcmp(interface, "wl_shell") == 0)
- d->shell = wl_display_bind(display, id, &wl_shell_interface);
+ d->shell = wl_registry_bind(registry, id, &wl_shell_interface, 1);
}
-static int
-event_mask_update(uint32_t mask, void *data)
-{
- struct display * const d = data;
-
- d->mask = mask;
- return 0;
-}
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ NULL,
+};
static void *
open_display(void)
@@ -213,9 +211,10 @@
return NULL;
wl_display_set_user_data(d->display, d);
- wl_display_add_global_listener(d->display, display_handle_global, d);
- d->event_fd = wl_display_get_fd(d->display, event_mask_update, d);
- wl_display_iterate(d->display, d->mask);
+ d->registry = wl_display_get_registry(d->display);
+ wl_registry_add_listener(d->registry, ®istry_listener, d);
+ d->event_fd = wl_display_get_fd(d->display);
+ wl_display_dispatch(d->display);
return d->display;
}
@@ -298,9 +297,6 @@
if (check_event == 0)
return 0;
- if (!(d->mask & WL_DISPLAY_READABLE))
- return 0;
-
tv.tv_sec = 0;
tv.tv_usec = 0;
do {
@@ -313,7 +309,7 @@
break;
}
if (retval == 1)
- wl_display_iterate(d->display, WL_DISPLAY_READABLE);
+ wl_display_dispatch(d->display);
} while (retval > 0);
#if 0
--- libva-1.1.0.orig/va/wayland/va_wayland_drm.c 2012-09-28 09:04:28.000000000 -0500
+++ libva-1.1.0/va/wayland/va_wayland_drm.c 2013-03-05 14:52:34.952330711 -0500
@@ -44,6 +44,7 @@
struct va_wayland_context base;
void *handle;
struct wl_drm *drm;
+ struct wl_registry *registry;
void *drm_interface;
unsigned int is_authenticated : 1;
} VADisplayContextWaylandDRM;
@@ -142,6 +143,28 @@
}
}
+static void
+registry_handle_global(
+ void *data,
+ struct wl_registry *registry,
+ uint32_t id,
+ const char *interface,
+ uint32_t version
+)
+{
+ struct va_wayland_drm_context *wl_drm_ctx = data;
+
+ if (strcmp(interface, "wl_drm") == 0) {
+ wl_drm_ctx->drm =
+ wl_registry_bind(wl_drm_ctx->registry, id, wl_drm_ctx->drm_interface, 1);
+ }
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ NULL,
+};
+
bool
va_wayland_drm_create(VADisplayContextP pDisplayContext)
{
@@ -168,14 +191,6 @@
drm_state->auth_type = 0;
ctx->drm_state = drm_state;
- id = wl_display_get_global(ctx->native_dpy, "wl_drm", 1);
- if (!id) {
- wl_display_roundtrip(ctx->native_dpy);
- id = wl_display_get_global(ctx->native_dpy, "wl_drm", 1);
- if (!id)
- return false;
- }
-
wl_drm_ctx->handle = dlopen(LIBWAYLAND_DRM_NAME, RTLD_LAZY|RTLD_LOCAL);
if (!wl_drm_ctx->handle)
return false;
@@ -185,8 +200,14 @@
if (!wl_drm_ctx->drm_interface)
return false;
- wl_drm_ctx->drm =
- wl_display_bind(ctx->native_dpy, id, wl_drm_ctx->drm_interface);
+ wl_drm_ctx->registry = wl_display_get_registry(ctx->native_dpy);
+ wl_registry_add_listener(wl_drm_ctx->registry, ®istry_listener, wl_drm_ctx);
+ wl_display_roundtrip(ctx->native_dpy);
+
+ /* registry_handle_global should have been called by the
+ * wl_display_roundtrip above
+ */
+
if (!wl_drm_ctx->drm)
return false;
--- libva-1.1.0.orig/va/wayland/va_wayland_emgd.c 2012-09-28 09:04:28.000000000 -0500
+++ libva-1.1.0/va/wayland/va_wayland_emgd.c 2013-03-05 14:55:57.359895989 -0500
@@ -40,6 +40,7 @@
struct wl_emgd *emgd;
void *emgd_interface;
unsigned int is_created : 1;
+ struct wl_registry *registry;
} VADisplayContextWaylandEMGD;
static inline void
@@ -86,6 +87,28 @@
}
}
+static void
+registry_handle_global(
+ void *data,
+ struct wl_registry *registry,
+ uint32_t id,
+ const char *interface,
+ uint32_t version
+)
+{
+ VADisplayContextWaylandEMGD *wl_emgd_ctx = data;
+
+ if (strcmp(interface, "wl_emgd") == 0) {
+ wl_emgd_ctx->emgd =
+ wl_registry_bind(registry, id, wl_emgd_ctx->emgd_interface, 1);
+ }
+}
+
+static const struct wl_registry_listener registry_listener = {
+ registry_handle_global,
+ NULL,
+};
+
bool
va_wayland_emgd_create(VADisplayContextP pDisplayContext)
{
@@ -112,14 +135,6 @@
drm_state->auth_type = 0;
ctx->drm_state = drm_state;
- id = wl_display_get_global(ctx->native_dpy, "wl_emgd", 1);
- if (!id) {
- wl_display_roundtrip(ctx->native_dpy);
- id = wl_display_get_global(ctx->native_dpy, "wl_emgd", 1);
- if (!id)
- return false;
- }
-
wl_emgd_ctx->handle = dlopen(LIBWAYLAND_EMGD_NAME, RTLD_LAZY|RTLD_LOCAL);
if (!wl_emgd_ctx->handle)
return false;
@@ -129,8 +144,13 @@
if (!wl_emgd_ctx->emgd_interface)
return false;
- wl_emgd_ctx->emgd =
- wl_display_bind(ctx->native_dpy, id, wl_emgd_ctx->emgd_interface);
+ wl_emgd_ctx->registry = wl_display_get_registry(ctx->native_dpy);
+ wl_registry_add_listener(wl_emgd_ctx->registry, ®istry_listener, wl_emgd_ctx);
+ wl_display_roundtrip(ctx->native_dpy);
+
+ /* registry_handle_global should have been called by the
+ * wl_display_roundtrip above
+ */
if (!wl_emgd_ctx->emgd)
return false;
return true;
|