[mutter] kms/connector: Properly predict connectors turning off



commit e956078052683b5b5462d958f1298add9b6d5746
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Apr 10 21:14:44 2021 +0200

    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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1821>

 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 0ad1661762..3508d22ccd 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;
-
-      if (!g_list_find (mode_set->connectors, connector))
-        continue;
+      MetaKmsCrtc *crtc = mode_set->crtc;
 
-      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;
+            }
+        }
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]