1*ab42b818SMauro Carvalho Chehab================================= 2*ab42b818SMauro Carvalho Chehabmodedb default video mode support 3*ab42b818SMauro Carvalho Chehab================================= 4*ab42b818SMauro Carvalho Chehab 5*ab42b818SMauro Carvalho Chehab 6*ab42b818SMauro Carvalho ChehabCurrently all frame buffer device drivers have their own video mode databases, 7*ab42b818SMauro Carvalho Chehabwhich is a mess and a waste of resources. The main idea of modedb is to have 8*ab42b818SMauro Carvalho Chehab 9*ab42b818SMauro Carvalho Chehab - one routine to probe for video modes, which can be used by all frame buffer 10*ab42b818SMauro Carvalho Chehab devices 11*ab42b818SMauro Carvalho Chehab - one generic video mode database with a fair amount of standard videomodes 12*ab42b818SMauro Carvalho Chehab (taken from XFree86) 13*ab42b818SMauro Carvalho Chehab - the possibility to supply your own mode database for graphics hardware that 14*ab42b818SMauro Carvalho Chehab needs non-standard modes, like amifb and Mac frame buffer drivers (which 15*ab42b818SMauro Carvalho Chehab use macmodes.c) 16*ab42b818SMauro Carvalho Chehab 17*ab42b818SMauro Carvalho ChehabWhen a frame buffer device receives a video= option it doesn't know, it should 18*ab42b818SMauro Carvalho Chehabconsider that to be a video mode option. If no frame buffer device is specified 19*ab42b818SMauro Carvalho Chehabin a video= option, fbmem considers that to be a global video mode option. 20*ab42b818SMauro Carvalho Chehab 21*ab42b818SMauro Carvalho ChehabValid mode specifiers (mode_option argument):: 22*ab42b818SMauro Carvalho Chehab 23*ab42b818SMauro Carvalho Chehab <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd] 24*ab42b818SMauro Carvalho Chehab <name>[-<bpp>][@<refresh>] 25*ab42b818SMauro Carvalho Chehab 26*ab42b818SMauro Carvalho Chehabwith <xres>, <yres>, <bpp> and <refresh> decimal numbers and <name> a string. 27*ab42b818SMauro Carvalho ChehabThings between square brackets are optional. 28*ab42b818SMauro Carvalho Chehab 29*ab42b818SMauro Carvalho ChehabIf 'M' is specified in the mode_option argument (after <yres> and before 30*ab42b818SMauro Carvalho Chehab<bpp> and <refresh>, if specified) the timings will be calculated using 31*ab42b818SMauro Carvalho ChehabVESA(TM) Coordinated Video Timings instead of looking up the mode from a table. 32*ab42b818SMauro Carvalho ChehabIf 'R' is specified, do a 'reduced blanking' calculation for digital displays. 33*ab42b818SMauro Carvalho ChehabIf 'i' is specified, calculate for an interlaced mode. And if 'm' is 34*ab42b818SMauro Carvalho Chehabspecified, add margins to the calculation (1.8% of xres rounded down to 8 35*ab42b818SMauro Carvalho Chehabpixels and 1.8% of yres). 36*ab42b818SMauro Carvalho Chehab 37*ab42b818SMauro Carvalho Chehab Sample usage: 1024x768M@60m - CVT timing with margins 38*ab42b818SMauro Carvalho Chehab 39*ab42b818SMauro Carvalho ChehabDRM drivers also add options to enable or disable outputs: 40*ab42b818SMauro Carvalho Chehab 41*ab42b818SMauro Carvalho Chehab'e' will force the display to be enabled, i.e. it will override the detection 42*ab42b818SMauro Carvalho Chehabif a display is connected. 'D' will force the display to be enabled and use 43*ab42b818SMauro Carvalho Chehabdigital output. This is useful for outputs that have both analog and digital 44*ab42b818SMauro Carvalho Chehabsignals (e.g. HDMI and DVI-I). For other outputs it behaves like 'e'. If 'd' 45*ab42b818SMauro Carvalho Chehabis specified the output is disabled. 46*ab42b818SMauro Carvalho Chehab 47*ab42b818SMauro Carvalho ChehabYou can additionally specify which output the options matches to. 48*ab42b818SMauro Carvalho ChehabTo force the VGA output to be enabled and drive a specific mode say:: 49*ab42b818SMauro Carvalho Chehab 50*ab42b818SMauro Carvalho Chehab video=VGA-1:1280x1024@60me 51*ab42b818SMauro Carvalho Chehab 52*ab42b818SMauro Carvalho ChehabSpecifying the option multiple times for different ports is possible, e.g.:: 53*ab42b818SMauro Carvalho Chehab 54*ab42b818SMauro Carvalho Chehab video=LVDS-1:d video=HDMI-1:D 55*ab42b818SMauro Carvalho Chehab 56*ab42b818SMauro Carvalho Chehab----------------------------------------------------------------------------- 57*ab42b818SMauro Carvalho Chehab 58*ab42b818SMauro Carvalho ChehabWhat is the VESA(TM) Coordinated Video Timings (CVT)? 59*ab42b818SMauro Carvalho Chehab===================================================== 60*ab42b818SMauro Carvalho Chehab 61*ab42b818SMauro Carvalho ChehabFrom the VESA(TM) Website: 62*ab42b818SMauro Carvalho Chehab 63*ab42b818SMauro Carvalho Chehab "The purpose of CVT is to provide a method for generating a consistent 64*ab42b818SMauro Carvalho Chehab and coordinated set of standard formats, display refresh rates, and 65*ab42b818SMauro Carvalho Chehab timing specifications for computer display products, both those 66*ab42b818SMauro Carvalho Chehab employing CRTs, and those using other display technologies. The 67*ab42b818SMauro Carvalho Chehab intention of CVT is to give both source and display manufacturers a 68*ab42b818SMauro Carvalho Chehab common set of tools to enable new timings to be developed in a 69*ab42b818SMauro Carvalho Chehab consistent manner that ensures greater compatibility." 70*ab42b818SMauro Carvalho Chehab 71*ab42b818SMauro Carvalho ChehabThis is the third standard approved by VESA(TM) concerning video timings. The 72*ab42b818SMauro Carvalho Chehabfirst was the Discrete Video Timings (DVT) which is a collection of 73*ab42b818SMauro Carvalho Chehabpre-defined modes approved by VESA(TM). The second is the Generalized Timing 74*ab42b818SMauro Carvalho ChehabFormula (GTF) which is an algorithm to calculate the timings, given the 75*ab42b818SMauro Carvalho Chehabpixelclock, the horizontal sync frequency, or the vertical refresh rate. 76*ab42b818SMauro Carvalho Chehab 77*ab42b818SMauro Carvalho ChehabThe GTF is limited by the fact that it is designed mainly for CRT displays. 78*ab42b818SMauro Carvalho ChehabIt artificially increases the pixelclock because of its high blanking 79*ab42b818SMauro Carvalho Chehabrequirement. This is inappropriate for digital display interface with its high 80*ab42b818SMauro Carvalho Chehabdata rate which requires that it conserves the pixelclock as much as possible. 81*ab42b818SMauro Carvalho ChehabAlso, GTF does not take into account the aspect ratio of the display. 82*ab42b818SMauro Carvalho Chehab 83*ab42b818SMauro Carvalho ChehabThe CVT addresses these limitations. If used with CRT's, the formula used 84*ab42b818SMauro Carvalho Chehabis a derivation of GTF with a few modifications. If used with digital 85*ab42b818SMauro Carvalho Chehabdisplays, the "reduced blanking" calculation can be used. 86*ab42b818SMauro Carvalho Chehab 87*ab42b818SMauro Carvalho ChehabFrom the framebuffer subsystem perspective, new formats need not be added 88*ab42b818SMauro Carvalho Chehabto the global mode database whenever a new mode is released by display 89*ab42b818SMauro Carvalho Chehabmanufacturers. Specifying for CVT will work for most, if not all, relatively 90*ab42b818SMauro Carvalho Chehabnew CRT displays and probably with most flatpanels, if 'reduced blanking' 91*ab42b818SMauro Carvalho Chehabcalculation is specified. (The CVT compatibility of the display can be 92*ab42b818SMauro Carvalho Chehabdetermined from its EDID. The version 1.3 of the EDID has extra 128-byte 93*ab42b818SMauro Carvalho Chehabblocks where additional timing information is placed. As of this time, there 94*ab42b818SMauro Carvalho Chehabis no support yet in the layer to parse this additional blocks.) 95*ab42b818SMauro Carvalho Chehab 96*ab42b818SMauro Carvalho ChehabCVT also introduced a new naming convention (should be seen from dmesg output):: 97*ab42b818SMauro Carvalho Chehab 98*ab42b818SMauro Carvalho Chehab <pix>M<a>[-R] 99*ab42b818SMauro Carvalho Chehab 100*ab42b818SMauro Carvalho Chehab where: pix = total amount of pixels in MB (xres x yres) 101*ab42b818SMauro Carvalho Chehab M = always present 102*ab42b818SMauro Carvalho Chehab a = aspect ratio (3 - 4:3; 4 - 5:4; 9 - 15:9, 16:9; A - 16:10) 103*ab42b818SMauro Carvalho Chehab -R = reduced blanking 104*ab42b818SMauro Carvalho Chehab 105*ab42b818SMauro Carvalho Chehab example: .48M3-R - 800x600 with reduced blanking 106*ab42b818SMauro Carvalho Chehab 107*ab42b818SMauro Carvalho ChehabNote: VESA(TM) has restrictions on what is a standard CVT timing: 108*ab42b818SMauro Carvalho Chehab 109*ab42b818SMauro Carvalho Chehab - aspect ratio can only be one of the above values 110*ab42b818SMauro Carvalho Chehab - acceptable refresh rates are 50, 60, 70 or 85 Hz only 111*ab42b818SMauro Carvalho Chehab - if reduced blanking, the refresh rate must be at 60Hz 112*ab42b818SMauro Carvalho Chehab 113*ab42b818SMauro Carvalho ChehabIf one of the above are not satisfied, the kernel will print a warning but the 114*ab42b818SMauro Carvalho Chehabtimings will still be calculated. 115*ab42b818SMauro Carvalho Chehab 116*ab42b818SMauro Carvalho Chehab----------------------------------------------------------------------------- 117*ab42b818SMauro Carvalho Chehab 118*ab42b818SMauro Carvalho ChehabTo find a suitable video mode, you just call:: 119*ab42b818SMauro Carvalho Chehab 120*ab42b818SMauro Carvalho Chehab int __init fb_find_mode(struct fb_var_screeninfo *var, 121*ab42b818SMauro Carvalho Chehab struct fb_info *info, const char *mode_option, 122*ab42b818SMauro Carvalho Chehab const struct fb_videomode *db, unsigned int dbsize, 123*ab42b818SMauro Carvalho Chehab const struct fb_videomode *default_mode, 124*ab42b818SMauro Carvalho Chehab unsigned int default_bpp) 125*ab42b818SMauro Carvalho Chehab 126*ab42b818SMauro Carvalho Chehabwith db/dbsize your non-standard video mode database, or NULL to use the 127*ab42b818SMauro Carvalho Chehabstandard video mode database. 128*ab42b818SMauro Carvalho Chehab 129*ab42b818SMauro Carvalho Chehabfb_find_mode() first tries the specified video mode (or any mode that matches, 130*ab42b818SMauro Carvalho Chehabe.g. there can be multiple 640x480 modes, each of them is tried). If that 131*ab42b818SMauro Carvalho Chehabfails, the default mode is tried. If that fails, it walks over all modes. 132*ab42b818SMauro Carvalho Chehab 133*ab42b818SMauro Carvalho ChehabTo specify a video mode at bootup, use the following boot options:: 134*ab42b818SMauro Carvalho Chehab 135*ab42b818SMauro Carvalho Chehab video=<driver>:<xres>x<yres>[-<bpp>][@refresh] 136*ab42b818SMauro Carvalho Chehab 137*ab42b818SMauro Carvalho Chehabwhere <driver> is a name from the table below. Valid default modes can be 138*ab42b818SMauro Carvalho Chehabfound in linux/drivers/video/modedb.c. Check your driver's documentation. 139*ab42b818SMauro Carvalho ChehabThere may be more modes:: 140*ab42b818SMauro Carvalho Chehab 141*ab42b818SMauro Carvalho Chehab Drivers that support modedb boot options 142*ab42b818SMauro Carvalho Chehab Boot Name Cards Supported 143*ab42b818SMauro Carvalho Chehab 144*ab42b818SMauro Carvalho Chehab amifb - Amiga chipset frame buffer 145*ab42b818SMauro Carvalho Chehab aty128fb - ATI Rage128 / Pro frame buffer 146*ab42b818SMauro Carvalho Chehab atyfb - ATI Mach64 frame buffer 147*ab42b818SMauro Carvalho Chehab pm2fb - Permedia 2/2V frame buffer 148*ab42b818SMauro Carvalho Chehab pm3fb - Permedia 3 frame buffer 149*ab42b818SMauro Carvalho Chehab sstfb - Voodoo 1/2 (SST1) chipset frame buffer 150*ab42b818SMauro Carvalho Chehab tdfxfb - 3D Fx frame buffer 151*ab42b818SMauro Carvalho Chehab tridentfb - Trident (Cyber)blade chipset frame buffer 152*ab42b818SMauro Carvalho Chehab vt8623fb - VIA 8623 frame buffer 153*ab42b818SMauro Carvalho Chehab 154*ab42b818SMauro Carvalho ChehabBTW, only a few fb drivers use this at the moment. Others are to follow 155*ab42b818SMauro Carvalho Chehab(feel free to send patches). The DRM drivers also support this. 156