| Message ID | 1457516030-29701-1-git-send-email-ofourdan@redhat.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
"RFC: Sync key repeat with Wayland compositor"
( rev:
6
)
in
X.org (DEPRECATED - USE GITLAB) |
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, &sync_listener, xwl_seat);
----- 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 <ofourdan@redhat.com> > --- > 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 0x00007fab4b6f93a0 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 #1 0x00007fab4df3249b 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 0x0000000000423e34 in xwl_read_events (xwl_screen=<optimized out>, xwl_screen=<optimized out>) at xwayland.c:465 #4 0x0000000000424adf in xwl_sync_events (xwl_screen=xwl_screen@entry=0x17f7910) at xwayland.c:524 #5 0x0000000000424e15 in keyboard_check_repeat (dev=<optimized out>, xkbi=<optimized out>, key=<optimized out>) at xwayland-input.c:536 #6 0x0000000000525417 in AccessXRepeatKeyExpire (timer=<optimized out>, now=<optimized out>, arg=0x22c61f0) at xkbAccessX.c:321 #7 0x000000000058b6c3 in DoTimer (timer=0x2923510, now=now@entry=3317763, prev=prev@entry=0x81f6f8 <timers>) at WaitFor.c:420 #8 0x000000000058c36a in WaitForSomething (pClientsReady=pClientsReady@entry=0x17efab0) at WaitFor.c:291 #9 0x00000000005572ee in Dispatch () at dispatch.c:359 #10 0x000000000055b503 in dix_main (argc=10, argv=0x7ffca1cbd528, envp=<optimized out>) at main.c:300 #11 0x00007fab4bfaa0c1 in __libc_start_main () from /lib64/libc.so.6 #12 0x0000000000423599 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, &sync_listener, xwl_seat); > -- > 2.5.0
----- 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 <ofourdan@redhat.com> > > --- > > 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 0x00007fab4b6f93a0 in pthread_cond_wait@@GLIBC_2.3.2 () from > /lib64/libpthread.so.0 > #1 0x00007fab4df3249b 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 0x0000000000423e34 in xwl_read_events (xwl_screen=<optimized out>, > xwl_screen=<optimized out>) at xwayland.c:465 > #4 0x0000000000424adf in xwl_sync_events > (xwl_screen=xwl_screen@entry=0x17f7910) at xwayland.c:524 > #5 0x0000000000424e15 in keyboard_check_repeat (dev=<optimized out>, > xkbi=<optimized out>, key=<optimized out>) at xwayland-input.c:536 > #6 0x0000000000525417 in AccessXRepeatKeyExpire (timer=<optimized out>, > now=<optimized out>, arg=0x22c61f0) at xkbAccessX.c:321 > #7 0x000000000058b6c3 in DoTimer (timer=0x2923510, now=now@entry=3317763, > prev=prev@entry=0x81f6f8 <timers>) at WaitFor.c:420 > #8 0x000000000058c36a in WaitForSomething > (pClientsReady=pClientsReady@entry=0x17efab0) at WaitFor.c:291 > #9 0x00000000005572ee in Dispatch () at dispatch.c:359 > #10 0x000000000055b503 in dix_main (argc=10, argv=0x7ffca1cbd528, > envp=<optimized out>) at main.c:300 > #11 0x00007fab4bfaa0c1 in __libc_start_main () from /lib64/libc.so.6 > #12 0x0000000000423599 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
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 <ofourdan@redhat.com> --- hw/xwayland/xwayland-input.c | 3 +++ 1 file changed, 3 insertions(+)