kms/impl-device: Only update crtc/connector whose ID has changed

On hotplug events we may get informations about what CRTC or connector
changed a property (and the property itself), so in such case let's just
ignore the changes to the non-affected CRTCs/connectors, and let's read
only the affected one

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1964>
This commit is contained in:
Marco Trevisan (Treviño) 2020-08-04 19:28:04 +02:00 committed by Marge Bot
parent 91ed95ab6f
commit dd0ad3bfb1
5 changed files with 36 additions and 9 deletions

View File

@ -25,7 +25,9 @@
MetaKmsImplDevice * meta_kms_device_get_impl_device (MetaKmsDevice *device);
MetaKmsUpdateChanges meta_kms_device_update_states_in_impl (MetaKmsDevice *device);
MetaKmsUpdateChanges meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
uint32_t crtc_id,
uint32_t connector_id);
void meta_kms_device_predict_states_in_impl (MetaKmsDevice *device,
MetaKmsUpdate *update);

View File

@ -231,7 +231,9 @@ meta_kms_device_get_fallback_modes (MetaKmsDevice *device)
}
MetaKmsUpdateChanges
meta_kms_device_update_states_in_impl (MetaKmsDevice *device)
meta_kms_device_update_states_in_impl (MetaKmsDevice *device,
uint32_t crtc_id,
uint32_t connector_id)
{
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
MetaKmsUpdateChanges changes;
@ -239,7 +241,8 @@ meta_kms_device_update_states_in_impl (MetaKmsDevice *device)
meta_assert_in_kms_impl (device->kms);
meta_assert_is_waiting_for_kms_impl_task (device->kms);
changes = meta_kms_impl_device_update_states (impl_device);
changes = meta_kms_impl_device_update_states (impl_device, crtc_id,
connector_id);
if (changes == META_KMS_UPDATE_CHANGE_NONE)
return changes;

View File

@ -702,7 +702,9 @@ clear_latched_fd_hold (MetaKmsImplDevice *impl_device)
}
MetaKmsUpdateChanges
meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device)
meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
uint32_t crtc_id,
uint32_t connector_id)
{
MetaKmsImplDevicePrivate *priv =
meta_kms_impl_device_get_instance_private (impl_device);
@ -736,11 +738,26 @@ meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device)
changes = update_connectors (impl_device, drm_resources);
for (l = priv->crtcs; l; l = l->next)
changes |= meta_kms_crtc_update_state (META_KMS_CRTC (l->data));
{
MetaKmsCrtc *crtc = META_KMS_CRTC (l->data);
if (crtc_id > 0 &&
meta_kms_crtc_get_id (crtc) != crtc_id)
continue;
changes |= meta_kms_crtc_update_state (crtc);
}
for (l = priv->connectors; l; l = l->next)
changes |= meta_kms_connector_update_state (META_KMS_CONNECTOR (l->data),
drm_resources);
{
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);

View File

@ -135,7 +135,9 @@ void meta_kms_impl_device_hold_fd (MetaKmsImplDevice *impl_device);
void meta_kms_impl_device_unhold_fd (MetaKmsImplDevice *impl_device);
MetaKmsUpdateChanges meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device);
MetaKmsUpdateChanges meta_kms_impl_device_update_states (MetaKmsImplDevice *impl_device,
uint32_t crtc_id,
uint32_t connector_id);
void meta_kms_impl_device_predict_states (MetaKmsImplDevice *impl_device,
MetaKmsUpdate *update);

View File

@ -605,7 +605,10 @@ meta_kms_update_states_in_impl (MetaKms *kms,
update_data->connector_id))
continue;
changes |= meta_kms_device_update_states_in_impl (kms_device);
changes |=
meta_kms_device_update_states_in_impl (kms_device,
update_data->crtc_id,
update_data->connector_id);
}
return changes;