<div dir="ltr">Unfortunately the proposal with a separate queue does not work for the use case.<div>i added the wl_seat object to is own event queue but dispatching this queue blocks the egl rendering</div><div>currently we are still using wayland 1.05 so my hope is that with the wayland 1.3 and </div>
<div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">wl_display_prepare_read and wl_display_read_events api's i can solve this issue</span>:</div><div>so i maybe just repaid here my understanding how to use those api's in my input thread:</div>
<div><div style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">while(!quit)//main loop<br>{<br></div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"> while (wl_display_prepare_read(__</span><u style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"></u><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">dis</span><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">play) != 0)</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"> wl_display_dispatch_pending(__</span><u style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"></u><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">display);</span><div style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">
<br> wl_display_flush(display);<br> poll(fds, nfds, -1); //wait until new input event arrives<br></div><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"> wl_display_read_events(__</span><u style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"></u><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">displ</span><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">ay);</span><br style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">
<span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"> wl_display_dispatch_pending(__</span><u style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px"></u><span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">display);</span><div style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">
<br>}</div></div><div style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">would this sequence be correct?</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/22 Kristian Høgsberg <span dir="ltr"><<a href="mailto:hoegsberg@gmail.com" target="_blank">hoegsberg@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 Mon, Oct 21, 2013 at 11:32:58PM +0200, Eugen Friedrich wrote:<br>
> Hello Kristian,<br>
> I'm don't using mesa, we have a Vivante driver stack on imx6 which also<br>
> uses a proprietary wayland protocol to send a buffer to the compositor<br>
> and it's EGL implementation don't creates a separate event queue it uses<br>
> the main wayland display queue and will call wl_display_dispatch function.<br>
> But thanks for the hint, i suppose the current mesa implementation should<br>
> answer all my questions above.<br>
<br>
</div>That explains it. The separate event queue feature is generally<br>
useful, but it was prompted by the requirement to make EGL threading<br>
work right under Wayland. As such, the Vivante driver really should<br>
use it to make sure it doesn't inadvertently block on the main thread.<br>
In the mean time you can probably work around it by creating a<br>
separate event queue for everything else you do in your application.<br>
<span class="HOEnZb"><font color="#888888"><br>
Kristian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
> 2013/10/21 Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>><br>
><br>
> > On Sat, Oct 19, 2013 at 10:31 AM, Eugen Friedrich <<a href="mailto:friedrix@gmail.com">friedrix@gmail.com</a>><br>
> > wrote:<br>
> > > Ok! this sounds very promising this should decouple the rendering thread<br>
> > > and the input handling thread.<br>
> > > so i can set to the wl_seat client object a new queue and then pass this<br>
> > > queue to wl_display_dispatch_queue call in the input thread.<br>
> > ><br>
> > > but one question to this: the documentation of wl_display_dispatch_queue<br>
> > > says:<br>
> > > "For other threads this will block until the main thread queues events on<br>
> > > the queue passed as argument."<br>
> > ><br>
> > > So will pass the events in the queue or how to achieve this it the second<br>
> > > thread( rendering thread is sleeping)??<br>
> > ><br>
> > > In my use case the input thread should wake up when input event arrives<br>
> > from<br>
> > > the compositor also when all other thread of the client are idle.<br>
> ><br>
> > None of this should be necessary. The EGL implementation already uses<br>
> > its own queue (if your mesa is new enough) and should be able to loop<br>
> > all by itself without the main event queue being processed. You can<br>
> > still use a custom queue for your input events, but if you only care<br>
> > about separating EGL into a separate thread, you shouldn't need to do<br>
> > anything.<br>
> ><br>
> > Kristian<br>
> ><br>
> > > 2013/10/19 Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>><br>
> > >><br>
> > >> You can move a client-side wayland object to a queue using the function<br>
> > >> void wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue<br>
> > >> *queue).<br>
> > >> All the client-side objects are really wl_proxy, so you can safely cast<br>
> > >> them.<br>
> > >> If you move to a queue an object which creates new objects and<br>
> > >> dispatches them through<br>
> > >> an event those objects will be in the same queue too.<br>
> > >><br>
> > >><br>
> > >> 2013/10/18 Eugen Friedrich <<a href="mailto:friedrix@gmail.com">friedrix@gmail.com</a>>:<br>
> > >> > Hallo Giulio,<br>
> > >> > thanks a lot for the fast replay.<br>
> > >> ><br>
> > >> > if my understanding is correct the frame callbacks and the input<br>
> > >> > handling<br>
> > >> > events are coming from the compositor to the main wayland display<br>
> > queue<br>
> > >> > on<br>
> > >> > the client side.<br>
> > >> > So how i can get the different queues on the client site or is there a<br>
> > >> > possibility to get a separate queue for input events?<br>
> > >> ><br>
> > >> ><br>
> > >> > 2013/10/18 Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>><br>
> > >> >><br>
> > >> >> Oh, I sent my mail before the second one arrived.<br>
> > >> >><br>
> > >> >> Yeah, you need to use different wl_event_queues, and the relative<br>
> > >> >> functions like<br>
> > >> >> wl_display_dispatch_queue.<br>
> > >> >><br>
> > >> >> 2013/10/18 Giulio Camuffo <<a href="mailto:giuliocamuffo@gmail.com">giuliocamuffo@gmail.com</a>>:<br>
> > >> >> > And what is it that doesn't work? As a wild bet I'd say you<br>
> > probably<br>
> > >> >> > want to look at wl_event_queue.<br>
> > >> >> > See<br>
> > >> >> ><br>
> > >> >> ><br>
> > <a href="http://wayland.freedesktop.org/docs/html/chap-Library.html#sect-Library-Client" target="_blank">http://wayland.freedesktop.org/docs/html/chap-Library.html#sect-Library-Client</a><br>
> > >> >> ><br>
> > >> >> > Giulio<br>
> > >> >> ><br>
> > >> >> > 2013/10/18 Eugen Friedrich <<a href="mailto:friedrix@gmail.com">friedrix@gmail.com</a>>:<br>
> > >> >> >> Hallo dear Wayland developer,<br>
> > >> >> >><br>
> > >> >> >> I thing i have a very common use case and currently i don't now<br>
> > how<br>
> > >> >> >> to<br>
> > >> >> >> get<br>
> > >> >> >> it work in wayland.<br>
> > >> >> >><br>
> > >> >> >> We have a wayland client application with 2 threads:<br>
> > >> >> >><br>
> > >> >> >> thread1 - rendering thread - the eglSwapbuffer will call<br>
> > >> >> >> wl_display_dispatch internally:<br>
> > >> >> >> thread2 - input thread - this should wait for wayland input events<br>
> > >> >> >><br>
> > >> >> >><br>
> > >> >> >><br>
> > >> >> >> _______________________________________________<br>
> > >> >> >> wayland-devel mailing list<br>
> > >> >> >> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> > >> >> >> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
> > >> >> >><br>
> > >> ><br>
> > >> ><br>
> > ><br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > wayland-devel mailing list<br>
> > > <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> > > <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
> > ><br>
> ><br>
</div></div></blockquote></div><br></div>