simple-egl: Avoid race condition.

After explaining the problem on irc, Pekka dictated this solution which works.
The problem is that simple-egl can hang when toggling fullscreen because of a
race where (quoting Pekka) "if it dispatches the frame callback simple-egl
itself requested before the Mesa's own frame callback came, simple-egl will go
to its redraw routing and call eglSwapBuffers so you end up effectively calling
eglSwapBuffers from within eglSwapBuffers, and deadlock". This patch avoids
redrawing (which calls eglSwapBuffers) when there is a pending frame callback.
Scott Moreau 12 years ago committed by Kristian Høgsberg
parent 6a615d2621
commit 7e300dbc58
  1. 7
      clients/simple-egl.c

@ -262,7 +262,9 @@ configure_callback(void *data, struct wl_callback *callback, uint32_t time)
wl_callback_destroy(callback);
window->configured = 1;
redraw(data, NULL, time);
if (window->callback == NULL)
redraw(data, NULL, time);
}
static struct wl_callback_listener configure_callback_listener = {
@ -363,6 +365,9 @@ redraw(void *data, struct wl_callback *callback, uint32_t time)
static uint32_t start_time = 0;
struct wl_region *region;
assert(window->callback == callback);
window->callback = NULL;
if (callback)
wl_callback_destroy(callback);

Loading…
Cancel
Save