Recursive call of wl_display_iterate via frame callback

Fiedler, Mathias Mathias.Fiedler at
Tue Jun 21 07:15:14 PDT 2011


while playing around with wayland and the simple-client demo (using EGL) i ran into issues where simple-client were caught in an endless loop in wl_display_iterate. The issue seems to be a recursive call of wl_display_iterate.

The simple-client registers redraw() as a callback function to key event. This function gets called during wl_display_iterate when corresponding key event arrives. The redraw function itself calls eglSwapBuffers. Since eglSwapBuffers() might need to synchronize with the compositor, it might also call wl_display_iterate.
   -> handle_event
      -> wl_closure_invoke
         -> display_handle_key
            -> redraw
               -> eglSwapBuffers
                  -> wl_display_iterate

As long as the key event is the last message in input buffer the while loop in the former call to wl_display_iterate will terminate. But if another message is pending this message will be processed by the latter call to wl_display_iterate and the local variable len in former call to wl_display_iterate won't decrement to zero.

Is this a bug, or did i miss something?
What should be the correct usage of wl_display_frame_callback() and wl_display_iterate()?

Best Regards,

XS Embedded GmbH
Roggenbachstr. 6
D-78050 Villingen - Schwenningen

Telefon +49 (7721) 4060 - 436
Fax     +49 (7721) 4060 - 499
Mathias.Fiedler at

:::::::::: based.on.visions ::::::::::

XS Embedded GmbH
Gesch?ftsf?hrung: Michael Maier, Rainer Oder

Handelsregister: Amtsgericht Freiburg i.Br., HRB 705237
Sitz der Gesellschaft: Roggenbachstrasse 6, 78050 Villingen-Schwenningen
USt-Id Nummer: DE268786819

Confidentiality Notice: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.

More information about the wayland-devel mailing list