[mutter/gnome-3-36] monitor-manager-xrandr: Disable CRTCs if there is no monitor



commit 93f3ce3c305571bfc39f6d9e5d221e1b60a920a4
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 5c161896f3..6cdcbbef49 100644
--- a/src/backends/x11/meta-monitor-manager-xrandr.c
+++ b/src/backends/x11/meta-monitor-manager-xrandr.c
@@ -453,6 +453,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
@@ -549,6 +552,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
       output->is_primary = FALSE;
     }
 
+out:
   XUngrabServer (manager_xrandr->xdisplay);
   XFlush (manager_xrandr->xdisplay);
 }
@@ -595,6 +599,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]