[PATCH weston v2 2/3] compositor-drm: Avoid connector_allocator for hotplugs
Quentin Glidic
sardemff7+wayland at sardemff7.net
Thu Feb 9 17:36:07 UTC 2017
On 09/02/2017 17:44, Daniel Stone wrote:
> 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>
Seems good:
Reviewed-by: Quentin Glidic <sardemff7+git at sardemff7.net>
Cheers,
> ---
> libweston/compositor-drm.c | 31 +++++++++++++++++++++++++------
> 1 file changed, 25 insertions(+), 6 deletions(-)
>
> v2: Split drm_output_find_by_connector into a separate function.
>
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 5f1ca9592..99699d767 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -257,6 +257,25 @@ drm_output_find_by_crtc(struct drm_backend *b, uint32_t crtc_id)
> 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
> 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);
>
> - if (!(b->connector_allocator & (1 << connector_id))) {
> - create_output_for_connector(b, resources,
> - connector, drm_device);
> - weston_log("connector %d connected\n", connector_id);
> -
> - } else {
> + if (drm_output_find_by_connector(b, connector_id)) {
> drmModeFreeConnector(connector);
> + continue;
> }
> +
> + create_output_for_connector(b, resources,
> + connector, drm_device);
> + weston_log("connector %d connected\n", connector_id);
> }
> drmModeFreeResources(resources);
>
>
--
Quentin “Sardem FF7” Glidic
More information about the wayland-devel
mailing list