[mutter/benzea/ignore-monitor-connector: 3/5] monitor: Only hash the connector when required
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/benzea/ignore-monitor-connector: 3/5] monitor: Only hash the connector when required
- Date: Fri, 20 Dec 2019 13:30:09 +0000 (UTC)
commit fb6416e5abed2d5b744c6cfc03e80d09385ec4d2
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 9d548a634..a631a0b64 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1300,10 +1300,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;
@@ -1317,6 +1319,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]