Add PATH to weston.service
[profile/ivi/weston.git] / packaging / weston-mode-nextcom.patch
1 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
2 index 4dffa1d..6239f91 100644
3 --- a/src/compositor-drm.c
4 +++ b/src/compositor-drm.c
5 @@ -143,6 +143,16 @@ struct drm_sprite {
6         uint32_t formats[];
7  };
8  
9 +static drmModeModeInfo builtin_800x480 = {
10 +       33750,                  /* clock */
11 +       800, 864, 976, 1088, 0, 
12 +       480, 486, 494, 517, 0,
13 +       59920,
14 +       DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC,
15 +       0,
16 +       "800x480"
17 +};
18 +
19  static int
20  surface_is_primary(struct weston_compositor *ec, struct weston_surface *es)
21  {
22 @@ -1344,13 +1354,30 @@ create_output_for_connector(struct drm_compositor *ec,
23         drmModeFreeEncoder(encoder);
24         if (crtc == NULL)
25                 goto err_free;
26 -       crtc_mode = crtc->mode;
27 +
28 +       /* if don't get mode from drm driver, use default 800x480 */
29 +        if (crtc->mode.clock != 0)
30 +       {
31 +               crtc_mode = crtc->mode;
32 +       } else {
33 +               if (connector->count_modes == 0)
34 +                       crtc_mode = builtin_800x480;
35 +               else
36 +                       crtc_mode = connector->modes[0];
37 +       }
38 +
39         drmModeFreeCrtc(crtc);
40  
41 -       for (i = 0; i < connector->count_modes; i++) {
42 -               ret = drm_output_add_mode(output, &connector->modes[i]);
43 +       if (connector->count_modes == 0) {
44 +               ret = drm_output_add_mode(output, &crtc_mode);
45                 if (ret)
46                         goto err_free;
47 +       }else{
48 +               for (i = 0; i < connector->count_modes; i++) {
49 +                       ret = drm_output_add_mode(output, &connector->modes[i]);
50 +                       if (ret)
51 +                               goto err_free;
52 +               }
53         }
54  
55         preferred = NULL;