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: a8d11161b6
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2007
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>
This commit is contained in:
Jonas Ådahl 2021-11-18 17:34:40 +01:00
parent c765730af7
commit cbdd62c197

View File

@ -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);