[mutter/benzea/ignore-monitor-connector: 23/24] monitor: Only take connector into account when required
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/benzea/ignore-monitor-connector: 23/24] monitor: Only take connector into account when required
- Date: Fri, 20 Dec 2019 13:30:59 +0000 (UTC)
commit ab15cfe29ec21243465be6a406e02b161f307bd7
Author: Benjamin Berg <bberg redhat com>
Date: Fri Dec 20 14:24:46 2019 +0100
monitor: Only take connector into account when required
Add a flag to meta_monitor_spec_equals to disable full connector
matching when this is possible. In this mode, only the connector type is
compared, but the connector number is skipped.
Update all calls to the relevant functions to pass whether a full match
is needed or not.
https://gitlab.gnome.org/GNOME/mutter/issues/932
src/backends/meta-monitor-config-manager.c | 14 +++++++++-----
src/backends/meta-monitor-config-manager.h | 3 ++-
src/backends/meta-monitor-manager.c | 3 ++-
src/backends/meta-monitor.c | 13 +++++++++----
src/backends/meta-monitor.h | 3 ++-
5 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/src/backends/meta-monitor-config-manager.c b/src/backends/meta-monitor-config-manager.c
index a631a0b64..bfcde6cc7 100644
--- a/src/backends/meta-monitor-config-manager.c
+++ b/src/backends/meta-monitor-config-manager.c
@@ -1329,7 +1329,7 @@ meta_monitors_config_key_equal (gconstpointer data_a,
MetaMonitorSpec *monitor_spec_a = l_a->data;
MetaMonitorSpec *monitor_spec_b = l_b->data;
- if (!meta_monitor_spec_equals (monitor_spec_a, monitor_spec_b))
+ if (!meta_monitor_spec_equals (monitor_spec_a, monitor_spec_b, config_key_a->edid_sufficient))
return FALSE;
}
@@ -1394,7 +1394,8 @@ meta_monitors_config_new (MetaMonitorManager *monitor_manager,
monitor_spec = meta_monitor_get_spec (monitor);
if (meta_logical_monitor_configs_have_monitor (logical_monitor_configs,
- monitor_spec))
+ monitor_spec,
+ monitor_manager->edid_sufficient))
continue;
disabled_monitor_specs =
@@ -1597,7 +1598,8 @@ has_adjacent_neighbour (MetaMonitorsConfig *config,
gboolean
meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
- MetaMonitorSpec *monitor_spec)
+ MetaMonitorSpec *monitor_spec,
+ gboolean edid_sufficient)
{
GList *l;
@@ -1611,7 +1613,8 @@ meta_logical_monitor_configs_have_monitor (GList *logical_monitor_conf
MetaMonitorConfig *monitor_config = k->data;
if (meta_monitor_spec_equals (monitor_spec,
- monitor_config->monitor_spec))
+ monitor_config->monitor_spec,
+ edid_sufficient))
return TRUE;
}
}
@@ -1624,7 +1627,8 @@ meta_monitors_config_is_monitor_enabled (MetaMonitorsConfig *config,
MetaMonitorSpec *monitor_spec)
{
return meta_logical_monitor_configs_have_monitor (config->logical_monitor_configs,
- monitor_spec);
+ monitor_spec,
+ config->key->edid_sufficient);
}
gboolean
diff --git a/src/backends/meta-monitor-config-manager.h b/src/backends/meta-monitor-config-manager.h
index b453aa18d..54d3d0d77 100644
--- a/src/backends/meta-monitor-config-manager.h
+++ b/src/backends/meta-monitor-config-manager.h
@@ -177,7 +177,8 @@ MetaMonitorsConfigKey * meta_create_monitors_config_key_for_current_state (MetaM
META_EXPORT_TEST
gboolean meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
- MetaMonitorSpec *monitor_spec);
+ MetaMonitorSpec *monitor_spec,
+ gboolean edid_sufficient);
META_EXPORT_TEST
gboolean meta_verify_monitor_mode_spec (MetaMonitorModeSpec *monitor_mode_spec,
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index 0f1968133..3d3bba3c4 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -2475,7 +2475,8 @@ meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager,
MetaMonitor *monitor = l->data;
if (meta_monitor_spec_equals (meta_monitor_get_spec (monitor),
- monitor_spec))
+ monitor_spec,
+ manager->edid_sufficient))
return monitor;
}
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 5d163e1a8..bdf59761c 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -126,12 +126,17 @@ meta_monitor_spec_clone (MetaMonitorSpec *monitor_spec)
gboolean
meta_monitor_spec_equals (MetaMonitorSpec *monitor_spec,
- MetaMonitorSpec *other_monitor_spec)
+ MetaMonitorSpec *other_monitor_spec,
+ gboolean edid_only)
{
- return (g_str_equal (monitor_spec->connector, other_monitor_spec->connector) &&
- g_str_equal (monitor_spec->vendor, other_monitor_spec->vendor) &&
+ gchar *type_end = strchr (monitor_spec->connector, '-');
+ gsize len = type_end ? type_end - monitor_spec->connector + 1 : 1000;
+
+ return (g_str_equal (monitor_spec->vendor, other_monitor_spec->vendor) &&
g_str_equal (monitor_spec->product, other_monitor_spec->product) &&
- g_str_equal (monitor_spec->serial, other_monitor_spec->serial));
+ g_str_equal (monitor_spec->serial, other_monitor_spec->serial) &&
+ (edid_only || g_str_equal (monitor_spec->connector, other_monitor_spec->connector)) &&
+ (!edid_only || (strncmp (monitor_spec->connector, other_monitor_spec->connector, len) == 0)));
}
int
diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h
index 58d2950c9..60472dd97 100644
--- a/src/backends/meta-monitor.h
+++ b/src/backends/meta-monitor.h
@@ -272,7 +272,8 @@ MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
META_EXPORT_TEST
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
- MetaMonitorSpec *other_monitor_id);
+ MetaMonitorSpec *other_monitor_id,
+ gboolean edid_only);
META_EXPORT_TEST
int meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]