1
0
Fork 0

monitor-manager-xrandr: Disable CRTCs if there is no monitor

After last monitor gets unplugged from the system, hotplug detection may
no longer work on Intel GFX.

This is because we didn't trigger a modeset to disable CRTCs, and i915
requires it to make hotplug detection continue to work [1].

There's no guarantee that DPMS off in DDX also disables CRTCs, so
explicitly disable CRTCs to solve the issue.

[1] https://www.kernel.org/doc/html/latest/gpu/i915.html#hotplug

https://gitlab.freedesktop.org/drm/intel/-/issues/2602

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1561>
This commit is contained in:
Kai-Heng Feng 2020-11-13 14:19:26 +08:00
parent e5b07138f0
commit ed87937faf

View file

@ -456,6 +456,9 @@ apply_crtc_assignments (MetaMonitorManager *manager,
meta_crtc_unset_config (crtc); meta_crtc_unset_config (crtc);
} }
if (!n_crtcs)
goto out;
g_assert (width > 0 && height > 0); g_assert (width > 0 && height > 0);
/* The 'physical size' of an X screen is meaningless if that screen /* The 'physical size' of an X screen is meaningless if that screen
* can consist of many monitors. So just pick a size that make the * can consist of many monitors. So just pick a size that make the
@ -555,6 +558,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
(GFunc) meta_output_unassign_crtc, (GFunc) meta_output_unassign_crtc,
NULL); NULL);
out:
XUngrabServer (manager_xrandr->xdisplay); XUngrabServer (manager_xrandr->xdisplay);
XFlush (manager_xrandr->xdisplay); XFlush (manager_xrandr->xdisplay);
} }
@ -601,6 +605,9 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
if (!config) if (!config)
{ {
if (!manager->in_init)
apply_crtc_assignments (manager, TRUE, NULL, 0, NULL, 0);
meta_monitor_manager_xrandr_rebuild_derived (manager, NULL); meta_monitor_manager_xrandr_rebuild_derived (manager, NULL);
return TRUE; return TRUE;
} }