[mutter] monitor-manager-xrandr: Disable CRTCs if there is no monitor



commit ed87937faf4a327bb27f580939e0d8572f5a6ec3
Author: Kai-Heng Feng <kai heng feng canonical com>
Date:   Fri Nov 13 14:19:26 2020 +0800

    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>

 src/backends/x11/meta-monitor-manager-xrandr.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/backends/x11/meta-monitor-manager-xrandr.c b/src/backends/x11/meta-monitor-manager-xrandr.c
index da0e7d68c3..03e6175f50 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -456,6 +456,9 @@ apply_crtc_assignments (MetaMonitorManager    *manager,
       meta_crtc_unset_config (crtc);
     }
 
+  if (!n_crtcs)
+    goto out;
+
   g_assert (width > 0 && height > 0);
   /* 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
@@ -555,6 +558,7 @@ apply_crtc_assignments (MetaMonitorManager    *manager,
                   (GFunc) meta_output_unassign_crtc,
                   NULL);
 
+out:
   XUngrabServer (manager_xrandr->xdisplay);
   XFlush (manager_xrandr->xdisplay);
 }
@@ -601,6 +605,9 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager      *mana
 
   if (!config)
     {
+      if (!manager->in_init)
+        apply_crtc_assignments (manager, TRUE, NULL, 0, NULL, 0);
+
       meta_monitor_manager_xrandr_rebuild_derived (manager, NULL);
       return TRUE;
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]