From c8f24721c5047c5635fe094bb8aa300ed5150796 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Wed, 24 Aug 2016 14:47:51 +0200 Subject: [PATCH] monitor-manager-kms: Use the output naming logic used by the X server Switch to the output naming logic used by the X server's modesetting driver which, in particular, uses drmModeConnector's connector_type_id instead of connector_id. The kernel generates new connector_id's every time there are changes which means we can't identify the same monitor on the same connector after an hardware hotplug. Switching to connector_type_id fixes this. https://bugzilla.gnome.org/show_bug.cgi?id=770338 --- src/backends/native/meta-monitor-manager-kms.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index e0bd36622..2b36dadf1 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -155,14 +155,15 @@ make_output_name (drmModeConnector *connector) "Virtual", "DSI", }; - const char *connector_type_name; if (connector->connector_type < G_N_ELEMENTS (connector_type_names)) - connector_type_name = connector_type_names[connector->connector_type]; + return g_strdup_printf ("%s-%d", + connector_type_names[connector->connector_type], + connector->connector_type_id); else - connector_type_name = "unknown"; - - return g_strdup_printf ("%s%d", connector_type_name, connector->connector_id); + return g_strdup_printf ("Unknown%d-%d", + connector->connector_type, + connector->connector_type_id); } static void