[mutter] kms/crtc: Always log whether we updated CRTC state



commit c765730af7ce1d062fd0680a59393d742fc95f43
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Thu Nov 18 17:18:12 2021 +0100

    kms/crtc: Always log whether we updated CRTC state
    
    Change a few early-outs to handle the state changes without returning.
    This means we'll get to log the result in all cases, which might help
    debugging.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2097>

 src/backends/native/meta-kms-crtc.c | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c
index 3e05060263..4599f4455f 100644
--- a/src/backends/native/meta-kms-crtc.c
+++ b/src/backends/native/meta-kms-crtc.c
@@ -125,6 +125,9 @@ static MetaKmsUpdateChanges
 meta_kms_crtc_state_changes (MetaKmsCrtcState *state,
                              MetaKmsCrtcState *other_state)
 {
+  if (state->is_active != other_state->is_active)
+    return META_KMS_UPDATE_CHANGE_FULL;
+
   if (!meta_rectangle_equal (&state->rect, &other_state->rect))
     return META_KMS_UPDATE_CHANGE_FULL;
 
@@ -214,35 +217,29 @@ meta_kms_crtc_read_state (MetaKmsCrtc             *crtc,
       crtc_state.is_active = drm_crtc->mode_valid;
     }
 
-  if (crtc_state.is_active != crtc->current_state.is_active)
-    {
-      changes |= META_KMS_UPDATE_CHANGE_FULL;
-    }
-  else if (!crtc_state.is_active)
+  if (!crtc_state.is_active)
     {
-      clear_gamma_state (&crtc_state);
-      return changes;
+      if (crtc->current_state.is_active)
+        changes |= META_KMS_UPDATE_CHANGE_FULL;
     }
-
-  read_gamma_state (crtc, &crtc_state, impl_device, drm_crtc);
-
-  changes |= meta_kms_crtc_state_changes (&crtc->current_state, &crtc_state);
-
-  if (changes == META_KMS_UPDATE_CHANGE_NONE)
+  else
     {
-      clear_gamma_state (&crtc_state);
-      return changes;
+      read_gamma_state (crtc, &crtc_state, impl_device, drm_crtc);
+      changes = meta_kms_crtc_state_changes (&crtc->current_state, &crtc_state);
     }
 
   clear_gamma_state (&crtc->current_state);
   crtc->current_state = crtc_state;
 
   meta_topic (META_DEBUG_KMS,
-              "Read CRTC %u state: active: %d, mode: %s",
+              "Read CRTC %u state: active: %d, mode: %s, changed: %s",
               crtc->id, crtc->current_state.is_active,
               crtc->current_state.is_drm_mode_valid
                 ? crtc->current_state.drm_mode.name
-                : "(nil)");
+                : "(nil)",
+              changes == META_KMS_UPDATE_CHANGE_NONE
+                ? "no"
+                : "yes");
 
   return changes;
 }


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