compositor-drm: update connectors with connector config

weston can be started with --connector option to be initialized
with a particular output. But in the update_outputs this option
is not considered and output is created for all the available
connectors. This patch fixes this issue by considering
the option for connectors in the update_outputs.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Acked-by: Daniel Stone <daniels@collabora.com>

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index a16136d..073dc19 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -119,6 +119,8 @@
 
 	int32_t cursor_width;
 	int32_t cursor_height;
+
+	uint32_t connector;
 };
 
 struct drm_mode {
@@ -2725,7 +2727,7 @@
 
 	/* collect new connects */
 	for (i = 0; i < resources->count_connectors; i++) {
-		int connector_id = resources->connectors[i];
+		uint32_t connector_id = resources->connectors[i];
 
 		connector = drmModeGetConnector(b->drm.fd, connector_id);
 		if (connector == NULL)
@@ -2736,6 +2738,11 @@
 			continue;
 		}
 
+		if (b->connector && (b->connector != connector_id)) {
+			drmModeFreeConnector(connector);
+			continue;
+		}
+
 		connected |= (1 << connector_id);
 
 		if (!(b->connector_allocator & (1 << connector_id))) {
@@ -3219,6 +3226,8 @@
 		goto err_sprite;
 	}
 
+	b->connector = config->connector;
+
 	if (create_outputs(b, config->connector, drm_device) < 0) {
 		weston_log("failed to create output for %s\n", path);
 		goto err_udev_input;