[mutter] kms/impl-device: Only update crtc/connector whose ID has changed
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] kms/impl-device: Only update crtc/connector whose ID has changed
- Date: Mon, 20 Sep 2021 16:07:16 +0000 (UTC)
commit dd0ad3bfb1fae1b7993bc36a71e69af1cb2f0c9c
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Aug 4 19:28:04 2020 +0200
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>
src/backends/native/meta-kms-device-private.h | 4 +++-
src/backends/native/meta-kms-device.c | 7 +++++--
src/backends/native/meta-kms-impl-device.c | 25 +++++++++++++++++++++----
src/backends/native/meta-kms-impl-device.h | 4 +++-
src/backends/native/meta-kms.c | 5 ++++-
5 files changed, 36 insertions(+), 9 deletions(-)
---
diff --git a/src/backends/native/meta-kms-device-private.h b/src/backends/native/meta-kms-device-private.h
index 1079741e0d..f7d810af0d 100644
--- a/src/backends/native/meta-kms-device-private.h
+++ b/src/backends/native/meta-kms-device-private.h
@@ -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);
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
index 6085654bae..f44260a31f 100644
--- a/src/backends/native/meta-kms-device.c
+++ b/src/backends/native/meta-kms-device.c
@@ -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;
diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c
index e616ffd2ae..94f7892eec 100644
--- a/src/backends/native/meta-kms-impl-device.c
+++ b/src/backends/native/meta-kms-impl-device.c
@@ -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);
diff --git a/src/backends/native/meta-kms-impl-device.h b/src/backends/native/meta-kms-impl-device.h
index caddae3c14..4710f00bde 100644
--- a/src/backends/native/meta-kms-impl-device.h
+++ b/src/backends/native/meta-kms-impl-device.h
@@ -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);
diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c
index e76aaca154..a1d483760a 100644
--- a/src/backends/native/meta-kms.c
+++ b/src/backends/native/meta-kms.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]