<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/20 Bill Spitzak <span dir="ltr"><<a href="mailto:spitzak@gmail.com" target="_blank">spitzak@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 10/19/2013 10:03 AM, Eugen Friedrich wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Basically i would like to implement a thread(input thread) that should<br>
only dispatch incoming input events from wayland compositor when the<br>
rendering thread is idle and the input thread should sleep in wait for<br>
events function(i think poll on wl_display fd in the example above)<br>
without blocking the rendering thread, because the input events are not<br>
the only one trigger for rendering thread to start rendering again.<br>
in this case the following code should be sufficient right?<br>
<br>
while(!quit)//main loop<br>
{<br></div>
while (wl_display_prepare_read(__<u></u>display) != 0)<br>
wl_display_dispatch_pending(__<u></u>display);<div class="im"><br>
wl_display_flush(display);<br>
poll(fds, nfds, -1); //wait until new input event arrives<br></div>
wl_display_read_events(__<u></u>display);<br>
wl_display_dispatch_pending(__<u></u>display);<div class="im"><br>
}<br>
<br>
And in this case are there some additional modifications/ wayland calls<br>
in the egl (rendering thread) needed?<br>
</div></blockquote>
<br>
I'm not sure what you are getting at, but it sounds like in effect cooperative multitasking between this rendering thread and this thread. I think you are saying that the rendering thread will only operate when poll() is being called. I don't see any advantage of this over running a single thread that does the rendering just before calling poll(), which is what I was doing with the idle dispatch.<br>
<br></blockquote><div>The rendering thread can start rendering every time not only if poll is called. The job of the input handling thread is to dispatch input events if there is no rendering occurs. If the rendering thread is running the input events are dispatched by the wl_display_dispatch call inside of the eglSwapBuffers, but if the rendering stops (e.g. current animation is done) we need to dispatch the input events somewhere else -> this is the aim of the input thread. </div>
<div>So i'm trying to find a right way to do this without blocking the wayland display main queue, because rendering can be started also without any trigger from the input thread!!!</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also your above example can merge the wl_display_dispatch_pending calls like this:<br>
<br>
while(!quit)//main loop<br>
{<br>
do wl_display_dispatch_pending(__<u></u>display);<br>
while (wl_display_prepare_read(__<u></u>display) != 0);<div class="im"><br>
wl_display_flush(display);<br>
poll(fds, nfds, -1); //wait until new input event arrives<br></div>
wl_display_read_events(__<u></u>display);<br>
}<br>
<br>
If you move the wl_display_read_events up to the top with an if so it is not run the same time, you still have my wl_i_want_a_pony() function.<br>
<br>
What I am trying to find is if there ever is a reason to insert any client calls between all the functions I put in "wl_i_want_a_pony()".<br>
<br>
</blockquote></div><br></div></div>