[mutter/benzea/ignore-monitor-connector: 1250/1253] monitor: Only hash the connector when required




commit 6b36ab364ab322d6a156b0073b16f12e3f5ffdde
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Dec 20 14:21:27 2019 +0100

    monitor: Only hash the connector when required
    
    If the monitors in the configuration can already be uniquely identified
    using the EDID information and connector type, then remove the connector
    from the hash. This ensures that monitor configurations will land in the
    same bucket if only the connectors are different.
    
    Also add a quick return to the equal function by checking the
    edid_sufficient boolean.
    
    https://gitlab.gnome.org/GNOME/mutter/issues/932

 src/backends/meta-monitor-config-manager.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index 3d469d8eaa..e2536e171e 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1482,10 +1482,12 @@ meta_monitors_config_key_hash (gconstpointer data)
     {
       MetaMonitorSpec *monitor_spec = l->data;
 
-      hash ^= (g_str_hash (monitor_spec->connector) ^
-               g_str_hash (monitor_spec->vendor) ^
+      hash ^= (g_str_hash (monitor_spec->vendor) ^
                g_str_hash (monitor_spec->product) ^
                g_str_hash (monitor_spec->serial));
+
+      if (!config_key->edid_sufficient)
+        hash ^= g_str_hash (monitor_spec->connector);
     }
 
   return hash;
@@ -1499,6 +1501,9 @@ meta_monitors_config_key_equal (gconstpointer data_a,
   const MetaMonitorsConfigKey *config_key_b = data_b;
   GList *l_a, *l_b;
 
+  if (config_key_a->edid_sufficient != config_key_b->edid_sufficient)
+    return FALSE;
+
   for (l_a = config_key_a->monitor_specs, l_b = config_key_b->monitor_specs;
        l_a && l_b;
        l_a = l_a->next, l_b = l_b->next)


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