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, the connector is simply
skipped from the compare, assuming that all monitors can be
disambiguated using just EDID information.

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
This commit is contained in:
Benjamin Berg 2019-12-20 14:24:46 +01:00
parent c85643a0f7
commit 1dc6998bf9
5 changed files with 23 additions and 13 deletions

View File

@ -943,7 +943,8 @@ find_logical_config_for_builtin_display_rotation (MetaMonitorConfigManager *conf
monitor_config = logical_monitor_config->monitor_configs->data; monitor_config = logical_monitor_config->monitor_configs->data;
if (meta_monitor_spec_equals (meta_monitor_get_spec (panel), if (meta_monitor_spec_equals (meta_monitor_get_spec (panel),
monitor_config->monitor_spec)) monitor_config->monitor_spec,
config_manager->monitor_manager->edid_sufficient))
return logical_monitor_config; return logical_monitor_config;
} }
} }
@ -1432,7 +1433,8 @@ meta_monitors_config_key_equal (gconstpointer data_a,
MetaMonitorSpec *monitor_spec_a = l_a->data; MetaMonitorSpec *monitor_spec_a = l_a->data;
MetaMonitorSpec *monitor_spec_b = l_b->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; return FALSE;
} }
@ -1497,7 +1499,8 @@ meta_monitors_config_new (MetaMonitorManager *monitor_manager,
monitor_spec = meta_monitor_get_spec (monitor); monitor_spec = meta_monitor_get_spec (monitor);
if (meta_logical_monitor_configs_have_monitor (logical_monitor_configs, if (meta_logical_monitor_configs_have_monitor (logical_monitor_configs,
monitor_spec)) monitor_spec,
monitor_manager->edid_sufficient))
continue; continue;
disabled_monitor_specs = disabled_monitor_specs =
@ -1700,7 +1703,8 @@ has_adjacent_neighbour (MetaMonitorsConfig *config,
gboolean gboolean
meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs, meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
MetaMonitorSpec *monitor_spec) MetaMonitorSpec *monitor_spec,
gboolean edid_sufficient)
{ {
GList *l; GList *l;
@ -1714,7 +1718,8 @@ meta_logical_monitor_configs_have_monitor (GList *logical_monitor_conf
MetaMonitorConfig *monitor_config = k->data; MetaMonitorConfig *monitor_config = k->data;
if (meta_monitor_spec_equals (monitor_spec, if (meta_monitor_spec_equals (monitor_spec,
monitor_config->monitor_spec)) monitor_config->monitor_spec,
edid_sufficient))
return TRUE; return TRUE;
} }
} }
@ -1727,7 +1732,8 @@ meta_monitors_config_is_monitor_enabled (MetaMonitorsConfig *config,
MetaMonitorSpec *monitor_spec) MetaMonitorSpec *monitor_spec)
{ {
return meta_logical_monitor_configs_have_monitor (config->logical_monitor_configs, return meta_logical_monitor_configs_have_monitor (config->logical_monitor_configs,
monitor_spec); monitor_spec,
config->key->edid_sufficient);
} }
gboolean gboolean

View File

@ -178,7 +178,8 @@ MetaMonitorsConfigKey * meta_create_monitors_config_key_for_current_state (MetaM
META_EXPORT_TEST META_EXPORT_TEST
gboolean meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs, gboolean meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
MetaMonitorSpec *monitor_spec); MetaMonitorSpec *monitor_spec,
gboolean edid_sufficient);
META_EXPORT_TEST META_EXPORT_TEST
gboolean meta_verify_monitor_mode_spec (MetaMonitorModeSpec *monitor_mode_spec, gboolean meta_verify_monitor_mode_spec (MetaMonitorModeSpec *monitor_mode_spec,

View File

@ -2475,7 +2475,8 @@ meta_monitor_manager_get_monitor_from_spec (MetaMonitorManager *manager,
MetaMonitor *monitor = l->data; MetaMonitor *monitor = l->data;
if (meta_monitor_spec_equals (meta_monitor_get_spec (monitor), if (meta_monitor_spec_equals (meta_monitor_get_spec (monitor),
monitor_spec)) monitor_spec,
manager->edid_sufficient))
return monitor; return monitor;
} }

View File

@ -126,12 +126,13 @@ meta_monitor_spec_clone (MetaMonitorSpec *monitor_spec)
gboolean gboolean
meta_monitor_spec_equals (MetaMonitorSpec *monitor_spec, 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) && return (g_str_equal (monitor_spec->vendor, other_monitor_spec->vendor) &&
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->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)));
} }
int int

View File

@ -272,7 +272,8 @@ MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
META_EXPORT_TEST META_EXPORT_TEST
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id, gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
MetaMonitorSpec *other_monitor_id); MetaMonitorSpec *other_monitor_id,
gboolean edid_only);
META_EXPORT_TEST META_EXPORT_TEST
int meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a, int meta_monitor_spec_compare (MetaMonitorSpec *monitor_spec_a,