From cbdd62c19788d6972df5685a1ed31f2a690afb63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 18 Nov 2021 17:34:40 +0100 Subject: [PATCH] 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: --- 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 94f7892ee..2f7922de9 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);