compositor-drm: Avoid connector_allocator for hotplugs

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@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reported-by: Peter Senna Tschudin <peter.senna@collabora.com>
dev
Daniel Stone 8 years ago
parent 72c0e1b821
commit c0ec75919a
  1. 29
      libweston/compositor-drm.c

@ -257,6 +257,25 @@ drm_output_find_by_crtc(struct drm_backend *b, uint32_t crtc_id)
return NULL; return NULL;
} }
static struct drm_output *
drm_output_find_by_connector(struct drm_backend *b, uint32_t connector_id)
{
struct drm_output *output;
wl_list_for_each(output, &b->compositor->output_list, base.link) {
if (output->connector_id == connector_id)
return output;
}
wl_list_for_each(output, &b->compositor->pending_output_list,
base.link) {
if (output->connector_id == connector_id)
return output;
}
return NULL;
}
static void static void
drm_fb_destroy_callback(struct gbm_bo *bo, void *data) drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
{ {
@ -2764,14 +2783,14 @@ update_outputs(struct drm_backend *b, struct udev_device *drm_device)
connected |= (1 << connector_id); connected |= (1 << connector_id);
if (!(b->connector_allocator & (1 << connector_id))) { if (drm_output_find_by_connector(b, connector_id)) {
drmModeFreeConnector(connector);
continue;
}
create_output_for_connector(b, resources, create_output_for_connector(b, resources,
connector, drm_device); connector, drm_device);
weston_log("connector %d connected\n", connector_id); weston_log("connector %d connected\n", connector_id);
} else {
drmModeFreeConnector(connector);
}
} }
drmModeFreeResources(resources); drmModeFreeResources(resources);

Loading…
Cancel
Save