From d985069542cfaf356192d0891c2601367074afb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 26 Jul 2022 11:02:32 +0200 Subject: [PATCH] kms/crtc: Don't report predicted gamma changes We started to report resource changes using prediction when an update had been successfully committed. While at it, gamma changes were reported too, but this was problematic, as gsd-color will listen for the MonitorsChanged D-Bus signal and naively set the gamma again, even if it didn't change. There aren't currently any actual use cases for being told when gamma changes from a prediction, so just ignore it and just report privacy screen changes. This avoids a feedback loop between mutter and gsd-color. Fixes: 81b28a1d975f2511d8800faa2c187703eb66ce63 Part-of: --- src/backends/native/meta-kms-crtc-private.h | 4 ++-- src/backends/native/meta-kms-crtc.c | 6 +----- src/backends/native/meta-kms-impl-device.c | 7 +------ 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/backends/native/meta-kms-crtc-private.h b/src/backends/native/meta-kms-crtc-private.h index 79a5f0fe6..baf5f4099 100644 --- a/src/backends/native/meta-kms-crtc-private.h +++ b/src/backends/native/meta-kms-crtc-private.h @@ -42,8 +42,8 @@ MetaKmsResourceChanges meta_kms_crtc_update_state (MetaKmsCrtc *crtc); void meta_kms_crtc_disable (MetaKmsCrtc *crtc); -MetaKmsResourceChanges meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, - MetaKmsUpdate *update); +void meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, + MetaKmsUpdate *update); uint32_t meta_kms_crtc_get_prop_id (MetaKmsCrtc *crtc, MetaKmsCrtcProp prop); diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c index 707dfd4b8..ee9e19d2d 100644 --- a/src/backends/native/meta-kms-crtc.c +++ b/src/backends/native/meta-kms-crtc.c @@ -278,14 +278,13 @@ meta_kms_crtc_disable (MetaKmsCrtc *crtc) crtc->current_state.drm_mode = (drmModeModeInfo) { 0 }; } -MetaKmsResourceChanges +void meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, MetaKmsUpdate *update) { GList *mode_sets; GList *crtc_gammas; GList *l; - MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE; mode_sets = meta_kms_update_get_mode_sets (update); for (l = mode_sets; l; l = l->next) @@ -338,11 +337,8 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc, crtc->current_state.gamma.blue = g_memdup2 (gamma->blue, gamma->size * sizeof (uint16_t)); - changes |= META_KMS_RESOURCE_CHANGE_GAMMA; break; } - - return changes; } static void diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c index 653a96f71..dc2ac31ef 100644 --- a/src/backends/native/meta-kms-impl-device.c +++ b/src/backends/native/meta-kms-impl-device.c @@ -923,12 +923,7 @@ meta_kms_impl_device_predict_states (MetaKmsImplDevice *impl_device, MetaKmsResourceChanges changes = META_KMS_RESOURCE_CHANGE_NONE; GList *l; - for (l = priv->crtcs; l; l = l->next) - { - MetaKmsCrtc *crtc = l->data; - - changes |= meta_kms_crtc_predict_state (crtc, update); - } + g_list_foreach (priv->crtcs, (GFunc) meta_kms_crtc_predict_state, update); for (l = priv->connectors; l; l = l->next) {