[mutter] mutter/wayland: Improved preferred mode selection for the native backend



commit 4d5dd01b7d09c9fb15d50580172f0e0d63e1a17e
Author: Thomas Hellstrom <thellstrom vmware com>
Date:   Wed Jun 3 22:08:17 2015 +0200

    mutter/wayland: Improved preferred mode selection for the native backend
    
    Instead of selecting the first drm mode as the preferred mode, select the
    first drm mode marked as preferred. If there are no modes marked as
    preferred, revert to the old behaviour and select the first mode.
    
    Signed-off-by: Thomas Hellstrom <thellstrom vmware com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750363

 src/backends/native/meta-monitor-manager-kms.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c
index e95f7e5..d0bd467 100644
--- a/src/backends/native/meta-monitor-manager-kms.c
+++ b/src/backends/native/meta-monitor-manager-kms.c
@@ -601,11 +601,17 @@ meta_monitor_manager_kms_read_current (MetaMonitorManager *manager)
               break;
             }
 
+         meta_output->preferred_mode = NULL;
          meta_output->n_modes = connector->count_modes;
          meta_output->modes = g_new0 (MetaMonitorMode *, meta_output->n_modes);
-         for (j = 0; j < meta_output->n_modes; j++)
+         for (j = 0; j < meta_output->n_modes; j++) {
             meta_output->modes[j] = find_meta_mode (manager, &connector->modes[j]);
-         meta_output->preferred_mode = meta_output->modes[0];
+            if (connector->modes[j].type & DRM_MODE_TYPE_PREFERRED)
+              meta_output->preferred_mode = meta_output->modes[j];
+          }
+
+          if (!meta_output->preferred_mode)
+            meta_output->preferred_mode = meta_output->modes[0];
 
           output_kms->connector = connector;
           output_kms->n_encoders = connector->count_encoders;


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