]> git.pld-linux.org Git - packages/Mesa.git/blob - Mesa-wayland.patch
- rebuild with expat 2.1.0
[packages/Mesa.git] / Mesa-wayland.patch
1 From 0229e3ae41be109ac423b2eb2ddf79e24b799d60 Mon Sep 17 00:00:00 2001
2 From: Kristian Høgsberg <krh@bitplanet.net>
3 Date: Thu, 11 Oct 2012 02:10:42 +0000
4 Subject: egl/wayland: Update to Wayland 0.99 API
5
6 The 0.99.0 Wayland release changes the event API to provide a thread-safe
7 mechanism for receiving events specific to a subsystem (such as EGL) and
8 we need to use it in the EGL platform.
9
10 The Wayland protocol now also requires a commit request to make changes
11 take effect, issue that from eglSwapBuffers.
12 ---
13 diff --git a/configure.ac b/configure.ac
14 index 6f851e2..aefa142 100644
15 --- a/configure.ac
16 +++ b/configure.ac
17 @@ -1505,7 +1505,7 @@ for plat in $egl_platforms; do
18                 ;;
19  
20         wayland)
21 -               PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server],, \
22 +               PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 0.99.0 wayland-server >= 0.99.0],, \
23                                   [AC_MSG_ERROR([cannot find libwayland-client])])
24                 GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
25  
26 diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
27 index 85c0745..be359d3 100644
28 --- a/src/egl/drivers/dri2/egl_dri2.h
29 +++ b/src/egl/drivers/dri2/egl_dri2.h
30 @@ -126,8 +126,10 @@ struct dri2_egl_display
31  
32  #ifdef HAVE_WAYLAND_PLATFORM
33     struct wl_display        *wl_dpy;
34 +   struct wl_registry       *wl_registry;
35     struct wl_drm            *wl_server_drm;
36     struct wl_drm            *wl_drm;
37 +   struct wl_event_queue    *wl_queue;
38     int                      authenticated;
39     int                      formats;
40  #endif
41 @@ -178,7 +180,7 @@ struct dri2_egl_surface
42     __DRIbuffer           *dri_buffers[__DRI_BUFFER_COUNT];
43     __DRIbuffer           *third_buffer;
44     __DRIbuffer           *pending_buffer;
45 -   EGLBoolean             block_swap_buffers;
46 +   struct wl_callback    *frame_callback;
47     int                   format;
48  #endif
49  
50 diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
51 index d9b45f1..089a5d7 100644
52 --- a/src/egl/drivers/dri2/platform_wayland.c
53 +++ b/src/egl/drivers/dri2/platform_wayland.c
54 @@ -46,6 +46,34 @@ enum wl_drm_format_flags {
55  };
56  
57  static void
58 +sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
59 +{
60 +   int *done = data;
61 +
62 +   *done = 1;
63 +   wl_callback_destroy(callback);
64 +}
65 +
66 +static const struct wl_callback_listener sync_listener = {
67 +   sync_callback
68 +};
69 +
70 +static int
71 +roundtrip(struct dri2_egl_display *dri2_dpy)
72 +{
73 +   struct wl_callback *callback;
74 +   int done = 0, ret = 0;
75 +
76 +   callback = wl_display_sync(dri2_dpy->wl_dpy);
77 +   wl_callback_add_listener(callback, &sync_listener, &done);
78 +   wl_proxy_set_queue((struct wl_proxy *) callback, dri2_dpy->wl_queue);
79 +   while (ret != -1 && !done)
80 +      ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
81 +
82 +   return ret;
83 +}
84 +
85 +static void
86  wl_buffer_release(void *data, struct wl_buffer *buffer)
87  {
88     struct dri2_egl_surface *dri2_surf = data;
89 @@ -104,7 +132,7 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
90  
91     dri2_surf->pending_buffer = NULL;
92     dri2_surf->third_buffer = NULL;
93 -   dri2_surf->block_swap_buffers = EGL_FALSE;
94 +   dri2_surf->frame_callback = NULL;
95  
96     if (conf->AlphaSize == 0)
97        dri2_surf->format = WL_DRM_FORMAT_XRGB8888;
98 @@ -333,11 +361,13 @@ dri2_release_buffers(struct dri2_egl_surface *dri2_surf)
99           switch (i) {
100           case __DRI_BUFFER_FRONT_LEFT:
101              if (dri2_surf->pending_buffer)
102 -             wl_display_roundtrip(dri2_dpy->wl_dpy);
103 +               roundtrip(dri2_dpy);
104              dri2_surf->pending_buffer = dri2_surf->dri_buffers[i];
105              callback = wl_display_sync(dri2_dpy->wl_dpy);
106             wl_callback_add_listener(callback,
107                                      &release_buffer_listener, dri2_surf);
108 +            wl_proxy_set_queue((struct wl_proxy *) callback,
109 +                               dri2_dpy->wl_queue);
110              break;
111           default:
112              dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
113 @@ -552,7 +582,7 @@ wayland_frame_callback(void *data, struct wl_callback *callback, uint32_t time)
114  {
115     struct dri2_egl_surface *dri2_surf = data;
116  
117 -   dri2_surf->block_swap_buffers = EGL_FALSE;
118 +   dri2_surf->frame_callback = NULL;
119     wl_callback_destroy(callback);
120  }
121  
122 @@ -569,17 +599,18 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
123     struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
124     struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
125     struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
126 -   struct wl_callback *callback;
127 +   int ret = 0;
128  
129 -   if (dri2_surf->block_swap_buffers) {
130 -      wl_display_flush(dri2_dpy->wl_dpy);
131 -      while (dri2_surf->block_swap_buffers)
132 -         wl_display_iterate(dri2_dpy->wl_dpy, WL_DISPLAY_READABLE);
133 -   }
134 +   while (dri2_surf->frame_callback && ret != -1)
135 +      ret = wl_display_dispatch_queue(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
136 +   if (ret < 0)
137 +      return EGL_FALSE;
138  
139 -   dri2_surf->block_swap_buffers = EGL_TRUE;
140 -   callback = wl_surface_frame(dri2_surf->wl_win->surface);
141 -   wl_callback_add_listener(callback, &frame_listener, dri2_surf);
142 +   dri2_surf->frame_callback = wl_surface_frame(dri2_surf->wl_win->surface);
143 +   wl_callback_add_listener(dri2_surf->frame_callback,
144 +                            &frame_listener, dri2_surf);
145 +   wl_proxy_set_queue((struct wl_proxy *) dri2_surf->frame_callback,
146 +                      dri2_dpy->wl_queue);
147  
148     if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
149        pointer_swap(
150 @@ -611,6 +642,8 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
151  
152        wl_surface_damage(dri2_surf->wl_win->surface, 0, 0,
153             dri2_surf->base.Width, dri2_surf->base.Height);
154 +
155 +      wl_surface_commit(dri2_surf->wl_win->surface);
156     }
157  
158     _EGLContext *ctx;
159 @@ -700,7 +733,8 @@ dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
160     dri2_dpy->authenticated = 0;
161  
162     wl_drm_authenticate(dri2_dpy->wl_drm, id);
163 -   wl_display_roundtrip(dri2_dpy->wl_dpy);
164 +   if (roundtrip(dri2_dpy) < 0)
165 +      ret = -1;
166  
167     if (!dri2_dpy->authenticated)
168        ret = -1;
169 @@ -795,12 +829,29 @@ static const struct wl_drm_listener drm_listener = {
170         drm_handle_authenticated
171  };
172  
173 +static void
174 +registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
175 +                      const char *interface, uint32_t version)
176 +{
177 +   struct dri2_egl_display *dri2_dpy = data;
178 +
179 +   if (strcmp(interface, "wl_drm") == 0) {
180 +      dri2_dpy->wl_drm =
181 +         wl_registry_bind(registry, name, &wl_drm_interface, 1);
182 +      wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
183 +   }
184 +}
185 +
186 +static const struct wl_registry_listener registry_listener = {
187 +       registry_handle_global
188 +};
189 +
190  EGLBoolean
191  dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
192  {
193     struct dri2_egl_display *dri2_dpy;
194     const __DRIconfig *config;
195 -   uint32_t id, types;
196 +   uint32_t types;
197     int i;
198     static const unsigned int argb_masks[4] =
199        { 0xff0000, 0xff00, 0xff, 0xff000000 };
200 @@ -827,22 +878,19 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
201        dri2_dpy->wl_dpy = disp->PlatformDisplay;
202     }
203  
204 -   id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
205 -   if (id == 0)
206 -      wl_display_roundtrip(dri2_dpy->wl_dpy);
207 -   id = wl_display_get_global(dri2_dpy->wl_dpy, "wl_drm", 1);
208 -   if (id == 0)
209 -      goto cleanup_dpy;
210 -   dri2_dpy->wl_drm = wl_display_bind(dri2_dpy->wl_dpy, id, &wl_drm_interface);
211 -   if (!dri2_dpy->wl_drm)
212 +   dri2_dpy->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy);
213 +   dri2_dpy->wl_registry = wl_display_get_registry(dri2_dpy->wl_dpy);
214 +   wl_proxy_set_queue((struct wl_proxy *) dri2_dpy->wl_registry,
215 +                      dri2_dpy->wl_queue);
216 +   wl_registry_add_listener(dri2_dpy->wl_registry,
217 +                            &registry_listener, dri2_dpy);
218 +   if (roundtrip(dri2_dpy) < 0 || dri2_dpy->wl_drm == NULL)
219        goto cleanup_dpy;
220 -   wl_drm_add_listener(dri2_dpy->wl_drm, &drm_listener, dri2_dpy);
221 -   wl_display_roundtrip(dri2_dpy->wl_dpy);
222 -   if (dri2_dpy->fd == -1)
223 +
224 +   if (roundtrip(dri2_dpy) < 0 || dri2_dpy->fd == -1)
225        goto cleanup_drm;
226  
227 -   wl_display_roundtrip(dri2_dpy->wl_dpy);
228 -   if (!dri2_dpy->authenticated)
229 +   if (roundtrip(dri2_dpy) < 0 || !dri2_dpy->authenticated)
230        goto cleanup_fd;
231  
232     dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
233 diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
234 index 7255c8f..3801fac 100644
235 --- a/src/gallium/state_trackers/egl/wayland/native_drm.c
236 +++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
237 @@ -180,35 +180,43 @@ static const struct wl_drm_listener drm_listener = {
238     drm_handle_authenticated
239  };
240  
241 +static void
242 +registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
243 +                       const char *interface, uint32_t version)
244 +{
245 +   struct wayland_drm_display *drmdpy = data;
246 +
247 +   if (strcmp(interface, "wl_drm") == 0) {
248 +      drmdpy->wl_drm = wl_registry_bind(registry, name, &wl_drm_interface, 1);
249 +      wl_drm_add_listener(drmdpy->wl_drm, &drm_listener, drmdpy);
250 +   }
251 +}
252 +
253 +static const struct wl_registry_listener registry_listener = {
254 +       registry_handle_global
255 +};
256 +
257  static boolean
258  wayland_drm_display_init_screen(struct native_display *ndpy)
259  {
260     struct wayland_drm_display *drmdpy = wayland_drm_display(ndpy);
261 -   uint32_t id;
262 -
263 -   id = wl_display_get_global(drmdpy->base.dpy, "wl_drm", 1);
264 -   if (id == 0)
265 -      wl_display_roundtrip(drmdpy->base.dpy);
266 -   id = wl_display_get_global(drmdpy->base.dpy, "wl_drm", 1);
267 -   if (id == 0)
268 -      return FALSE;
269  
270 -   drmdpy->wl_drm = wl_display_bind(drmdpy->base.dpy, id, &wl_drm_interface);
271 -   if (!drmdpy->wl_drm)
272 +   drmdpy->base.queue = wl_display_create_queue(drmdpy->base.dpy);
273 +   drmdpy->base.registry = wl_display_get_registry(drmdpy->base.dpy);
274 +   wl_proxy_set_queue((struct wl_proxy *) drmdpy->base.registry,
275 +                      drmdpy->base.queue);
276 +   wl_registry_add_listener(drmdpy->base.registry, &registry_listener, drmdpy);
277 +   if (wayland_roundtrip(&drmdpy->base) < 0 || drmdpy->wl_drm == NULL)
278        return FALSE;
279  
280     wl_drm_add_listener(drmdpy->wl_drm, &drm_listener, drmdpy);
281 -   wl_display_roundtrip(drmdpy->base.dpy);
282 -   if (drmdpy->fd == -1)
283 +   if (wayland_roundtrip(&drmdpy->base) < 0 || drmdpy->fd == -1)
284        return FALSE;
285  
286 -   wl_display_roundtrip(drmdpy->base.dpy);
287 -   if (!drmdpy->authenticated)
288 +   if (wayland_roundtrip(&drmdpy->base) < 0 || !drmdpy->authenticated)
289        return FALSE;
290  
291     if (drmdpy->base.formats == 0)
292 -      wl_display_roundtrip(drmdpy->base.dpy);
293 -   if (drmdpy->base.formats == 0)
294        return FALSE;
295  
296     drmdpy->base.base.screen =
297 diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
298 index 643bb92..9fb8077 100644
299 --- a/src/gallium/state_trackers/egl/wayland/native_shm.c
300 +++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
301 @@ -132,26 +132,36 @@ static const struct wl_shm_listener shm_listener = {
302     shm_handle_format
303  };
304  
305 +static void
306 +registry_handle_global(void *data, struct wl_registry *registry, uint32_t name,
307 +                       const char *interface, uint32_t version)
308 +{
309 +   struct wayland_shm_display *shmdpy = data;
310 +
311 +   if (strcmp(interface, "wl_shm") == 0) {
312 +      shmdpy->wl_shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
313 +      wl_shm_add_listener(shmdpy->wl_shm, &shm_listener, shmdpy);
314 +   }
315 +}
316 +
317 +static const struct wl_registry_listener registry_listener = {
318 +       registry_handle_global
319 +};
320 +
321  static boolean
322  wayland_shm_display_init_screen(struct native_display *ndpy)
323  {
324     struct wayland_shm_display *shmdpy = wayland_shm_display(ndpy);
325     struct sw_winsys *winsys = NULL;
326 -   uint32_t id;
327  
328 -   id = wl_display_get_global(shmdpy->base.dpy, "wl_shm", 1);
329 -   if (id == 0)
330 -      wl_display_iterate(shmdpy->base.dpy, WL_DISPLAY_READABLE);
331 -   id = wl_display_get_global(shmdpy->base.dpy, "wl_shm", 1);
332 -   if (id == 0)
333 +   shmdpy->base.queue = wl_display_create_queue(shmdpy->base.dpy);
334 +   shmdpy->base.registry = wl_display_get_registry(shmdpy->base.dpy);
335 +   wl_proxy_set_queue((struct wl_proxy *) shmdpy->base.registry,
336 +                      shmdpy->base.queue);
337 +   wl_registry_add_listener(shmdpy->base.registry, &registry_listener, shmdpy);
338 +   if (wayland_roundtrip(&shmdpy->base) < 0 || shmdpy->wl_shm == NULL)
339        return FALSE;
340  
341 -   shmdpy->wl_shm = wl_display_bind(shmdpy->base.dpy, id, &wl_shm_interface);
342 -   if (!shmdpy->wl_shm)
343 -      return FALSE;
344 -
345 -   wl_shm_add_listener(shmdpy->wl_shm, &shm_listener, shmdpy);
346 -
347     if (shmdpy->base.formats == 0)
348        wl_display_roundtrip(shmdpy->base.dpy);
349     if (shmdpy->base.formats == 0)
350 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
351 index a7f9cb7..635b65f 100644
352 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
353 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
354 @@ -35,6 +35,34 @@
355  
356  #include "native_wayland.h"
357  
358 +static void
359 +sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
360 +{
361 +   int *done = data;
362 +
363 +   *done = 1;
364 +   wl_callback_destroy(callback);
365 +}
366 +
367 +static const struct wl_callback_listener sync_listener = {
368 +   sync_callback
369 +};
370 +
371 +int
372 +wayland_roundtrip(struct wayland_display *display)
373 +{
374 +   struct wl_callback *callback;
375 +   int done = 0, ret = 0;
376 +
377 +   callback = wl_display_sync(display->dpy);
378 +   wl_callback_add_listener(callback, &sync_listener, &done);
379 +   wl_proxy_set_queue((struct wl_proxy *) callback, display->queue);
380 +   while (ret == 0 && !done)
381 +      ret = wl_display_dispatch_queue(display->dpy, display->queue);
382 +
383 +   return ret;
384 +}
385 +
386  static const struct native_event_handler *wayland_event_handler;
387  
388  const static struct {
389 @@ -93,7 +121,6 @@ static int
390  wayland_display_get_param(struct native_display *ndpy,
391                            enum native_param_type param)
392  {
393 -   struct wayland_display *display = wayland_display(ndpy);
394     int val;
395  
396     switch (param) {
397 @@ -188,7 +215,7 @@ wayland_window_surface_handle_resize(struct wayland_surface *surface)
398                                   surface->win->width, surface->win->height)) {
399  
400        if (surface->pending_resource)
401 -         wl_display_roundtrip(display->dpy);
402 +         wayland_roundtrip(display);
403  
404        if (front_resource) {
405           struct wl_callback *callback;
406 @@ -198,6 +225,7 @@ wayland_window_surface_handle_resize(struct wayland_surface *surface)
407  
408           callback = wl_display_sync(display->dpy);
409           wl_callback_add_listener(callback, &release_buffer_listener, surface);
410 +         wl_proxy_set_queue((struct wl_proxy *) callback, display->queue);
411        }
412  
413        for (i = 0; i < WL_BUFFER_COUNT; ++i) {
414 @@ -245,7 +273,7 @@ wayland_frame_callback(void *data, struct wl_callback *callback, uint32_t time)
415  {
416     struct wayland_surface *surface = data;
417  
418 -   surface->block_swap_buffers = FALSE;
419 +   surface->frame_callback = NULL;
420  
421     wl_callback_destroy(callback);
422  }
423 @@ -269,15 +297,17 @@ wayland_surface_swap_buffers(struct native_surface *nsurf)
424  {
425     struct wayland_surface *surface = wayland_surface(nsurf);
426     struct wayland_display *display = surface->display;
427 -   struct wl_callback *callback;
428 -
429 -   while (surface->block_swap_buffers)
430 -      wl_display_iterate(display->dpy, WL_DISPLAY_READABLE);
431 +   int ret = 0;
432  
433 -   surface->block_swap_buffers = TRUE;
434 +   while (surface->frame_callback && ret != -1)
435 +      ret = wl_display_dispatch_queue(display->dpy, display->queue);
436 +   if (ret == -1)
437 +      return EGL_FALSE;
438  
439 -   callback = wl_surface_frame(surface->win->surface);
440 -   wl_callback_add_listener(callback, &frame_listener, surface);
441 +   surface->frame_callback = wl_surface_frame(surface->win->surface);
442 +   wl_callback_add_listener(surface->frame_callback, &frame_listener, surface);
443 +   wl_proxy_set_queue((struct wl_proxy *) surface->frame_callback,
444 +                      display->queue);
445  
446     if (surface->type == WL_WINDOW_SURFACE) {
447        resource_surface_swap_buffers(surface->rsurf,
448 @@ -349,6 +379,7 @@ wayland_surface_present(struct native_surface *nsurf,
449     if (surface->type == WL_WINDOW_SURFACE) {
450        resource_surface_get_size(surface->rsurf, &width, &height);
451        wl_surface_damage(surface->win->surface, 0, 0, width, height);
452 +      wl_surface_commit(surface->win->surface);
453     }
454  
455     return ret;
456 @@ -452,7 +483,7 @@ wayland_create_window_surface(struct native_display *ndpy,
457     surface->win = (struct wl_egl_window *) win;
458  
459     surface->pending_resource = NULL;
460 -   surface->block_swap_buffers = FALSE;
461 +   surface->frame_callback = NULL;
462     surface->type = WL_WINDOW_SURFACE;
463  
464     surface->buffer[WL_BUFFER_FRONT] = NULL;
465 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h b/src/gallium/state_trackers/egl/wayland/native_wayland.h
466 index e6a914f..268b3b7 100644
467 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
468 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
469 @@ -45,6 +45,8 @@ struct wayland_display {
470     struct native_display base;
471  
472     struct wl_display *dpy;
473 +   struct wl_event_queue *queue;
474 +   struct wl_registry *registry;
475     boolean own_dpy;
476     /* supported formats */
477     uint32_t formats;
478 @@ -85,7 +87,7 @@ struct wayland_surface {
479     struct wl_buffer *buffer[WL_BUFFER_COUNT];
480     unsigned int attachment_mask;
481  
482 -   boolean block_swap_buffers;
483 +   struct wl_callback *frame_callback;
484     boolean premultiplied_alpha;
485  };
486  
487 @@ -119,4 +121,7 @@ struct wayland_display *
488  wayland_create_drm_display(struct wl_display *display,
489                             const struct native_event_handler *event_handler);
490  
491 +int
492 +wayland_roundtrip(struct wayland_display *drmdpy);
493 +
494  #endif /* _NATIVE_WAYLAND_H_ */
495 --
496 cgit v0.9.0.2-2-gbebe
497 From e20a0f14b5fdbff9afa5d0d6ee35de8728f6a200 Mon Sep 17 00:00:00 2001
498 From: Kristian Høgsberg <krh@bitplanet.net>
499 Date: Tue, 16 Oct 2012 18:30:53 +0000
500 Subject: wayland: Drop support for ill-defined, unused wl_egl_pixmap
501
502 It doesn't provide the cross-process buffer sharing that a window system
503 pixmap could otherwise support and we don't have anything left that uses
504 this type of surface.
505 ---
506 diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
507 index 089a5d7..9153ef9 100644
508 --- a/src/egl/drivers/dri2/platform_wayland.c
509 +++ b/src/egl/drivers/dri2/platform_wayland.c
510 @@ -108,7 +108,6 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
511     struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
512     struct dri2_egl_config *dri2_conf = dri2_egl_config(conf);
513     struct dri2_egl_surface *dri2_surf;
514 -   struct dri2_egl_buffer *dri2_buf;
515     int i;
516  
517     (void) drv;
518 @@ -146,17 +145,6 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
519        dri2_surf->base.Width =  -1;
520        dri2_surf->base.Height = -1;
521        break;
522 -   case EGL_PIXMAP_BIT:
523 -      dri2_surf->wl_pix = (struct wl_egl_pixmap *) window;
524 -
525 -      dri2_surf->base.Width  = dri2_surf->wl_pix->width;
526 -      dri2_surf->base.Height = dri2_surf->wl_pix->height;
527 -
528 -      if (dri2_surf->wl_pix->driver_private) {
529 -         dri2_buf = dri2_surf->wl_pix->driver_private;
530 -         dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT] = dri2_buf->dri_buffer;
531 -      }
532 -      break;
533     default: 
534        goto cleanup_surf;
535     }
536 @@ -194,15 +182,6 @@ dri2_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
537                               window, attrib_list);
538  }
539  
540 -static _EGLSurface *
541 -dri2_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
542 -                          _EGLConfig *conf, EGLNativePixmapType pixmap,
543 -                          const EGLint *attrib_list)
544 -{
545 -   return dri2_create_surface(drv, disp, EGL_PIXMAP_BIT, conf,
546 -                             pixmap, attrib_list);
547 -}
548 -
549  /**
550   * Called via eglDestroySurface(), drv->API.DestroySurface().
551   */
552 @@ -225,8 +204,7 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
553           wl_buffer_destroy(dri2_surf->wl_drm_buffer[i]);
554  
555     for (i = 0; i < __DRI_BUFFER_COUNT; ++i)
556 -      if (dri2_surf->dri_buffers[i] && !(i == __DRI_BUFFER_FRONT_LEFT &&
557 -          dri2_surf->base.Type == EGL_PIXMAP_BIT))
558 +      if (dri2_surf->dri_buffers[i])
559           dri2_dpy->dri2->releaseBuffer(dri2_dpy->dri_screen,
560                                         dri2_surf->dri_buffers[i]);
561  
562 @@ -240,22 +218,6 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf)
563     return EGL_TRUE;
564  }
565  
566 -static void
567 -dri2_wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
568 -{
569 -   struct dri2_egl_buffer *dri2_buf = egl_pixmap->driver_private;
570 -
571 -   assert(dri2_buf);
572 -
573 -   dri2_buf->dri2_dpy->dri2->releaseBuffer(dri2_buf->dri2_dpy->dri_screen,
574 -                                           dri2_buf->dri_buffer);
575 -
576 -   free(dri2_buf);
577 -   
578 -   egl_pixmap->driver_private = NULL;
579 -   egl_pixmap->destroy = NULL;
580 -}
581 -
582  static struct wl_buffer *
583  wayland_create_buffer(struct dri2_egl_surface *dri2_surf,
584                        __DRIbuffer *buffer)
585 @@ -296,30 +258,6 @@ dri2_process_back_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
586  }
587  
588  static void
589 -dri2_process_front_buffer(struct dri2_egl_surface *dri2_surf, unsigned format)
590 -{
591 -   struct dri2_egl_display *dri2_dpy =
592 -      dri2_egl_display(dri2_surf->base.Resource.Display);
593 -   struct dri2_egl_buffer *dri2_buf;
594 -
595 -   switch (dri2_surf->base.Type) {
596 -   case EGL_PIXMAP_BIT:
597 -      dri2_buf = malloc(sizeof *dri2_buf);
598 -      if (!dri2_buf)
599 -         return;
600 -
601 -      dri2_buf->dri_buffer = dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT];
602 -      dri2_buf->dri2_dpy   = dri2_dpy;
603 -
604 -      dri2_surf->wl_pix->driver_private = dri2_buf;
605 -      dri2_surf->wl_pix->destroy        = dri2_wl_egl_pixmap_destroy;
606 -      break;
607 -   default:
608 -      break;
609 -   }
610 -}
611 -
612 -static void
613  dri2_release_pending_buffer(void *data,
614                             struct wl_callback *callback, uint32_t time)
615  {
616 @@ -496,9 +434,7 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
617           if (!dri2_surf->dri_buffers[attachments[i]]) 
618              continue;
619  
620 -         if (attachments[i] == __DRI_BUFFER_FRONT_LEFT)
621 -            dri2_process_front_buffer(dri2_surf, attachments[i+1]);
622 -         else if (attachments[i] == __DRI_BUFFER_BACK_LEFT)
623 +         if (attachments[i] == __DRI_BUFFER_BACK_LEFT)
624              dri2_process_back_buffer(dri2_surf, attachments[i+1]);
625        }
626  
627 @@ -509,13 +445,7 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
628        dri2_surf->buffer_count++;
629     }
630  
631 -   assert(dri2_surf->base.Type == EGL_PIXMAP_BIT ||
632 -          dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
633 -
634 -   if (dri2_surf->base.Type == EGL_PIXMAP_BIT && !dri2_surf->wl_pix->buffer)
635 -      dri2_surf->wl_pix->buffer =
636 -         wayland_create_buffer(dri2_surf,
637 -                              dri2_surf->dri_buffers[__DRI_BUFFER_FRONT_LEFT]);
638 +   assert(dri2_surf->dri_buffers[__DRI_BUFFER_BACK_LEFT]);
639  
640     *out_count = dri2_surf->buffer_count;
641     if (dri2_surf->buffer_count == 0)
642 @@ -659,71 +589,6 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
643     return EGL_TRUE;
644  }
645  
646 -/**
647 - * Called via eglCreateImageKHR(), drv->API.CreateImageKHR().
648 - */
649 -static _EGLImage *
650 -dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
651 -                            EGLClientBuffer buffer, const EGLint *attr_list)
652 -{
653 -   struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
654 -   struct wl_egl_pixmap *wl_egl_pixmap = (struct wl_egl_pixmap *) buffer;
655 -   struct dri2_egl_buffer *dri2_buf;
656 -   EGLint wl_attr_list[] = {
657 -               EGL_WIDTH,              0,
658 -               EGL_HEIGHT,             0,
659 -               EGL_DRM_BUFFER_STRIDE_MESA,     0,
660 -               EGL_DRM_BUFFER_FORMAT_MESA,     EGL_DRM_BUFFER_FORMAT_ARGB32_MESA,
661 -               EGL_NONE
662 -   };
663 -
664 -   dri2_buf = malloc(sizeof *dri2_buf);
665 -   if (!dri2_buf)
666 -           return NULL;
667 -
668 -   dri2_buf->dri2_dpy = dri2_dpy;
669 -   dri2_buf->dri_buffer =
670 -      dri2_dpy->dri2->allocateBuffer(dri2_dpy->dri_screen,
671 -                                    __DRI_BUFFER_FRONT_LEFT, 32,
672 -                                    wl_egl_pixmap->width,
673 -                                    wl_egl_pixmap->height);
674 -
675 -   wl_egl_pixmap->destroy = dri2_wl_egl_pixmap_destroy;
676 -   wl_egl_pixmap->driver_private = dri2_buf;
677 -
678 -   /* FIXME: Get buffer format from attr_list somehow... or from the
679 -      wl_egl_piaxmap.  */
680 -   wl_egl_pixmap->buffer =
681 -      wl_drm_create_buffer(dri2_dpy->wl_drm,
682 -                          dri2_buf->dri_buffer->name,
683 -                          wl_egl_pixmap->width,
684 -                          wl_egl_pixmap->height,
685 -                          dri2_buf->dri_buffer->pitch,
686 -                          WL_DRM_FORMAT_ARGB8888);
687 -
688 -   wl_attr_list[1] = wl_egl_pixmap->width;
689 -   wl_attr_list[3] = wl_egl_pixmap->height;
690 -   wl_attr_list[5] = dri2_buf->dri_buffer->pitch / 4;
691 -
692 -   return dri2_create_image_khr(disp->Driver, disp, ctx, EGL_DRM_BUFFER_MESA,
693 -       (EGLClientBuffer)(intptr_t) dri2_buf->dri_buffer->name, wl_attr_list);
694 -}
695 -
696 -static _EGLImage *
697 -dri2_wayland_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp,
698 -                             _EGLContext *ctx, EGLenum target,
699 -                             EGLClientBuffer buffer, const EGLint *attr_list)
700 -{
701 -   (void) drv;
702 -
703 -   switch (target) {
704 -   case EGL_NATIVE_PIXMAP_KHR:
705 -      return dri2_create_image_khr_pixmap(disp, ctx, buffer, attr_list);
706 -   default:
707 -      return dri2_create_image_khr(drv, disp, ctx, target, buffer, attr_list);
708 -   }
709 -}
710 -
711  static int
712  dri2_wayland_authenticate(_EGLDisplay *disp, uint32_t id)
713  {
714 @@ -858,10 +723,8 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
715     static const unsigned int rgb_masks[4] = { 0xff0000, 0xff00, 0xff, 0 };
716  
717     drv->API.CreateWindowSurface = dri2_create_window_surface;
718 -   drv->API.CreatePixmapSurface = dri2_create_pixmap_surface;
719     drv->API.DestroySurface = dri2_destroy_surface;
720     drv->API.SwapBuffers = dri2_swap_buffers;
721 -   drv->API.CreateImageKHR = dri2_wayland_create_image_khr;
722     drv->API.Terminate = dri2_terminate;
723  
724     dri2_dpy = calloc(1, sizeof *dri2_dpy);
725 @@ -917,7 +780,7 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
726     if (!dri2_create_screen(disp))
727        goto cleanup_driver;
728  
729 -   types = EGL_WINDOW_BIT | EGL_PIXMAP_BIT;
730 +   types = EGL_WINDOW_BIT;
731     for (i = 0; dri2_dpy->driver_configs[i]; i++) {
732        config = dri2_dpy->driver_configs[i];
733        if (dri2_dpy->formats & HAS_XRGB8888)
734 @@ -926,8 +789,6 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
735          dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
736     }
737  
738 -   disp->Extensions.KHR_image_pixmap = EGL_TRUE;
739 -
740     disp->Extensions.WL_bind_wayland_display = EGL_TRUE;
741     dri2_dpy->authenticate = dri2_wayland_authenticate;
742  
743 diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
744 index accd2dd..bdbf32a 100644
745 --- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h
746 +++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h
747 @@ -26,17 +26,6 @@ struct wl_egl_window {
748         int attached_height;
749  };
750  
751 -struct wl_egl_pixmap {
752 -       struct wl_buffer *buffer;
753 -
754 -       int width;
755 -       int height;
756 -
757 -       void (*destroy) (struct wl_egl_pixmap *egl_pixmap);
758 -
759 -       void *driver_private;
760 -};
761 -
762  #ifdef  __cplusplus
763  }
764  #endif
765 diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c
766 index e950b4a..c61fb4f 100644
767 --- a/src/egl/wayland/wayland-egl/wayland-egl.c
768 +++ b/src/egl/wayland/wayland-egl/wayland-egl.c
769 @@ -48,36 +48,3 @@ wl_egl_window_get_attached_size(struct wl_egl_window *egl_window,
770         if (height)
771                 *height = egl_window->attached_height;
772  }
773 -
774 -WL_EGL_EXPORT struct wl_egl_pixmap *
775 -wl_egl_pixmap_create(int width, int height, uint32_t flags)
776 -{
777 -       struct wl_egl_pixmap *egl_pixmap;
778 -
779 -       egl_pixmap = malloc(sizeof *egl_pixmap);
780 -       if (egl_pixmap == NULL)
781 -               return NULL;
782 -
783 -       egl_pixmap->width   = width;
784 -       egl_pixmap->height  = height;
785 -
786 -       egl_pixmap->destroy = NULL;
787 -       egl_pixmap->buffer  = NULL;
788 -       egl_pixmap->driver_private = NULL;
789 -
790 -       return egl_pixmap;
791 -}
792 -
793 -WL_EGL_EXPORT void
794 -wl_egl_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
795 -{
796 -       if (egl_pixmap->destroy)
797 -               egl_pixmap->destroy(egl_pixmap);
798 -       free(egl_pixmap);
799 -}
800 -
801 -WL_EGL_EXPORT struct wl_buffer *
802 -wl_egl_pixmap_create_buffer(struct wl_egl_pixmap *egl_pixmap)
803 -{
804 -       return egl_pixmap->buffer;
805 -}
806 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
807 index 635b65f..62c87f3 100644
808 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
809 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
810 @@ -99,7 +99,6 @@ wayland_display_get_configs(struct native_display *ndpy, int *num_configs)
811              (1 << NATIVE_ATTACHMENT_BACK_LEFT);
812           
813           nconf->window_bit = TRUE;
814 -         nconf->pixmap_bit = TRUE;
815           
816           nconf->color_format = wayland_formats[i].format;
817           display->num_configs++;
818 @@ -138,49 +137,6 @@ wayland_display_get_param(struct native_display *ndpy,
819     return val;
820  }
821  
822 -static boolean
823 -wayland_display_get_pixmap_format(struct native_display *ndpy,
824 -                                  EGLNativePixmapType pix,
825 -                                  enum pipe_format *format)
826 -{
827 -   /* all wl_egl_pixmaps are supported */
828 -   *format = PIPE_FORMAT_NONE;
829 -
830 -   return TRUE;
831 -}
832 -
833 -static void
834 -wayland_pixmap_destroy(struct wl_egl_pixmap *egl_pixmap)
835 -{
836 -   struct pipe_resource *resource = egl_pixmap->driver_private;
837 -
838 -   assert(resource);
839 -
840 -   pipe_resource_reference(&resource, NULL);
841 -   if (egl_pixmap->buffer) {
842 -      wl_buffer_destroy(egl_pixmap->buffer);
843 -      egl_pixmap->buffer = NULL;
844 -   }
845 -
846 -   egl_pixmap->driver_private = NULL;
847 -   egl_pixmap->destroy = NULL;
848 -}
849 -
850 -static void
851 -wayland_pixmap_surface_initialize(struct wayland_surface *surface)
852 -{
853 -   struct wayland_display *display = wayland_display(&surface->display->base);
854 -   const enum native_attachment front_natt = NATIVE_ATTACHMENT_FRONT_LEFT;
855 -
856 -   if (surface->pix->buffer != NULL)
857 -      return;
858 -
859 -   surface->pix->buffer  = display->create_buffer(display, surface, front_natt);
860 -   surface->pix->destroy = wayland_pixmap_destroy;
861 -   surface->pix->driver_private =
862 -      resource_surface_get_single_resource(surface->rsurf, front_natt);
863 -}
864 -
865  static void
866  wayland_release_pending_resource(void *data,
867                                   struct wl_callback *callback,
868 @@ -262,9 +218,6 @@ wayland_surface_validate(struct native_surface *nsurf, uint attachment_mask,
869  
870     resource_surface_get_size(surface->rsurf, (uint *) width, (uint *) height);
871  
872 -   if (surface->type == WL_PIXMAP_SURFACE)
873 -      wayland_pixmap_surface_initialize(surface);
874 -
875     return TRUE;
876  }
877  
878 @@ -407,61 +360,6 @@ wayland_surface_destroy(struct native_surface *nsurf)
879  }
880  
881  
882 -
883 -static struct native_surface *
884 -wayland_create_pixmap_surface(struct native_display *ndpy,
885 -                              EGLNativePixmapType pix,
886 -                              const struct native_config *nconf)
887 -{
888 -   struct wayland_display *display = wayland_display(ndpy);
889 -   struct wayland_surface *surface;
890 -   struct wl_egl_pixmap *egl_pixmap = (struct wl_egl_pixmap *) pix;
891 -   enum native_attachment natt = NATIVE_ATTACHMENT_FRONT_LEFT;
892 -   uint bind = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW |
893 -      PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT;
894 -
895 -   surface = CALLOC_STRUCT(wayland_surface);
896 -   if (!surface)
897 -      return NULL;
898 -
899 -   surface->display = display;
900 -
901 -   surface->pending_resource = NULL;
902 -   surface->type = WL_PIXMAP_SURFACE;
903 -   surface->pix = egl_pixmap;
904 -
905 -   if (nconf)
906 -      surface->color_format = nconf->color_format;
907 -   else /* FIXME: derive format from wl_visual */
908 -      surface->color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
909 -
910 -   surface->attachment_mask = (1 << NATIVE_ATTACHMENT_FRONT_LEFT);
911 -
912 -   surface->rsurf = resource_surface_create(display->base.screen,
913 -                                            surface->color_format, bind);
914 -
915 -   if (!surface->rsurf) {
916 -      FREE(surface);
917 -      return NULL;
918 -   }
919 -
920 -   resource_surface_set_size(surface->rsurf,
921 -                             egl_pixmap->width, egl_pixmap->height);
922 -
923 -   /* the pixmap is already allocated, so import it */
924 -   if (surface->pix->buffer != NULL)
925 -      resource_surface_import_resource(surface->rsurf, natt,
926 -                                       surface->pix->driver_private);
927 -
928 -   surface->base.destroy = wayland_surface_destroy;
929 -   surface->base.present = wayland_surface_present;
930 -   surface->base.validate = wayland_surface_validate;
931 -   surface->base.wait = wayland_surface_wait;
932 -
933 -   return &surface->base;
934 -}
935 -
936 -
937  static struct native_surface *
938  wayland_create_window_surface(struct native_display *ndpy,
939                                EGLNativeWindowType win,
940 @@ -536,10 +434,7 @@ native_create_display(void *dpy, boolean use_sw)
941  
942     display->base.get_param = wayland_display_get_param;
943     display->base.get_configs = wayland_display_get_configs;
944 -   display->base.get_pixmap_format = wayland_display_get_pixmap_format;
945 -   display->base.copy_to_pixmap = native_display_copy_to_pixmap;
946     display->base.create_window_surface = wayland_create_window_surface;
947 -   display->base.create_pixmap_surface = wayland_create_pixmap_surface;
948  
949     display->own_dpy = own_dpy;
950  
951 diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h b/src/gallium/state_trackers/egl/wayland/native_wayland.h
952 index 268b3b7..b623fee 100644
953 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
954 +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
955 @@ -67,7 +67,6 @@ enum wayland_buffer_type {
956  
957  enum wayland_surface_type {
958     WL_WINDOW_SURFACE,
959 -   WL_PIXMAP_SURFACE,
960     WL_PBUFFER_SURFACE
961  };
962  
963 @@ -76,7 +75,6 @@ struct wayland_surface {
964     struct wayland_display *display;
965  
966     struct wl_egl_window *win;
967 -   struct wl_egl_pixmap *pix;
968     enum wayland_surface_type type;
969     int dx, dy;
970     struct resource_surface *rsurf;
971 --
972 cgit v0.9.0.2-2-gbebe
This page took 0.104316 seconds and 3 git commands to generate.