1*4882a593Smuzhiyun================================= 2*4882a593Smuzhiyunmodedb default video mode support 3*4882a593Smuzhiyun================================= 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun 6*4882a593SmuzhiyunCurrently all frame buffer device drivers have their own video mode databases, 7*4882a593Smuzhiyunwhich is a mess and a waste of resources. The main idea of modedb is to have 8*4882a593Smuzhiyun 9*4882a593Smuzhiyun - one routine to probe for video modes, which can be used by all frame buffer 10*4882a593Smuzhiyun devices 11*4882a593Smuzhiyun - one generic video mode database with a fair amount of standard videomodes 12*4882a593Smuzhiyun (taken from XFree86) 13*4882a593Smuzhiyun - the possibility to supply your own mode database for graphics hardware that 14*4882a593Smuzhiyun needs non-standard modes, like amifb and Mac frame buffer drivers (which 15*4882a593Smuzhiyun use macmodes.c) 16*4882a593Smuzhiyun 17*4882a593SmuzhiyunWhen a frame buffer device receives a video= option it doesn't know, it should 18*4882a593Smuzhiyunconsider that to be a video mode option. If no frame buffer device is specified 19*4882a593Smuzhiyunin a video= option, fbmem considers that to be a global video mode option. 20*4882a593Smuzhiyun 21*4882a593SmuzhiyunValid mode specifiers (mode_option argument):: 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd] 24*4882a593Smuzhiyun <name>[-<bpp>][@<refresh>] 25*4882a593Smuzhiyun 26*4882a593Smuzhiyunwith <xres>, <yres>, <bpp> and <refresh> decimal numbers and <name> a string. 27*4882a593SmuzhiyunThings between square brackets are optional. 28*4882a593Smuzhiyun 29*4882a593SmuzhiyunIf 'M' is specified in the mode_option argument (after <yres> and before 30*4882a593Smuzhiyun<bpp> and <refresh>, if specified) the timings will be calculated using 31*4882a593SmuzhiyunVESA(TM) Coordinated Video Timings instead of looking up the mode from a table. 32*4882a593SmuzhiyunIf 'R' is specified, do a 'reduced blanking' calculation for digital displays. 33*4882a593SmuzhiyunIf 'i' is specified, calculate for an interlaced mode. And if 'm' is 34*4882a593Smuzhiyunspecified, add margins to the calculation (1.8% of xres rounded down to 8 35*4882a593Smuzhiyunpixels and 1.8% of yres). 36*4882a593Smuzhiyun 37*4882a593Smuzhiyun Sample usage: 1024x768M@60m - CVT timing with margins 38*4882a593Smuzhiyun 39*4882a593SmuzhiyunDRM drivers also add options to enable or disable outputs: 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun'e' will force the display to be enabled, i.e. it will override the detection 42*4882a593Smuzhiyunif a display is connected. 'D' will force the display to be enabled and use 43*4882a593Smuzhiyundigital output. This is useful for outputs that have both analog and digital 44*4882a593Smuzhiyunsignals (e.g. HDMI and DVI-I). For other outputs it behaves like 'e'. If 'd' 45*4882a593Smuzhiyunis specified the output is disabled. 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunYou can additionally specify which output the options matches to. 48*4882a593SmuzhiyunTo force the VGA output to be enabled and drive a specific mode say:: 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun video=VGA-1:1280x1024@60me 51*4882a593Smuzhiyun 52*4882a593SmuzhiyunSpecifying the option multiple times for different ports is possible, e.g.:: 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun video=LVDS-1:d video=HDMI-1:D 55*4882a593Smuzhiyun 56*4882a593SmuzhiyunOptions can also be passed after the mode, using commas as separator. 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun Sample usage: 720x480,rotate=180 - 720x480 mode, rotated by 180 degrees 59*4882a593Smuzhiyun 60*4882a593SmuzhiyunValid options are:: 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun - margin_top, margin_bottom, margin_left, margin_right (integer): 63*4882a593Smuzhiyun Number of pixels in the margins, typically to deal with overscan on TVs 64*4882a593Smuzhiyun - reflect_x (boolean): Perform an axial symmetry on the X axis 65*4882a593Smuzhiyun - reflect_y (boolean): Perform an axial symmetry on the Y axis 66*4882a593Smuzhiyun - rotate (integer): Rotate the initial framebuffer by x 67*4882a593Smuzhiyun degrees. Valid values are 0, 90, 180 and 270. 68*4882a593Smuzhiyun - panel_orientation, one of "normal", "upside_down", "left_side_up", or 69*4882a593Smuzhiyun "right_side_up". For KMS drivers only, this sets the "panel orientation" 70*4882a593Smuzhiyun property on the kms connector as hint for kms users. 71*4882a593Smuzhiyun 72*4882a593Smuzhiyun 73*4882a593Smuzhiyun----------------------------------------------------------------------------- 74*4882a593Smuzhiyun 75*4882a593SmuzhiyunWhat is the VESA(TM) Coordinated Video Timings (CVT)? 76*4882a593Smuzhiyun===================================================== 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunFrom the VESA(TM) Website: 79*4882a593Smuzhiyun 80*4882a593Smuzhiyun "The purpose of CVT is to provide a method for generating a consistent 81*4882a593Smuzhiyun and coordinated set of standard formats, display refresh rates, and 82*4882a593Smuzhiyun timing specifications for computer display products, both those 83*4882a593Smuzhiyun employing CRTs, and those using other display technologies. The 84*4882a593Smuzhiyun intention of CVT is to give both source and display manufacturers a 85*4882a593Smuzhiyun common set of tools to enable new timings to be developed in a 86*4882a593Smuzhiyun consistent manner that ensures greater compatibility." 87*4882a593Smuzhiyun 88*4882a593SmuzhiyunThis is the third standard approved by VESA(TM) concerning video timings. The 89*4882a593Smuzhiyunfirst was the Discrete Video Timings (DVT) which is a collection of 90*4882a593Smuzhiyunpre-defined modes approved by VESA(TM). The second is the Generalized Timing 91*4882a593SmuzhiyunFormula (GTF) which is an algorithm to calculate the timings, given the 92*4882a593Smuzhiyunpixelclock, the horizontal sync frequency, or the vertical refresh rate. 93*4882a593Smuzhiyun 94*4882a593SmuzhiyunThe GTF is limited by the fact that it is designed mainly for CRT displays. 95*4882a593SmuzhiyunIt artificially increases the pixelclock because of its high blanking 96*4882a593Smuzhiyunrequirement. This is inappropriate for digital display interface with its high 97*4882a593Smuzhiyundata rate which requires that it conserves the pixelclock as much as possible. 98*4882a593SmuzhiyunAlso, GTF does not take into account the aspect ratio of the display. 99*4882a593Smuzhiyun 100*4882a593SmuzhiyunThe CVT addresses these limitations. If used with CRT's, the formula used 101*4882a593Smuzhiyunis a derivation of GTF with a few modifications. If used with digital 102*4882a593Smuzhiyundisplays, the "reduced blanking" calculation can be used. 103*4882a593Smuzhiyun 104*4882a593SmuzhiyunFrom the framebuffer subsystem perspective, new formats need not be added 105*4882a593Smuzhiyunto the global mode database whenever a new mode is released by display 106*4882a593Smuzhiyunmanufacturers. Specifying for CVT will work for most, if not all, relatively 107*4882a593Smuzhiyunnew CRT displays and probably with most flatpanels, if 'reduced blanking' 108*4882a593Smuzhiyuncalculation is specified. (The CVT compatibility of the display can be 109*4882a593Smuzhiyundetermined from its EDID. The version 1.3 of the EDID has extra 128-byte 110*4882a593Smuzhiyunblocks where additional timing information is placed. As of this time, there 111*4882a593Smuzhiyunis no support yet in the layer to parse this additional blocks.) 112*4882a593Smuzhiyun 113*4882a593SmuzhiyunCVT also introduced a new naming convention (should be seen from dmesg output):: 114*4882a593Smuzhiyun 115*4882a593Smuzhiyun <pix>M<a>[-R] 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun where: pix = total amount of pixels in MB (xres x yres) 118*4882a593Smuzhiyun M = always present 119*4882a593Smuzhiyun a = aspect ratio (3 - 4:3; 4 - 5:4; 9 - 15:9, 16:9; A - 16:10) 120*4882a593Smuzhiyun -R = reduced blanking 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun example: .48M3-R - 800x600 with reduced blanking 123*4882a593Smuzhiyun 124*4882a593SmuzhiyunNote: VESA(TM) has restrictions on what is a standard CVT timing: 125*4882a593Smuzhiyun 126*4882a593Smuzhiyun - aspect ratio can only be one of the above values 127*4882a593Smuzhiyun - acceptable refresh rates are 50, 60, 70 or 85 Hz only 128*4882a593Smuzhiyun - if reduced blanking, the refresh rate must be at 60Hz 129*4882a593Smuzhiyun 130*4882a593SmuzhiyunIf one of the above are not satisfied, the kernel will print a warning but the 131*4882a593Smuzhiyuntimings will still be calculated. 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun----------------------------------------------------------------------------- 134*4882a593Smuzhiyun 135*4882a593SmuzhiyunTo find a suitable video mode, you just call:: 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun int __init fb_find_mode(struct fb_var_screeninfo *var, 138*4882a593Smuzhiyun struct fb_info *info, const char *mode_option, 139*4882a593Smuzhiyun const struct fb_videomode *db, unsigned int dbsize, 140*4882a593Smuzhiyun const struct fb_videomode *default_mode, 141*4882a593Smuzhiyun unsigned int default_bpp) 142*4882a593Smuzhiyun 143*4882a593Smuzhiyunwith db/dbsize your non-standard video mode database, or NULL to use the 144*4882a593Smuzhiyunstandard video mode database. 145*4882a593Smuzhiyun 146*4882a593Smuzhiyunfb_find_mode() first tries the specified video mode (or any mode that matches, 147*4882a593Smuzhiyune.g. there can be multiple 640x480 modes, each of them is tried). If that 148*4882a593Smuzhiyunfails, the default mode is tried. If that fails, it walks over all modes. 149*4882a593Smuzhiyun 150*4882a593SmuzhiyunTo specify a video mode at bootup, use the following boot options:: 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun video=<driver>:<xres>x<yres>[-<bpp>][@refresh] 153*4882a593Smuzhiyun 154*4882a593Smuzhiyunwhere <driver> is a name from the table below. Valid default modes can be 155*4882a593Smuzhiyunfound in drivers/video/fbdev/core/modedb.c. Check your driver's documentation. 156*4882a593SmuzhiyunThere may be more modes:: 157*4882a593Smuzhiyun 158*4882a593Smuzhiyun Drivers that support modedb boot options 159*4882a593Smuzhiyun Boot Name Cards Supported 160*4882a593Smuzhiyun 161*4882a593Smuzhiyun amifb - Amiga chipset frame buffer 162*4882a593Smuzhiyun aty128fb - ATI Rage128 / Pro frame buffer 163*4882a593Smuzhiyun atyfb - ATI Mach64 frame buffer 164*4882a593Smuzhiyun pm2fb - Permedia 2/2V frame buffer 165*4882a593Smuzhiyun pm3fb - Permedia 3 frame buffer 166*4882a593Smuzhiyun sstfb - Voodoo 1/2 (SST1) chipset frame buffer 167*4882a593Smuzhiyun tdfxfb - 3D Fx frame buffer 168*4882a593Smuzhiyun tridentfb - Trident (Cyber)blade chipset frame buffer 169*4882a593Smuzhiyun vt8623fb - VIA 8623 frame buffer 170*4882a593Smuzhiyun 171*4882a593SmuzhiyunBTW, only a few fb drivers use this at the moment. Others are to follow 172*4882a593Smuzhiyun(feel free to send patches). The DRM drivers also support this. 173