bug fix inactive encoder when weston restart

Kristian Høgsberg hoegsberg at gmail.com
Mon Jul 30 15:15:00 PDT 2012


On Thu, Jul 26, 2012 at 08:03:26PM +0000, Wang, Quanxian wrote:
> Hi, All
> 
> Please help review the patch.
> 
> Thanks
> 
> Background:
> If we use 'pkill -9 weston', when restart weston, weston could not get the active encoder attached on connector and exit abnormally.
> This is because when weston is pkilled, drm cleanups the encoders attached to active connector in KMS.
> This patch will ignore the active encode checking, weston has the ability to re-initialize encoder and reattached it into connector.

Good catch.  We don't handle connectors that aren't attached to a
crtc, which happens in your case above, but also just when hotplugging
a monitor.  I applied your patch with a few changes, mostly to deal
with how we don't have the built-in mode.  We now just exit if we
don't find any modes to the output.

Kristian

> commit 7f991195c20d9dd57e14faf88cd36db0c77df424
> Author: Wang Quanxian <quanxian.wang at intel.com>
> Date:   Thu Jul 19 19:11:04 2012 +0800
>     User sends SIGKILL to weston, KMS will clean up encoder
>     attached with connector. When weston restarts again, it causes
>     exit of weston because no active encoder is attached to connector.
>     This patch will ignore the checking and weston will initialize
>     encoder again and re-attach it to connector in the following process.
> 
>     Sign-Off-By Quanxian Wang <quanxian.wang at intel.com>
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 47cd512..bb1b138 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -1348,26 +1348,28 @@ create_output_for_connector(struct drm_compositor *ec,
>         /* Get the current mode on the crtc that's currently driving
>          * this connector. */
>         encoder = drmModeGetEncoder(ec->drm.fd, connector->encoder_id);
> -       if (encoder == NULL)
> -               goto err_free;
> -       crtc = drmModeGetCrtc(ec->drm.fd, encoder->crtc_id);
> -       drmModeFreeEncoder(encoder);
> -       if (crtc == NULL)
> -               goto err_free;
> -
> -       /* if don't get mode from drm driver, use default 800x480 */
> -        if (crtc->mode.clock != 0)
> -       {
> +       if (encoder != NULL)
> +        {
> +               crtc = drmModeGetCrtc(ec->drm.fd, encoder->crtc_id);
> +               drmModeFreeEncoder(encoder);
> +               if (crtc == NULL)
> +                       goto err_free;
>                 crtc_mode = crtc->mode;
> -       } else {
> +               drmModeFreeCrtc(crtc);
> +       }
> +       /*
> +        * No actiave encoder is connected with the connector
> +        * If connector has no mode available, takes detault mode
> +        * Or takes the first mode from connector
> +        */
> +       if (encoder == NULL || crtc_mode.clock == 0)
> +        {
>                 if (connector->count_modes == 0)
>                         crtc_mode = builtin_800x480;
>                 else
>                         crtc_mode = connector->modes[0];
>         }
> 
> -       drmModeFreeCrtc(crtc);
> -
>         if (connector->count_modes == 0) {
>                 ret = drm_output_add_mode(output, &crtc_mode);
>                 if (ret)
> 
> 
> Thanks
> 
> Quanxian Wang
> 
> 


> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel



More information about the wayland-devel mailing list