xserver-multidpi/hw/xwayland
Olivier Fourdan b79eaf1184 xwayland: handle EAGAIN on Wayland fd
wl_display_flush() can fail with EAGAIN and Xwayland would make this a
fatal error.

When this happens, it means that Xwayland has flooded the Wayland file
descriptor, either because the Wayland compositor cannot cope or more
likely because of a deadlock situation where the Wayland compositor is
blocking, waiting for an X reply while Xwayland tries to write data to
the Wayland file descriptor.

The general consensus to avoid the deadlock is for the Wayland
compositor to never issue blocking X11 roundtrips, but in practice
blocking rountrips can occur in various places, including Xlib calls
themselves so this is not always achievable without major surgery in the
Wayland compositor/Window manager.

What this patch does is to avoid dispatching to the Wayland file
descriptor until it becomes available for writing again, while at the
same time continue processing X11 requests to release the deadlock.

This is not perfect, as there is still the possibility of another X
client hammering the connection and we'll still fail writing to the
Wayland connection eventually, but this improves things enough to avoid
a 100% repeatable crash with vlc and gtkperf.

Also, it is worth considering that window managers and Wayland
compositors such as mutter already have a higher priority than other
regular X clients thanks to XSyncSetPriority(), mitigating the risk.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1278159
Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=763400
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
2016-09-28 14:23:59 -04:00
..
.gitignore Xwayland DDX 2014-04-03 15:19:22 -07:00
drm.xml xwayland: Add glamor and DRI3 support 2014-06-24 15:09:55 -07:00
Makefile.am xwayland: Fix relinking when dix changes 2016-08-16 15:56:18 -04:00
xwayland-cursor.c xwayland: Plug memleak in frame callbacks 2016-08-15 12:49:36 -04:00
xwayland-cvt.c xwayland: do not include frequency in mode name 2016-03-28 14:09:09 -04:00
xwayland-glamor-xv.c xwayland: Fix compiler warning in GLAMOR Xv 2016-04-15 16:22:16 -04:00
xwayland-glamor.c xwayland: Fix whitespace errors 2016-06-20 15:40:07 +10:00
xwayland-input.c xwayland: Process queued events before making wayland mods effective 2016-09-06 13:05:42 +10:00
xwayland-output.c xwayland: Avoid double free of RRCrtc and RROutput 2016-08-15 14:20:54 -04:00
xwayland-shm.c xwayland: Close the shm fd as early as possible 2016-09-28 14:23:59 -04:00
xwayland-vidmode.c xwayland: Pretend we support viewport in vidmode 2016-03-28 14:10:59 -04:00
xwayland.c xwayland: handle EAGAIN on Wayland fd 2016-09-28 14:23:59 -04:00
xwayland.h xwayland: handle EAGAIN on Wayland fd 2016-09-28 14:23:59 -04:00