Adam Jackson wrote:
> +static int drm_cvt_modes(struct drm_connector *connector,
> +                      struct detailed_timing *timing)
> +{
> +     int i, j, modes = 0;
> +     struct drm_display_mode *newmode;
> +     struct drm_device *dev = connector->dev;
> +     struct cvt_timing *cvt;
> +     const int rates[] = { 60, 85, 75, 60, 50 };
> +
> +     for (i = 0; i < 4; i++) {
> +             int width, height;
> +             cvt = &(timing->data.other_data.data.cvt[i]);
> +
> +             height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
> +             switch (cvt->code[1] & 0xc0) {

Is it just me, or do the above two lines look very wrong?
1) Height can never be between 512 and 8194.
2) Same bits are used for height and aspect ratio.


> +             case 0x00:
> +                     width = height * 4 / 3;
> +                     break;
> +             case 0x40:
> +                     width = height * 16 / 9;
> +                     break;
> +             case 0x80:
> +                     width = height * 16 / 10;
> +                     break;
> +             case 0xc0:
> +                     width = height * 15 / 9;
> +                     break;
> +             }
> +
> +             for (j = 1; j < 5; j++) {
> +                     if (cvt->code[2] & (1 << j)) {
> +                             newmode = drm_cvt_mode(dev, width, height,
> +                                                    rates[j], j == 0,
> +                                                    false, false);
> +                             if (newmode) {
> +                                     drm_mode_probed_add(connector, newmode);
> +                                     modes++;
> +                             }
> +                     }
> +             }
> +     }
> +
> +     return modes;
> +}

-- 
Anssi Hannula

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to