From e956078052683b5b5462d958f1298add9b6d5746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 10 Apr 2021 21:14:44 +0200 Subject: [PATCH] kms/connector: Properly predict connectors turning off The connector state wasn't properly predicted, as it earlied out if the connector wasn't part of a mode set connector list. Instead use the old CRTC to check whether it was used in any mode set, and whether the connector was part of any new mode set, to predict whether the connector is inactive or active. Part-of: --- src/backends/native/meta-kms-connector.c | 30 ++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/backends/native/meta-kms-connector.c b/src/backends/native/meta-kms-connector.c index 0ad166176..3508d22cc 100644 --- a/src/backends/native/meta-kms-connector.c +++ b/src/backends/native/meta-kms-connector.c @@ -498,28 +498,34 @@ void meta_kms_connector_predict_state (MetaKmsConnector *connector, MetaKmsUpdate *update) { + MetaKmsConnectorState *current_state; GList *mode_sets; GList *l; - - if (!connector->current_state) + current_state = connector->current_state; + if (!current_state) return; mode_sets = meta_kms_update_get_mode_sets (update); for (l = mode_sets; l; l = l->next) { MetaKmsModeSet *mode_set = l->data; - MetaKmsCrtc *crtc; + MetaKmsCrtc *crtc = mode_set->crtc; - if (!g_list_find (mode_set->connectors, connector)) - continue; - - crtc = mode_set->crtc; - if (crtc) - connector->current_state->current_crtc_id = meta_kms_crtc_get_id (crtc); + if (current_state->current_crtc_id == meta_kms_crtc_get_id (crtc)) + { + if (g_list_find (mode_set->connectors, connector)) + break; + else + current_state->current_crtc_id = 0; + } else - connector->current_state->current_crtc_id = 0; - - break; + { + if (g_list_find (mode_set->connectors, connector)) + { + current_state->current_crtc_id = meta_kms_crtc_get_id (crtc); + break; + } + } } }