I'm using a Dell XPS 13 laptop with a noname USB-C dock for an external HDMI screen. Nearly 100% stock Ubuntu 20.04 with Xorg, Gnome-Shell, and kernel 5.8. Everything works fine, unless I want the screens to turn off, e.g. simply for powersaving when idle. What happens is that everything briefly goes black for a few seconds, then flickers a couple of times and turns back on. I can also manually trigger this bug by e.g. running xset dpms force off
or by disabling the external output with xrandr --output DP-1 --off
.
AFAICT the problem is that the external monitor correctly going into powersave triggers a hotplug event, which causes gnome-shell to reconfigure all the screens, and in the process wakes them up again.
I've captured the output from journalctl -f
for one off-flicker-on sequence below - suggestions welcome, any ideas on how to make gnome-shell ignore these screen hotplug events?
Mai 01 21:30:34 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Allocate new frame buffer 1920x1200 stride
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): EDID vendor "DEL", prod id 41155
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Using hsync ranges from config file
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Using vrefresh ranges from config file
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Printing DDC gathered Modelines:
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "2560x1440"x0.0 241.50 2560 2608 2640 2720 1440 1443 1448 1481 +hsync -vsync (88.8 kHz eP)
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "1920x1080"x0.0 148.50 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync (67.5 kHz e)
[...]
Mai 01 21:30:35 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "1280x1024"x0.0 108.00 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync (64.0 kHz e)
Mai 01 21:30:35 sliver gnome-shell[2150]: meta_display_get_monitor_in_fullscreen: assertion 'monitor >= 0 && monitor < n_logical_monitors' failed
Mai 01 21:30:35 sliver gnome-shell[2150]: meta_monitor_manager_get_logical_monitor_from_number: assertion '(unsigned int) number < g_list_length (manager->logical_monitors)' failed
Mai 01 21:30:35 sliver gnome-shell[2150]: meta_workspace_get_work_area_for_monitor: assertion 'logical_monitor != NULL' failed
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): EDID vendor "SHP", prod id 5324
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Printing DDC gathered Modelines:
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 592.50 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (148.1 kHz eP)
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 474.00 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (118.5 kHz e)
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): EDID vendor "SHP", prod id 5324
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Printing DDC gathered Modelines:
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 592.50 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (148.1 kHz eP)
Mai 01 21:30:43 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 474.00 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (118.5 kHz e)
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): EDID vendor "SHP", prod id 5324
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Printing DDC gathered Modelines:
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 592.50 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (148.1 kHz eP)
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 474.00 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (118.5 kHz e)
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Allocate new frame buffer 2560x2640 stride
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): EDID vendor "SHP", prod id 5324
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Printing DDC gathered Modelines:
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 592.50 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (148.1 kHz eP)
Mai 01 21:30:46 sliver /usr/lib/gdm3/gdm-x-session[2008]: (II) modeset(0): Modeline "3840x2400"x0.0 474.00 3840 3888 3920 4000 2400 2403 2409 2469 -hsync -vsync (118.5 kHz e)
I just found https://askubuntu.com/a/1054222/29252, but that only applies to older Gnome versions. However, I've also figured out a workaround: if you patch the Mutter package to ignore the XRandR events (XRR*), then it seems to work for now (of course, that's a bit of overkill). Patch here: