[mutter/gnome-41] kms/impl-device: Report 'full' change if we removed connectors



commit e2a62d0f89aab878cc9b88c5f873039ffe9755e4
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Nov 18 17:34:40 2021 +0100

    kms/impl-device: Report 'full' change if we removed connectors
    
    If some connectors disappeared, but the rest didn't change, we missed
    actually removing the ones that disappeared, as we incorrectly assumed
    nothing changed. Fix this by only assuming nothing changed if 1) we
    didn't add any connector, and 2) we have the same amount of connectors
    as before the hotplug event. The connector comparison checking makes
    sure we report changes if anything of the still available connectors
    changed.
    
    Fixes: a8d11161b6b4967b770c9c28be2ff0e07567a5aa
    Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2007
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>
    (cherry picked from commit cbdd62c19788d6972df5685a1ed31f2a690afb63)

 src/backends/native/meta-kms-impl-device.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c
index 94f7892eec..2f7922de94 100644
--- a/src/backends/native/meta-kms-impl-device.c
+++ b/src/backends/native/meta-kms-impl-device.c
@@ -396,7 +396,7 @@ update_connectors (MetaKmsImplDevice *impl_device,
   MetaKmsImplDevicePrivate *priv =
     meta_kms_impl_device_get_instance_private (impl_device);
   g_autolist (MetaKmsConnector) connectors = NULL;
-  gboolean needs_full_change = FALSE;
+  gboolean added_connector = FALSE;
   unsigned int i;
   int fd;
 
@@ -420,7 +420,7 @@ update_connectors (MetaKmsImplDevice *impl_device,
         {
           connector = meta_kms_connector_new (impl_device, drm_connector,
                                               drm_resources);
-          needs_full_change = TRUE;
+          added_connector = TRUE;
         }
 
       drmModeFreeConnector (drm_connector);
@@ -428,7 +428,8 @@ update_connectors (MetaKmsImplDevice *impl_device,
       connectors = g_list_prepend (connectors, connector);
     }
 
-  if (!needs_full_change)
+  if (!added_connector &&
+      g_list_length (connectors) == g_list_length (priv->connectors))
     return META_KMS_UPDATE_CHANGE_NONE;
 
   g_list_free_full (priv->connectors, g_object_unref);


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