diff --git a/src/backends/native/meta-kms-connector-private.h b/src/backends/native/meta-kms-connector-private.h index 73757a8fc..66b2fa6fb 100644 --- a/src/backends/native/meta-kms-connector-private.h +++ b/src/backends/native/meta-kms-connector-private.h @@ -103,7 +103,8 @@ uint64_t meta_kms_connector_get_prop_drm_value (MetaKmsConnector *connector, uint64_t value); MetaKmsResourceChanges meta_kms_connector_update_state (MetaKmsConnector *connector, - drmModeRes *drm_resources); + drmModeRes *drm_resources, + drmModeConnector *drm_connector); void meta_kms_connector_disable (MetaKmsConnector *connector); diff --git a/src/backends/native/meta-kms-connector.c b/src/backends/native/meta-kms-connector.c index 2bc337291..0cf775bbb 100644 --- a/src/backends/native/meta-kms-connector.c +++ b/src/backends/native/meta-kms-connector.c @@ -754,20 +754,16 @@ out: MetaKmsResourceChanges meta_kms_connector_update_state (MetaKmsConnector *connector, - drmModeRes *drm_resources) + drmModeRes *drm_resources, + drmModeConnector *drm_connector) { MetaKmsImplDevice *impl_device; - drmModeConnector *drm_connector; MetaKmsResourceChanges changes; impl_device = meta_kms_device_get_impl_device (connector->device); - drm_connector = drmModeGetConnector (meta_kms_impl_device_get_fd (impl_device), - connector->id); - changes = meta_kms_connector_read_state (connector, impl_device, drm_connector, drm_resources); - g_clear_pointer (&drm_connector, drmModeFreeConnector); return changes; } diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c index b1dd321a7..d9ea27637 100644 --- a/src/backends/native/meta-kms-impl-device.c +++ b/src/backends/native/meta-kms-impl-device.c @@ -397,12 +397,14 @@ find_existing_connector (MetaKmsImplDevice *impl_device, static MetaKmsResourceChanges update_connectors (MetaKmsImplDevice *impl_device, - drmModeRes *drm_resources) + drmModeRes *drm_resources, + uint32_t updated_connector_id) { MetaKmsImplDevicePrivate *priv = meta_kms_impl_device_get_instance_private (impl_device); g_autolist (MetaKmsConnector) connectors = NULL; gboolean added_connector = FALSE; + MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE; unsigned int i; int fd; @@ -421,6 +423,13 @@ update_connectors (MetaKmsImplDevice *impl_device, if (connector) { connector = g_object_ref (connector); + if (updated_connector_id == 0 || + meta_kms_connector_get_id (connector) == updated_connector_id) + { + changes |= meta_kms_connector_update_state (connector, + drm_resources, + drm_connector); + } } else { @@ -436,7 +445,7 @@ update_connectors (MetaKmsImplDevice *impl_device, if (!added_connector && g_list_length (connectors) == g_list_length (priv->connectors)) - return META_KMS_RESOURCE_CHANGE_NONE; + return changes; g_list_free_full (priv->connectors, g_object_unref); priv->connectors = g_list_reverse (g_steal_pointer (&connectors)); @@ -892,7 +901,7 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device, goto err; } - changes = update_connectors (impl_device, drm_resources); + changes = update_connectors (impl_device, drm_resources, connector_id); for (l = priv->crtcs; l; l = l->next) { @@ -905,17 +914,6 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device, changes |= meta_kms_crtc_update_state (crtc); } - for (l = priv->connectors; l; l = l->next) - { - MetaKmsConnector *connector = META_KMS_CONNECTOR (l->data); - - if (connector_id > 0 && - meta_kms_connector_get_id (connector) != connector_id) - continue; - - changes |= meta_kms_connector_update_state (connector, drm_resources); - } - drmModeFreeResources (drm_resources); return changes; @@ -1196,7 +1194,7 @@ meta_kms_impl_device_init_mode_setting (MetaKmsImplDevice *impl_device, init_fallback_modes (impl_device); - update_connectors (impl_device, drm_resources); + update_connectors (impl_device, drm_resources, 0); drmModeFreeResources (drm_resources);