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