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