egl/wayland: Dispatch the event queue before get_buffers
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Thu, 22 Nov 2012 13:34:49 +0000 (15:34 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Fri, 30 Nov 2012 22:05:50 +0000 (17:05 -0500)
When a client frame callback is executed and the client starts rendering
again, the egl event queue might not have been dispatched so that the
buffer release event for the previous frame hasn't been processed. In
that case a third buffer is allocated, even though it would be possible
to reuse the buffer that was just released.

The wl_display_dispatch_queue_pending() entry point is available from
wayland-client 1.0.2, so require that in configure.ac.  Also, just
let the pkg-config macro throw its own error, which will show what version
we were looking for and failed to find.

Note: This is a candidate for stable branches.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
configure.ac
src/egl/drivers/dri2/platform_wayland.c

index fc554dd4c03cb0cf1e2f5dd15e8f0cfa6122da6b..803c2564942db208bc330db823d605bb44e3e287 100644 (file)
@@ -1530,8 +1530,7 @@ for plat in $egl_platforms; do
                ;;
 
        wayland)
-               PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 0.99.0 wayland-server >= 0.99.0],, \
-                                 [AC_MSG_ERROR([cannot find libwayland-client])])
+               PKG_CHECK_MODULES([WAYLAND], [wayland-client >= 1.0.2 wayland-server >= 1.0.2])
                GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/wayland"
 
                 WAYLAND_PREFIX=`$PKG_CONFIG --variable=prefix wayland-client`
index 7c1aa945837984e5df460f4c21b878c288a30a3e..ba54286b7bc58734a7c47165a132cc99b440ab66 100644 (file)
@@ -420,6 +420,9 @@ dri2_get_buffers_with_format(__DRIdrawable * driDrawable,
       dri2_egl_display(dri2_surf->base.Resource.Display);
    int i;
 
+   /* There might be a buffer release already queued that wasn't processed */
+   wl_display_dispatch_queue_pending(dri2_dpy->wl_dpy, dri2_dpy->wl_queue);
+
    if (dri2_surf->base.Type == EGL_WINDOW_BIT &&
        (dri2_surf->base.Width != dri2_surf->wl_win->width || 
         dri2_surf->base.Height != dri2_surf->wl_win->height)) {