[mutter] kms: Properly predict power saving effect on tracked state



commit 2478000c7382de46c60ec5c46e92d3eb588f1f28
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Mon Jun 28 09:16:12 2021 +0200

    kms: Properly predict power saving effect on tracked state
    
    Entering power saving effectively disables CRTCs, and thus the CRTC id a
    connector is associated with. Make sure that the tracked state reflects
    this.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>

 src/backends/native/meta-kms-connector.c | 3 +++
 src/backends/native/meta-kms-crtc.c      | 8 ++++++++
 2 files changed, 11 insertions(+)
---
diff --git a/src/backends/native/meta-kms-connector.c b/src/backends/native/meta-kms-connector.c
index 368dd0ff73..7d10dcb3cd 100644
--- a/src/backends/native/meta-kms-connector.c
+++ b/src/backends/native/meta-kms-connector.c
@@ -766,6 +766,9 @@ meta_kms_connector_predict_state (MetaKmsConnector *connector,
   if (!current_state)
     return;
 
+  if (meta_kms_update_is_power_save (update))
+    current_state->current_crtc_id = 0;
+
   mode_sets = meta_kms_update_get_mode_sets (update);
   for (l = mode_sets; l; l = l->next)
     {
diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c
index 4599f4455f..7d4706bf1d 100644
--- a/src/backends/native/meta-kms-crtc.c
+++ b/src/backends/native/meta-kms-crtc.c
@@ -285,6 +285,14 @@ meta_kms_crtc_predict_state (MetaKmsCrtc   *crtc,
   GList *crtc_gammas;
   GList *l;
 
+  if (meta_kms_update_is_power_save (update))
+    {
+      crtc->current_state.is_active = FALSE;
+      crtc->current_state.rect = (MetaRectangle) { 0 };
+      crtc->current_state.is_drm_mode_valid = FALSE;
+      crtc->current_state.drm_mode = (drmModeModeInfo) { 0 };
+    }
+
   mode_sets = meta_kms_update_get_mode_sets (update);
   for (l = mode_sets; l; l = l->next)
     {


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