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.
dev
Scott Moreau 12 years ago committed by Kristian Høgsberg
parent 6a615d2621
commit 7e300dbc58
  1. 5
      clients/simple-egl.c

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

Loading…
Cancel
Save