[Intel-gfx] [Patch 3/3]: [DRM/I915] : Sync the default modes for LVDS output device

yakui_zhao yakui.zhao at intel.com
Mon Mar 23 03:27:16 CET 2009


On Sat, 2009-03-21 at 03:59 +0800, Eric Anholt wrote:
> On Fri, 2009-03-20 at 14:13 +0800, yakui_zhao wrote:
> > Subject: [DRM/I915]: Sync the default modes for LVDS output device
> > From: Zhao Yakui <yakui.zhao at intel.com>
> > 
> >     Sync the default modes for the LVDS output device
> >     This covers:
> >     Add the default modes for the LVDS output device.
> >     The bit of edid->feature.msc indicates whether the display device is not
> > continous-frequency. And it is used to determine whether the default modes will
> > be added to the output device.
> >     But for the LVDS output device the edid->feature.msc will always be set.Even
> > when there is no edid, the corresponding bit in the fake edid will be set.
> > In such case the default modes will be added to LVDS output device.
> >     If not, the modes obtained by using KMS/UMS will be different.
> 
> Similar whitespace concerns in this and the previous patch as the first,
> plus a couple of review comments below.
> 
> > Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_lvds.c |  422 +++++++++++++++++++++++++++++++++++++-
> >  1 file changed, 412 insertions(+), 10 deletions(-)
> > 
> > Index: linux-2.6/drivers/gpu/drm/i915/intel_lvds.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/gpu/drm/i915/intel_lvds.c	2009-03-20 11:51:53.000000000 +0800
> > +++ linux-2.6/drivers/gpu/drm/i915/intel_lvds.c	2009-03-20 13:36:03.000000000 +0800
> > @@ -36,6 +36,381 @@
> >  #include "intel_drv.h"
> >  #include "i915_drm.h"
> >  #include "i915_drv.h"
> > +/*
> > + * the default modes, which is based on the file of
> > + * xserver/xfree86/common/xf86DefModeSet.c.
> > + */
> > +static struct drm_display_mode default_modes[] = {
> > +	/* 640x350 at 85Hz */
> > +	{ DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 31500, 640, 672,
> > +		   736, 832, 0, 350, 382, 385, 445, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 320x175 at 85Hz */
> > +	{ DRM_MODE("320x175", DRM_MODE_TYPE_DRIVER, 15750, 320, 336,
> > +		   368, 416, 0, 175, 191, 192, 222, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 640x400 at 85Hz */
> > +	{ DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER, 31500, 640, 672,
> > +		   736, 832, 0, 400, 401, 405, 445, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 320x200 at 85Hz */
> > +	{ DRM_MODE("320x200", DRM_MODE_TYPE_DRIVER, 15750, 320, 336,
> > +		   368, 416, 0, 200, 200, 202, 222, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 720x400 at 85Hz */
> > +	{ DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 756,
> > +		   828, 936, 0, 400, 401, 405, 446, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 360x200 at 85Hz */
> > +	{ DRM_MODE("360x200", DRM_MODE_TYPE_DRIVER, 17750, 360, 378,
> > +		   414, 468, 0, 200, 200, 202, 223, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 640x480 at 60Hz */
> > +	{ DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 600, 656,
> > +		   752, 800, 0, 480, 490, 492, 525, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 320x240 at 60Hz */
> > +	{ DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 12587, 320, 328,
> > +		   376, 400, 0, 240, 245, 246, 262, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 640x480 at 72Hz */
> > +	{ DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664,
> > +		   704, 832, 0, 480, 489, 492, 520, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 320x240 at 72Hz */
> > +	{ DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 15750, 320, 332,
> > +		   352, 416, 0, 240, 244, 246, 260, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 640x480 at 75Hz */
> > +	{ DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656,
> > +		   720, 840, 0, 480, 481, 484, 500, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 320x240 at 75Hz */
> > +	{ DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 15750, 320, 328,
> > +		   360, 420, 0, 240, 240, 242, 250, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 640x480 at 85Hz */
> > +	{ DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 36000, 640, 696,
> > +		   752, 832, 0, 480, 481, 484, 509, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 320x240 at 85Hz */
> > +	{ DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 18000, 320, 348,
> > +		   376, 416, 0, 240, 240, 242, 254, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 800x600 at 56Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824,
> > +		   968, 1024, 0, 600, 601, 603, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 400x300 at 56Hz */
> > +	{ DRM_MODE("400x300", DRM_MODE_TYPE_DRIVER, 18000, 400, 412,
> > +		   484, 512, 0, 300, 300, 301, 312, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 800x600 at 60Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840,
> > +		   968, 1056, 0, 600, 601, 605,  628, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 400x300 at 60Hz */
> > +	{ DRM_MODE("400x300", DRM_MODE_TYPE_DRIVER, 20000, 400, 426,
> > +		   484, 528, 0, 300, 300, 302, 314, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 800x600 at 72Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856,
> > +		   976, 1040, 0, 600, 637, 643, 666, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 400x300 at 72Hz */
> > +	{ DRM_MODE("400x300", DRM_MODE_TYPE_DRIVER, 25000, 400, 428,
> > +		   488, 520, 0, 300, 318, 321, 333, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 800x600 at 75Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816,
> > +		   896, 1056, 0, 600, 601, 604, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 400x300 at 75Hz */
> > +	{ DRM_MODE("400x300", DRM_MODE_TYPE_DRIVER, 24750, 400, 408,
> > +		   448, 528, 0, 300, 300, 302, 312, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 800x600 at 85Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 56300, 800, 832,
> > +		   896, 1048, 0, 600, 601, 604,  631, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 400x300 at 85Hz */
> > +	{ DRM_MODE("400x300", DRM_MODE_TYPE_DRIVER, 28150, 400, 416,
> > +		   448, 524, 0, 300, 300, 302, 315, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1024x768 at 43Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 44900, 1024, 1032,
> > +		   1208, 1264, 0, 768, 768, 776,  817, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 512x384 at 43Hz */
> > +	{ DRM_MODE("512x384", DRM_MODE_TYPE_DRIVER, 22450, 512, 516,
> > +		   604, 632, 0, 384, 384, 388, 408, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1024x768 at 60Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048,
> > +		   1184, 1344, 0, 768, 771, 777, 806, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 512x384 at 60Hz */
> > +	{ DRM_MODE("512x384", DRM_MODE_TYPE_DRIVER, 32500, 512, 524,
> > +		   592, 672, 0, 384, 385, 388, 403, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1024x768 at 70Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1020, 1048,
> > +		   1184, 1328, 0, 768, 771, 777, 806, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 512x384 at 70Hz */
> > +	{ DRM_MODE("512x384", DRM_MODE_TYPE_DRIVER, 37500, 510, 524,
> > +		   592, 664, 0, 384, 385, 388, 403, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1024x768 at 75Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78750, 1024, 1040,
> > +		   1136, 1312, 0, 768, 769, 772, 800, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 512x384 at 75Hz */
> > +	{ DRM_MODE("512x384", DRM_MODE_TYPE_DRIVER, 39375, 512, 520,
> > +		   568, 656, 0, 384, 384, 386, 400, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1024x768 at 85Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072,
> > +		   1168, 1376, 0, 768, 769, 772, 808, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 512x384 at 85Hz */
> > +	{ DRM_MODE("512x384", DRM_MODE_TYPE_DRIVER, 47250, 512, 536,
> > +		   584, 688, 0, 384, 384, 386, 404, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1152x864 at 75Hz */
> > +	{ DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216,
> > +		   1344, 1600, 0, 864, 865, 868, 900, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 576x432 at 85Hz */
> > +	{ DRM_MODE("576x432", DRM_MODE_TYPE_DRIVER, 54000, 576, 608,
> > +		   672, 800, 0, 432, 432, 434, 450, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1280x960 at 60Hz */
> > +	{ DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1376,
> > +		   1488, 1800, 0, 960, 961, 964, 1000, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 1280x960 at 60Hz */
> > +	{ DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 540000, 640, 684,
> > +		   744, 900, 0, 480, 480, 482, 500, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1280x960 at 85Hz */
> > +	{ DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1344,
> > +		   1504, 1728, 0, 960, 961, 964,  1011, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 1280x960 at 85Hz */
> > +	{ DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 74250, 640, 672,
> > +		   752, 864, 0, 480, 480, 482, 505, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1280x1024 at 60Hz */
> > +	{ DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1328,
> > +		   1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 640x512 at 60Hz */
> > +	{ DRM_MODE("640x512", DRM_MODE_TYPE_DRIVER, 54000, 640, 664,
> > +		   720, 744, 0, 512, 512, 514, 533, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1280x1024 at 75Hz */
> > +	{ DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296,
> > +		   1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 640x512 at 75Hz */
> > +	{ DRM_MODE("640x512", DRM_MODE_TYPE_DRIVER, 67500, 640, 648,
> > +		   720, 844, 0, 512, 512, 514, 533, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1280x1024 at 85Hz */
> > +	{ DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 157500, 1280, 1344,
> > +		   1504, 1728, 0, 1024, 1025, 1028, 1072, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 640x512 at 85Hz */
> > +	{ DRM_MODE("640x512", DRM_MODE_TYPE_DRIVER, 78750, 640, 672,
> > +		   752, 864, 0, 512, 512, 514, 536, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1600x1200 at 60Hz */
> > +	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 162000, 1600, 1664,
> > +		   1854, 2160, 0, 1200, 1201, 1205, 1250, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 800x600 at 60Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 81000, 800, 832,
> > +		   928, 1080, 0, 600, 600, 602, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1600x1200 at 65Hz */
> > +	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 175500, 1600, 1664,
> > +		   1854, 2160, 0, 1200, 1201, 1205, 1250, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 800x600 at 65Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 87750, 800, 832,
> > +		   928, 1080, 0, 600, 600, 602, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1600x1200 at 70Hz */
> > +	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 189000, 1600, 1664,
> > +		   1854, 2160, 0, 1200, 1201, 1205, 1250, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 800x600 at 70Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 94500, 800, 832,
> > +		   928, 1080, 0, 600, 600, 602, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1600x1200 at 75Hz */
> > +	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 202500, 1600, 1664,
> > +		   1854, 2160, 0, 1200, 1201, 1205, 1250, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 800x600 at 75Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 101250, 800, 832,
> > +		   928, 1080, 0, 600, 600, 602, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1600x1200 at 85Hz */
> > +	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 229500, 1600, 1664,
> > +		   1854, 2160, 0, 1200, 1201, 1205, 1250, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 800x600 at 85Hz */
> > +	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 114750, 800, 832,
> > +		   928, 1080, 0, 600, 600, 602, 625, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1792x1344 at 60Hz */
> > +	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 204800, 1792, 1920,
> > +		   2104, 2448, 0, 1344, 1345, 1348, 1394, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 896x672 at 60Hz */
> > +	{ DRM_MODE("896x672", DRM_MODE_TYPE_DRIVER, 102400, 896, 960,
> > +		   1052, 1224, 0, 672, 672, 674, 697, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1792x1344 at 75Hz */
> > +	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 261000, 1792, 1888,
> > +		   2104, 2456, 0, 1344, 1345, 1348, 1417, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 896x672 at 75Hz */
> > +	{ DRM_MODE("896x672", DRM_MODE_TYPE_DRIVER, 130500, 896, 944,
> > +		   1052, 1228, 0, 672, 672, 674, 708, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1856x1392 at 60Hz */
> > +	{ DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 218300, 1856, 1952,
> > +		   2176, 2528, 0, 1392, 1393, 1396, 1439, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 928x696 at 60Hz */
> > +	{ DRM_MODE("928x696", DRM_MODE_TYPE_DRIVER, 109150, 928, 976,
> > +		   1088, 1264, 0, 696, 696, 698, 719, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1856x1392 at 75Hz */
> > +	{ DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 288000, 1792, 1984,
> > +		   2208, 2560, 0, 1392, 1393, 1396, 1500, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 928x696 at 75Hz */
> > +	{ DRM_MODE("928x696", DRM_MODE_TYPE_DRIVER, 144000, 896, 992,
> > +		   1104, 1280, 0, 696, 696, 698, 750, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1920x1440 at 60Hz */
> > +	{ DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 234000, 1920, 2048,
> > +		   2256, 2600, 0, 1440, 1441, 1444, 1500, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 960x720 at 60Hz */
> > +	{ DRM_MODE("960x720", DRM_MODE_TYPE_DRIVER, 117000, 960, 1024,
> > +		   1128, 1300, 0, 720, 720, 722, 750, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 1920x1440 at 75Hz */
> > +	{ DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2064,
> > +		   2288, 2640, 0, 1440, 1441, 1444, 1500, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 960x720 at 75Hz */
> > +	{ DRM_MODE("960x720", DRM_MODE_TYPE_DRIVER, 148500, 960, 1032,
> > +		   1144, 1320, 0, 720, 720, 722, 750, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* 832x624 at 75Hz (fix if the official/Apple spec is different) */
> > +	{ DRM_MODE("832x624", DRM_MODE_TYPE_DRIVER, 57284, 832, 864,
> > +		   928, 1152, 0, 624, 625, 628, 667, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* 416x312 at 75Hz (fix if the official/Apple spec is different) */
> > +	{ DRM_MODE("416x312", DRM_MODE_TYPE_DRIVER, 28642, 416, 432,
> > +		   464, 576, 0, 312, 312, 314, 333, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* vesa GTF 1400x1050 at 60Hz */
> > +	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 122200, 1400, 1488,
> > +		   1640, 1880, 0, 1050, 1052, 1064, 1082, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* vesa GTF 700x525 at 60Hz */
> > +	{ DRM_MODE("700x525", DRM_MODE_TYPE_DRIVER, 61100, 700, 744,
> > +		   820, 940, 0, 525, 526, 532, 541, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* vesa GTF 1400x1050 at 75Hz */
> > +	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 155800, 1400, 1464,
> > +		   1784, 1912, 0, 1050, 1052, 1064, 1090, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* vesa GTF 700x525 at 75Hz */
> > +	{ DRM_MODE("700x525", DRM_MODE_TYPE_DRIVER, 77900, 700, 732,
> > +		   892, 956, 0, 525, 526, 532, 545, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* vesa GTF 1920x1440 at 85Hz */
> > +	{ DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 341350, 1920, 2072,
> > +		   2288, 2656, 0, 1440, 1441, 1444, 1512, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* vesa GFT 960x720 at 85Hz */
> > +	{ DRM_MODE("960x720", DRM_MODE_TYPE_DRIVER, 170675, 960, 1036,
> > +		   1144, 1328, 0, 720, 720, 722, 756, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* vesa GTF 2048x1536 at 60Hz */
> > +	{ DRM_MODE("2048x1536", DRM_MODE_TYPE_DRIVER, 266950, 2048, 2200,
> > +		   2424, 2800, 0, 1536, 1537, 1540, 1589, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* vesa GTF 1024x768 at 60Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 133475, 1024, 1100,
> > +		   1212, 1400, 0, 768, 768, 770, 794, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* vesa GTF 2048x1536 at 75Hz */
> > +	{ DRM_MODE("2048x1536", DRM_MODE_TYPE_DRIVER, 340480, 2048, 2216,
> > +		   2440, 2832, 0, 1536, 1537, 1540, 1603, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* vesa GTF 1024x768 at 75Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 170240, 1024, 1108,
> > +		   1220, 1416, 0, 768, 768, 770, 801, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +	/* vesa GTF 2048x1536 at 85Hz */
> > +	{ DRM_MODE("2048x1536", DRM_MODE_TYPE_DRIVER, 388040, 2048, 2216,
> > +		   2440, 2832, 0, 1536, 1537, 1540, 1612, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
> > +	/* vesa GTF 1024x768 at 85Hz */
> > +	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 194020, 1024, 1108,
> > +		   1220, 1416, 0, 768, 768, 770, 806, 0,
> > +		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
> > +					DRM_MODE_FLAG_DBLSCAN) },
> > +};
> 
> This modes list looks like the EDID established modes plus a few extra
> GTF modes.  Why are we statically putting this list in intel_lvds.c
> instead of accessing the established modes plus cooking up a few GTF
> modes on the fly?
The above default modes are copied from the file of xf86DefModeSet.c. It
includes the VESA default mode and the VESA extra timing mode.
   And the vesa default mode seems more than the EDID established modes.
At the same time the doublescan modes are also included.

In the UMS mode this is added to the mode list by the xserver according
to the flag of edid->feature.msc bit. And this is applied to all the
output devices with the EDID.(For the LVDS device the fake EDID will be
constructed even when no EDID is obtained. And the default modes will be
added to mode list.)

In the KMS mode I don't know whether the default modes should be added
to the mode list for other output device with the EDID besides the LVDS.
So the default modes are added to the mode list only for LVDS device.

> 
> >  /*
> >   * the following four scaling options are defined.
> > @@ -481,6 +856,22 @@
> >  }
> >  
> >  /**
> > + * Add the default mode to .
> > + */
> 
> Sentence fragment?
> 
> > +static int lvds_add_default_modes(struct drm_connector *connector)
> > +{
> > +	int i, num_modes = 0;
> > +	struct drm_device *dev = connector->dev;
> > +	num_modes = sizeof(default_modes)/sizeof(struct drm_display_mode);
> > +	for (i = 0; i < num_modes; i++) {
> > +		struct drm_display_mode *mode;
> > +
> > +		mode = drm_mode_duplicate(dev, &default_modes[i]);
> > +		drm_mode_probed_add(connector, mode);
> > +	}
> > +	return num_modes;
> > +}
> > +/**
> >   * Return the list of DDC modes if available, or the BIOS fixed mode otherwise.
> >   */
> >  static int intel_lvds_get_modes(struct drm_connector *connector)
> > @@ -488,13 +879,24 @@
> >  	struct drm_device *dev = connector->dev;
> >  	struct intel_output *intel_output = to_intel_output(connector);
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> > -	int ret = 0;
> > -
> > -	ret = intel_ddc_get_modes(intel_output);
> > -
> > -	if (ret)
> > -		return ret;
> > +	int ddc_ret = 0, ret = 0, fixed_ret = 0;
> >  
> > +	ddc_ret = intel_ddc_get_modes(intel_output);
> 
> Could we rename ret to "mode_count" or something?  int ret is usually "0
> or a -ESOMETHING", while here it's a count of modes we've added to the
> output.
> 
> > +	/*
> > +	 * When there exists the EDID info, the bit of feature.msc will always
> > +	 * be set.
> > +	 * It seems that bit of feature.msc will also be set even when the
> > +	 * bogus edid_mon is constructed in 2D driver.
> > +	 * So in such case the default mode will be added.
> > +	 */
> > +	if (ddc_ret) {
> > +		/*
> > +		 * If the mode can be parsed from the EDID info, we will try
> > +		 * to add the default mode
> > +		 */
> > +		fixed_ret = 0;
> > +		goto add_default_mode;
> > +	}
> 
> Please just put the non-DDC path following this goto under if (!ddc_ret)
> {} and don't do this goto.
> 
> >  	/* Didn't get an EDID, so
> >  	 * Set wide sync ranges so we get all modes
> >  	 * handed to valid_mode for checking
> > @@ -509,11 +911,11 @@
> >  
> >  		mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode);
> >  		drm_mode_probed_add(connector, mode);
> > -
> > -		return 1;
> > +		fixed_ret = 1;
> >  	}
> > -
> > -	return 0;
> > +add_default_mode:
> > +	ret = lvds_add_default_modes(connector);
> > +	return 	ddc_ret + fixed_ret + ret;
> >  }
> >  
> >  /**
> > 
> > 




More information about the Intel-gfx mailing list