mode issue about no EDID and first mode when weston start

Wang, Quanxian quanxian.wang at intel.com
Thu Jul 26 12:54:45 PDT 2012


Hi, All

Help review.

Background
1)      Some platforms has no EDID mode information. Therefore when KMS initializes the driver, there will be no mode provided for user. At that time, have to use the fixed mode defined by the user.(builtin-800x480)
2)      In the very beginning of weston restart, there exists a case, no active mode is set to connector. We provide the first mode gotten from KMS as default mode for connector.

We got weston core dump when weston start because drm will add null mode when cases above happen.

commit 1a87302f288497ed8bbef3677286e27bb6931f72
Author: Wang Quanxian <quanxian.wang at intel.com<mailto:quanxian.wang at intel.com>>
Date:   Wed Jul 25 11:21:00 2012 +0800

    Bug fix for mode issue when weston start

    Provide the default builtin(800x480) mode when platforms
    have no EDID and KMS could not provide mode information.
    In the very beginning of weston, the connector could not
    be set active mode. At that time, take the first mode in
    mode list from KMS as default mode.

    Signed-Off-By Quanxian Wang <quanxian.wang at intel.com<mailto:quanxian.wang at intel.com>>

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 4dffa1d..47cd512 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -143,6 +143,16 @@ struct drm_sprite {
        uint32_t formats[];
 };

+static drmModeModeInfo builtin_800x480 = {
+       33750,                  /* clock */
+       800, 864, 976, 1088, 0,
+       480, 486, 494, 517, 0,
+       59920,
+       DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
+       0,
+       "800x480"
+};
+
 static int
 surface_is_primary(struct weston_compositor *ec, struct weston_surface *es)
 {
@@ -1344,13 +1354,30 @@ create_output_for_connector(struct drm_compositor *ec,
        drmModeFreeEncoder(encoder);
        if (crtc == NULL)
                goto err_free;
-       crtc_mode = crtc->mode;
+
+       /* if don't get mode from drm driver, use default 800x480 */
+       if (crtc->mode.clock != 0)
+       {
+               crtc_mode = crtc->mode;
+       } else {
+               if (connector->count_modes == 0)
+                       crtc_mode = builtin_800x480;
+               else
+                       crtc_mode = connector->modes[0];
+       }
+
        drmModeFreeCrtc(crtc);

-       for (i = 0; i < connector->count_modes; i++) {
-               ret = drm_output_add_mode(output, &connector->modes[i]);
+       if (connector->count_modes == 0) {
+               ret = drm_output_add_mode(output, &crtc_mode);
                if (ret)
                        goto err_free;
+       }else{
+               for (i = 0; i < connector->count_modes; i++) {
+                       ret = drm_output_add_mode(output, &connector->modes[i]);
+                       if (ret)
+                               goto err_free;
+               }
        }

        preferred = NULL;


Thanks

Quanxian Wang


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20120726/b22aff58/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mode_issue_with_weston_start.patch
Type: application/octet-stream
Size: 1902 bytes
Desc: mode_issue_with_weston_start.patch
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20120726/b22aff58/attachment.obj>


More information about the wayland-devel mailing list