<div dir="ltr">Hi Eugen,<div class="gmail_extra"><br><div class="gmail_quote">On 27 July 2014 22:16, Eugen Friedrich <span dir="ltr"><<a href="mailto:friedrix@gmail.com" target="_blank">friedrix@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Daniel, <div><br><div>thanks, i understood we should add the <span style="font-family:arial,sans-serif;font-size:12.800000190734863px"><font color="#500050">wl_display_dispatch_pending </font><font color="#000000">call in the application</font></span></div>

<div><font face="arial, sans-serif" color="#000000">there is currently no way to avoid this and basically it does not harm.</font></div><div><font color="#000000" face="arial, sans-serif">I only wanted to understand if there is something missing.</font></div>
</div></div></blockquote><div><br></div><div>Doing that is not enough. Firstly, it requires the application to do this, or else EGL will break, which will make your stack appear broken with different applications. Secondly, as an application may do this in any thread, you could run into locking issues.</div>
<div><br></div><div>wl_display_sync() does the following (paraphrased):</div><div>  callback = wl_display_roundtrip(); /* creates wl_callback object on default queue */</div><div>  while (!callback_signalled)</div><div>      wl_display_dispatch(); /* dispatch default queue until callback processed */</div>
<div><br></div><div>This violates the rule that EGL must not intefere with the default queue - meaning that the wl_callback object _cannot_ be placed on the main queue.</div><div><br></div><div>In order to do this correctly, you will see Mesa does:</div>
<div>  callback = wl_display_roundtrip();</div><div>  wl_callback_set_queue(callback, internal_egl_queue);</div><div>  while (!callback_signalled)<br>      wl_display_dispatch_queue(internal_egl_queue);</div><div><br></div>
<div>As with all objects created by your EGL implementation, the wl_callback object must be moved to the queue immediately after it is created by wl_display_roundtrip(). Doing this will ensure correctness and also not require apps to be constantly dispatching the main queue. You can search the Mesa codebase for uses of wl_display_roundtrip() to find some examples of this pattern.</div>
<div><br></div><div>Again - any object created by your EGL implementation that is not immediately moved to your internal event queue is a bug.</div><div><br></div><div>Cheers,</div><div>Daniel </div></div></div></div>