Re: [PATCH xserver 4/4] xwayland: sync event queue to check compositor reply

2016-03-09 Thread Olivier Fourdan
- Original Message -
> - Original Message -
> > Read and dispatch pending Wayland events to make sure we do nto miss a
> > possible reply from the compositor prior to discard a key repeat.
> > 
> > Signed-off-by: Olivier Fourdan 
> > ---
> >  hw/xwayland/xwayland-input.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
> > index 28d8b54..89f6faf 100644
> > --- a/hw/xwayland/xwayland-input.c
> > +++ b/hw/xwayland/xwayland-input.c
> > @@ -546,6 +546,9 @@ keyboard_check_repeat (DeviceIntPtr dev, XkbSrvInfoPtr
> > xkbi, unsigned key)
> >  struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
> >  struct wl_callback *callback;
> >  
> > +/* Make sure we didn't miss a possible reply from the compositor */
> > +xwl_sync_events (xwl_screen);
> > +
> 
> Unfortunately it still cause a deadlock apprently:
> 
> #0  0x7fab4b6f93a0 in pthread_cond_wait@@GLIBC_2.3.2 () from
> /lib64/libpthread.so.0
> #1  0x7fab4df3249b in read_events (display=0x17f7b80) at
> src/wayland-client.c:1326
> #2  wl_display_read_events (display=0x17f7b80) at src/wayland-client.c:1396
> #3  0x00423e34 in xwl_read_events (xwl_screen=,
> xwl_screen=) at xwayland.c:465
> #4  0x00424adf in xwl_sync_events
> (xwl_screen=xwl_screen@entry=0x17f7910) at xwayland.c:524
> #5  0x00424e15 in keyboard_check_repeat (dev=,
> xkbi=, key=) at xwayland-input.c:536
> #6  0x00525417 in AccessXRepeatKeyExpire (timer=,
> now=, arg=0x22c61f0) at xkbAccessX.c:321
> #7  0x0058b6c3 in DoTimer (timer=0x2923510, now=now@entry=3317763,
> prev=prev@entry=0x81f6f8 ) at WaitFor.c:420
> #8  0x0058c36a in WaitForSomething
> (pClientsReady=pClientsReady@entry=0x17efab0) at WaitFor.c:291
> #9  0x005572ee in Dispatch () at dispatch.c:359
> #10 0x0055b503 in dix_main (argc=10, argv=0x7ffca1cbd528,
> envp=) at main.c:300
> #11 0x7fab4bfaa0c1 in __libc_start_main () from /lib64/libc.so.6
> #12 0x00423599 in _start ()
> 
> And that will freeze both the Xwayland server and the compositor, so not
> good.

That is actually fixed with v2 of the patch #3 (ie call prepare_read() before 
read() to avoid the deadlock as Pekka pointed out on irc).

Cheers,
Olivier
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 4/4] xwayland: sync event queue to check compositor reply

2016-03-09 Thread Olivier Fourdan
- Original Message -
> Read and dispatch pending Wayland events to make sure we do nto miss a
> possible reply from the compositor prior to discard a key repeat.
> 
> Signed-off-by: Olivier Fourdan 
> ---
>  hw/xwayland/xwayland-input.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
> index 28d8b54..89f6faf 100644
> --- a/hw/xwayland/xwayland-input.c
> +++ b/hw/xwayland/xwayland-input.c
> @@ -546,6 +546,9 @@ keyboard_check_repeat (DeviceIntPtr dev, XkbSrvInfoPtr
> xkbi, unsigned key)
>  struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
>  struct wl_callback *callback;
>  
> +/* Make sure we didn't miss a possible reply from the compositor */
> +xwl_sync_events (xwl_screen);
> +

Unfortunately it still cause a deadlock apprently:

#0  0x7fab4b6f93a0 in pthread_cond_wait@@GLIBC_2.3.2 () from 
/lib64/libpthread.so.0
#1  0x7fab4df3249b in read_events (display=0x17f7b80) at 
src/wayland-client.c:1326
#2  wl_display_read_events (display=0x17f7b80) at src/wayland-client.c:1396
#3  0x00423e34 in xwl_read_events (xwl_screen=, 
xwl_screen=) at xwayland.c:465
#4  0x00424adf in xwl_sync_events 
(xwl_screen=xwl_screen@entry=0x17f7910) at xwayland.c:524
#5  0x00424e15 in keyboard_check_repeat (dev=, 
xkbi=, key=) at xwayland-input.c:536
#6  0x00525417 in AccessXRepeatKeyExpire (timer=, 
now=, arg=0x22c61f0) at xkbAccessX.c:321
#7  0x0058b6c3 in DoTimer (timer=0x2923510, now=now@entry=3317763, 
prev=prev@entry=0x81f6f8 ) at WaitFor.c:420
#8  0x0058c36a in WaitForSomething 
(pClientsReady=pClientsReady@entry=0x17efab0) at WaitFor.c:291
#9  0x005572ee in Dispatch () at dispatch.c:359
#10 0x0055b503 in dix_main (argc=10, argv=0x7ffca1cbd528, 
envp=) at main.c:300
#11 0x7fab4bfaa0c1 in __libc_start_main () from /lib64/libc.so.6
#12 0x00423599 in _start ()

And that will freeze both the Xwayland server and the compositor, so not good.



>  if (!xwl_seat->sync_pending) {
>  callback = wl_display_sync (xwl_screen->display);
>  wl_callback_add_listener(callback, _listener, xwl_seat);
> --
> 2.5.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 4/4] xwayland: sync event queue to check compositor reply

2016-03-09 Thread Olivier Fourdan
Read and dispatch pending Wayland events to make sure we do nto miss a
possible reply from the compositor prior to discard a key repeat.

Signed-off-by: Olivier Fourdan 
---
 hw/xwayland/xwayland-input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 28d8b54..89f6faf 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -546,6 +546,9 @@ keyboard_check_repeat (DeviceIntPtr dev, XkbSrvInfoPtr 
xkbi, unsigned key)
 struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
 struct wl_callback *callback;
 
+/* Make sure we didn't miss a possible reply from the compositor */
+xwl_sync_events (xwl_screen);
+
 if (!xwl_seat->sync_pending) {
 callback = wl_display_sync (xwl_screen->display);
 wl_callback_add_listener(callback, _listener, xwl_seat);
-- 
2.5.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel