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.

===
commit 7f991195c20d9dd57e14faf88cd36db0c77df424
Author: Wang Quanxian <quanxian.w...@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.w...@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


Attachment: bug_fix_for_previous_inactive_encoder.patch
Description: bug_fix_for_previous_inactive_encoder.patch

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

Reply via email to