1
0
Fork 0
mutter-performance-source/src
Pekka Paalanen 6e0cfd3e55 kms: Make GSource ready by default
When testing a laptop with intel and DisplayLink devices, attempting to set the
DL output as the only active output resulted in GNOME/Wayland freezing. The
main event loop was running fine, but nothing on screen would get updated once
the DL output become the only one. This patch fixes that issue.

DisplayLink USB 3 devices use an out-of-tree kernel DRM driver called EVDI.
EVDI can sometimes fail drmModePageFlip(). For me, the flip fails reliably when
hotplugging the DL dock and when changing display configuration to DL only.
Mutter has a workaround for failing flips, it just calls drmModeSetCrtc() and
that succeeds.

What does not work reliably in the fallback path is Mutter keeping track of the
pageflip. Since drmModePageFlip() failed, there will not be a pageflip event
coming and instead Mutter queues a callback in its stead. When you have more
than one output, some other output repainting will attempt to swap buffers and
calls wait_for_pending_flips() which has the side-effect of dispatching any
queued flip callbacks. With multiple outputs, you don't get stuck (unless they
all fail the exact same way at the same time?). When you have only one output,
it cannot proceed to repaint and buffer swap because the pageflip is not marked
complete yet. Nothing dispatches the flip callback, leading to the freeze.

The flip callback is intended to be an idle callback, implemented with a
GSource. It is supposed to be called as soon as execution returns to the main
event loop. The setup of the GSource is incomplete, so it will never dispatch.

Fix the GSource setup by setting its ready-time to be always in the past. That
gets it dispatched on the next cycle of the main event loop. This is now the
default behavior for all sources created by meta_kms_add_source_in_impl().
Sources that need a delay continue to do that by overriding the ready-time
explicitly.

An alternative solution could have been to implement GSource prepare and check
callbacks returning TRUE. However, since meta_kms_add_source_in_impl() is used
by flip retry code as well, and that code needs a delay through the ready-time,
I was afraid I might break the flip retry code. Hence I decided to use
ready-time instead.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1209
2020-04-23 16:30:17 +03:00
..
backends kms: Make GSource ready by default 2020-04-23 16:30:17 +03:00
compositor compositor: Add support for direct scanout of Wayland surfaces 2020-04-16 15:05:52 +02:00
core Add read-only anonymous file abstraction MetaAnonymousFile 2020-04-21 17:52:08 +02:00
meta later: Make MetaCompositor the owner of the MetaLaters state 2020-04-16 15:05:52 +02:00
tests tests/wayland: Add a test for meta-anonymous-file 2020-04-21 17:52:08 +02:00
ui window/x11: Use G_DECLARE_DERIVABLE_TYPE() 2020-04-16 14:08:19 +02:00
wayland wayland/keyboard: Use MetaAnonymousFile to share keymap files 2020-04-21 17:52:08 +02:00
x11 x11: Allow X11 clients to clear the selection 2020-04-21 21:32:53 +00:00
libmutter.pc.in build: Fix libs and cflags in autotools .pc file 2018-11-10 16:20:46 +00:00
meson.build Add read-only anonymous file abstraction MetaAnonymousFile 2020-04-21 17:52:08 +02:00
meta-marshal.list cursor-tracker: Use our own marshal for cursor-moved 2019-07-31 09:34:17 +00:00
org.freedesktop.login1.xml MetaLauncher: Don't g_error() on failure 2015-11-06 17:03:59 -05:00
org.gnome.Mutter.DisplayConfig.xml fixed typo 2018-07-24 13:16:36 +00:00
org.gnome.Mutter.IdleMonitor.xml idle-monitor: Add ResetIdletime API, for testing purposes 2018-04-16 13:28:03 +02:00
org.gnome.Mutter.RemoteDesktop.xml Fix typo in RemoteDesktop dbus api 2019-05-22 16:21:57 +02:00
org.gnome.Mutter.ScreenCast.xml screen-cast-session: Add 'disable-animations' property 2020-02-20 10:40:42 +00:00