[PATCH weston 2/3] compositor-drm: Avoid connector_allocator for hotplugs
Daniel Stone
daniels at collabora.com
Thu Feb 9 14:54:27 UTC 2017
Rather than using connector_allocator to determine whether an output is
newly connected or not, use a list walk across all outputs instead.
Signed-off-by: Daniel Stone <daniels at collabora.com>
Reported-by: Peter Senna Tschudin <peter.senna at collabora.com>
---
libweston/compositor-drm.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index c7da44722..90f91006a 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -2746,6 +2746,8 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
/* collect new connects */
for (i = 0; i < resources->count_connectors; i++) {
uint32_t connector_id = resources->connectors[i];
+ struct drm_output *tmp;
+ bool newly_connected = true;
connector = drmModeGetConnector(b->drm.fd, connector_id);
if (connector == NULL)
@@ -2763,14 +2765,27 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
connected |= (1 << connector_id);
- if (!(b->connector_allocator & (1 << connector_id))) {
- create_output_for_connector(b, resources,
- connector, drm_device);
- weston_log("connector %d connected\n", connector_id);
+ wl_list_for_each(tmp, &b->compositor->output_list, base.link) {
+ if (tmp->connector_id == connector_id) {
+ newly_connected = false;
+ break;
+ }
+ }
+ wl_list_for_each(tmp, &b->compositor->pending_output_list, base.link) {
+ if (tmp->connector_id == connector_id) {
+ newly_connected = false;
+ break;
+ }
+ }
- } else {
+ if (!newly_connected) {
drmModeFreeConnector(connector);
+ continue;
}
+
+ create_output_for_connector(b, resources,
+ connector, drm_device);
+ weston_log("connector %d connected\n", connector_id);
}
drmModeFreeResources(resources);
--
2.11.0
More information about the wayland-devel
mailing list