summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2019-12-20 14:21:27 +0100
committerBenjamin Berg <bberg@redhat.com>2020-10-23 16:27:05 +0200
commit6b36ab364ab322d6a156b0073b16f12e3f5ffdde (patch)
tree0dfeac6ceeacc22915951f874616225d87880a26 /src
parentef7d9d43fbd9d56ea7a5b85c6adae9ffae633cd4 (diff)
downloadmutter-6b36ab364ab322d6a156b0073b16f12e3f5ffdde.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/backends/meta-monitor-config-manager.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index 3d469d8ea..e2536e171 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)