I already brought this up on IRC before and finally started to work on
it. The goal is to give an Wayland client some identifier which allows
it to recognize the physical connector which corresponds to some Wayland
output.
The rationale why such an API is useful is that a client might want to
ensure that it's content is available on some well-known connector.
Imagine, for example, a video player which "knows" that the projector is
connected to the second HDMI port.
Our use case is like that: We have an Wayland application which, running
under the fullscreen shell, presents one surface per output. That
application can be configured to display windows showing variety of
video sources via a network API (by the means of sub-surfaces, though
that doesn't matter here). Given this, a "master" application can talk
to a number of computers running said application to create a video wall
of arbitrary size. A problem arises when more than one physical display
is connected to any "client" computer: There is currently no way for a
Wayland client to uniquely identify more than one display (or output)
across reboots or connector plug/unplug events. Because of this it is
not possible to reliably use more than one display per client computer
while having a sane way to configure the physical arrangement of all
connected displays. That's not so nice.
The attached patches establish a minimal API which allows clients to
know the (DRM) connector name of outputs, thus enabling our use case
(and possibly others, at least one came up on IRC which I unfortunately
do not remember).
The first patch extends the "wl_output" interface by a new "connector"
event, providing a string to the client which can be used as a stable
identifier for that output. I'm unsure if this version bump to the core
Wayland protocol is acceptable, but to me this seems the obvious place
where this information should be published. A lot of monitor related
information (resolution(s), physical size, maker, model, ...) is already
published there, so it seems natural. The documentation is missing
there, but I imagine it would state that this identifier is
* stable (across restarts)
* unique (there are no two outputs per connector)
* optional (some implementations may not have this information
available)
The other two patches are a rudimentary implementation of this protocol
extension in Weston, taking advantage of the fact that Weston's internal
output struct already has the connector name available.
I'd like to know if
* extending the Wayland protocol for this is acceptable or if this
should go into a separate protocol
* calling the exposed information "connector name" (hinting that we're
talking about a physical plug) or something more generic like "output
identifier" seems a better idea
* if the proposed way of making the information accessible to clients
is not acceptable, what else should be done
Kind regards,
-Matthias
--
For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled. (R.P. Feynman)
From 81cbe8fc228f8092254de98571565c07b93a8351 Mon Sep 17 00:00:00 2001
From: Matthias Treydte <[email protected]>
Date: Thu, 26 Jan 2017 15:53:02 +0100
Subject: [PATCH] protocol: Add connector_name event to wl_output
---
protocol/wayland.xml | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 29b63be..287a587 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -2338,7 +2338,7 @@
</event>
</interface>
- <interface name="wl_output" version="3">
+ <interface name="wl_output" version="4">
<description summary="compositor output region">
An output describes part of the compositor geometry. The
compositor works in the 'compositor coordinate system' and an
@@ -2486,6 +2486,11 @@
use the output object anymore.
</description>
</request>
+
+ <event name="connector" since="4">
+ <arg name="connector_name" type="string"
+ summary="name of the connector"/>
+ </event>
</interface>
<interface name="wl_region" version="1">
--
2.11.1
From 9260ce9e40ebee3962b8f7ec55ad79c1a826823a Mon Sep 17 00:00:00 2001
From: Matthias Treydte <[email protected]>
Date: Thu, 26 Jan 2017 15:58:38 +0100
Subject: [PATCH 1/2] libweston: Initial stab for connector-name
---
libweston/compositor.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 9ded23f3..aac64c51 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4204,6 +4204,9 @@ bind_output(struct wl_client *client,
mode->refresh);
}
+ if (version >= WL_OUTPUT_CONNECTOR_SINCE_VERSION)
+ wl_output_send_connector(resource, output->name);
+
if (version >= WL_OUTPUT_DONE_SINCE_VERSION)
wl_output_send_done(resource);
}
@@ -4636,7 +4639,7 @@ weston_output_enable(struct weston_output *output)
output->compositor->output_id_pool |= 1u << output->id;
output->global =
- wl_global_create(c->wl_display, &wl_output_interface, 3,
+ wl_global_create(c->wl_display, &wl_output_interface, 4,
output, bind_output);
output->enabled = true;
--
2.11.1
From 0ec417dd715ae9a42e8cd49613a9e3a76639e292 Mon Sep 17 00:00:00 2001
From: Matthias Treydte <[email protected]>
Date: Thu, 26 Jan 2017 15:59:02 +0100
Subject: [PATCH 2/2] weston-info: Show output's connector name
---
clients/weston-info.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/clients/weston-info.c b/clients/weston-info.c
index 712346a0..e8c94213 100644
--- a/clients/weston-info.c
+++ b/clients/weston-info.c
@@ -79,6 +79,7 @@ struct output_info {
} geometry;
struct wl_list modes;
+ char *connector_name;
};
struct shm_format {
@@ -238,6 +239,14 @@ print_output_info(void *data)
printf(" preferred");
printf("\n");
}
+
+ if (output->version >= 4) {
+ if (output->connector_name) {
+ printf("\tconnector name: %s\n", output->connector_name);
+ } else {
+ printf("\tconnector name: (unknown)\n");
+ }
+ }
}
static void
@@ -517,11 +526,19 @@ output_handle_scale(void *data, struct wl_output *wl_output,
output->geometry.scale = scale;
}
+static void
+output_handle_connector_name(void *data, struct wl_output *wl_output, const char *name) {
+ struct output_info *output = data;
+
+ output->connector_name = xstrdup(name);
+}
+
static const struct wl_output_listener output_listener = {
output_handle_geometry,
output_handle_mode,
output_handle_done,
output_handle_scale,
+ output_handle_connector_name,
};
static void
@@ -541,6 +558,9 @@ destroy_output_info(void *data)
wl_list_remove(&mode->link);
free(mode);
}
+
+ if (output->connector_name != NULL)
+ free(output->connector_name);
}
static void
@@ -552,7 +572,7 @@ add_output_info(struct weston_info *info, uint32_t id, uint32_t version)
output->global.print = print_output_info;
output->global.destroy = destroy_output_info;
- output->version = MIN(version, 2);
+ output->version = MIN(version, 4);
output->geometry.scale = 1;
wl_list_init(&output->modes);
--
2.11.1
_______________________________________________
wayland-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/wayland-devel