[mutter/benzea/ignore-monitor-connector: 186/189] monitor: Only hash the connector when required



commit 2f2efdefcf565067681a6320f9aab3a3189e061e
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 8938f4e2c..a2e83d890 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1403,10 +1403,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;
@@ -1420,6 +1422,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]