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