Framebuffer console display mode generator


0. Contents

   1. Purpose
   2. Usage
      2.1. modetest (the newer and easier program)
         2.1.1. fbdev
         2.1.2. X11
      2.2. fbmodes (older and not so flexible program)
   3. Some examples
   4. fb.modes -> modeline converter
   5. Online demo
   6. Copying
   7. Drawbacks
   8. Feedback
   9. Requirements
   10. Installation
   11. Downloading

1. Purpose

Give it the requested screen resolution and refresh time (vsync period), and it gives you the modelines for fbset (/etc/fb.modes), SVGATextMode (/etc/TextConfig) and XFree86 (/etc/XF86Config).

On modern monitors, you probably have to specify the blank part lengths for left, right, top and bottom of screen too.

2. Usage

(Both are found in the same archive)

2.1. modetest (the newer and easier program)

Missing options.
modetest - video mode composer v1.2.3.1 (C) 1992,2002 Bisqwit

Developes a screen mode.
Usage: modetest <options> [<...>]
Options:
    -V, --version                                 Version information
    -X, --hslen <num>                             Horizontal sync length. Range: 0..1 s, default: 1e-6 (1 microsecond)
    -Y, --vslen <num>                             Vertical sync length. Range: 0..1 s, default: 46e-6 (46 microseconds)
    -h, --help                                    Help
    -n, --ignoretest                              Ignore mode testing
    -r, --refresh <num>                           Screen refresh rate.
    -x, --xres <visible>[+<invisible>[/<left%>]]  Horizontal resolution.
    -y, --yres <visible>[+<invisible>[/<top%>]]   Vertical resolution.

You must specify at least xres, yres and refresh.
Current assumed monitor and display card limits (used in warnings):
    Horizontal sync (hsync) range: 30 .. 120 kHz
    Vertical sync (refresh) range: 30 .. 180 Hz
    atyfb maxs: h_disp=2048, h_sync_start=4096, hslen=248,
                v_disp=2048, v_sync_strt=2048, vslen=31

The program tries to set the screenmode with fbset command.
You might want to redirect the stderr to a file in case the fbset command
fails and renders the screen garbled: modetest [<options>] 2>logfile.txt

Example: modetest 2>tmptmp -x1280+296 -y1024+39 -r60
         (gives the screenmode I'm using with my framebuffer console)
         (actually -x1280+296/78.4 -y1024+39/99 to center it)
Upon compilation you have two choices:

2.1.1. fbdev

You need write access to /dev/vcsa0 and a working fbset (v2.1) program to test the display modes.

2.1.2. X11

You need a working XFree86 server with XVidMode extension enabled.
As of the writing of this document, XFree-4.3.0 is not working.
To make it working, you may need to do the following:
  1. Download and unpack XFree86 source code.
  2. Patch programs/Xserver/Xext/xf86vmode.c
    1. Add VidModeSetModeValue(mode, VIDMODE_CLOCK, stuff->dotclock); to the function ProcXF86VidModeAddModeLine
    2. Add VidModeSetModeValue(modetmp, VIDMODE_CLOCK, stuff->dotclock); to the function ProcXF86VidModeValidateModeLine
  3. Patch programs/Xserver/hw/xfree86/common/xf86VidMode.c
    1. Add mode->VScan = 1; to the function VidModeCreateMode
  4. And recompile it. (Just ensuring XFree86 and libextmod.a are updated is enough.)
After applying these updates, XF86VidModeAddModeLine() works randomly (previously never).

Yes I know - this is far from tolerable. I'm sorry. Until XFree86 is officially fixed, there's nothing better to offer for this.

2.2. fbmodes (older and not so flexible program)

fbmodes version 1.2.3.1
Copyright (C) 1992,1999 Bisqwit (http://iki.fi/bisqwit/)

Generates various type of video mode entries with given settings

Usage: fbmodes [-?xyfrdXYmV]

  -?, --help          Help
  -x, --xres n        Requested horizontal resolution (default: 256)
  -y, --yres n        Requested vertical resolution (default: 256)
  -f, --hfreq n       Horizontal pixel clock/Hz (default: 31500)
  -r, --refresh n     Specify (vertical) display refreshment rate/Hz
                       (default: hfreq/ylen or 120)
  -xl,--xlen n        Specify video line width/pixels (default: xres*3/2)
  -yl,--ylen n        Specify number of scanlines (default: hfreq/refresh)
  -d, --depth n       Specify bitness (used in fb.modes) (default: 8)
  -X, --xofs n        Specify hsyncstart-xres (default: (xlen-xres)/2)
  -Y, --yofs n        Specify vsyncstart-yres (default: (ylen-yres)/3)
  -xs,--hslen n       Specify hsync length/pixels
                       (default: min(40,(xlen-xres)/2-1))
  -ys,--vslen n       Specify vsync length/pixels
                       (default: min(10,(ylen-yres)/2-1))
  -fx,--fontxres n    Specify fontxres (used in TextConfig) (default: 8)
  -fy,--fontyres n    Specify fontyres (used in TextConfig) (default: 8)
  -m, --mem n         Video memory size/kB (default: 4000)
  -V, --version       Version information

The order of the parameter elements is not important.
Also any of them can be omitted.

Pparameter translation algorithm:
 If hfreq was specified and refresh was not specified,
     refresh gets calculated from hfreq/ylen.
 Else if refresh was not specified, it is assumed as 120.
 Next if ylen was not specified, it is calculated from hfreq/refresh.
 If ylen, refresh and hfreq were specified, ignore hfreq.
 Next, if hslen and vslen were not specified, calculates them as documented.

Note: This program is obsolete and unsupported. Use modetest instead.

3. Some examples

(For my "ATY Mach64" framebuffer and Belinea 10 70 20 monitor)
mode "2000x1750-40"
    # D: 186.602 MHz, H: 70.683 kHz, V: 39.687 Hz
    geometry 2000 1750 2000 1750 8
    timings 5359 434 70 29 1 136 1
    hsync high
    vsync high
endmode

#~/src/fbmodes/fbmodes -x360 -y256 -d32 -ys3 -xs48 -f50000 -m1024
mode "360x256-120"
  geometry 360 256  360 1000  32
  timings 39746  24 72  104 53  48 3
endmode
    
#~/src/fbmodes/fbmodes -x320 -y256 -d32 -ys3 -xs48 -f50000 -m1024
mode "320x256-120"
  geometry 320 256  320 1000  32
  timings 43642  22 69  104 53  48 3
endmode

#~/src/fbmodes/fbmodes -x360 -xl460 -y240 -d32 -ys3 -X30 -xs20 -f35000 -m256 -r120
mode "360x240-120"
  geometry 360 240  360 728  32
  timings 62254  50 30  31 17  20 3
endmode

#~/src/fbmodes/fbmodes -x320 -y240 -d32 -ys2 -xs48 -f45000 -m1024
mode "320x240-120"
  geometry 320 240  320 1000  32
  timings 48414  22 69  88 45  48 2
endmode

#~/src/fbmodes/fbmodes -x576 -y432 -d32 -ys3 -xs48 -f50000 -m512
mode "576x432-120"
  geometry 576 432  576 910  32
  timings 23328  32 79  33 18  48 3
endmode

#~/src/fbmodes/modetest -x320+50/20 -y200+100/70 -r120 -X2.5e-6 -Y58e-6
mode "320x200-120"
    # D: 14.799 MHz, H: 36.360 kHz, V: 120.000 Hz
    geometry 320 200   320 200   8
    timings 67574  10 40  70 30  37 3
    vsync high
    hsync high
endmode

#~/src/fbmodes/modetest -x384+50/35 -y288+40/80 -r120 -X2.5e-6 -Y58e-6
mode "384x288-120"
    # D: 19.145 MHz, H: 39.720 kHz, V: 120.000 Hz
    geometry 384 288   384 288   8
    timings 52232  17 33  32 8  48 3
endmode

# Generated with: modetest -x256+95/40 -y320+30 -r120 -X0 -Y1e-6
mode "256x320-120"
    # D: 14.784 MHz, H: 42.120 kHz, V: 120.000 Hz
    geometry 256 320   256 320   32
    timings 67640  38 57  27 3  0 1
    vsync high
    hsync high
endmode

# Generated with: modetest -x400+60/48 -y320+50/60 -r120
mode "400x320-120"
    # D: 21.472 MHz, H: 44.640 kHz, V: 120.000 Hz
    geometry 400 320   400 320   8
    timings 46572  28 32  30 20  21 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x 432+70/50 -y 320+30 -r 120
mode "432x320-120"
    # D: 22.071 MHz, H: 42.120 kHz, V: 120.000 Hz
    geometry 432 320   432 320   8
    timings 45308  35 35  27 3  22 1
    vsync high
    hsync high
endmode

# Generated with: modetest -x352+116/35 -y288+120/70 -r124
mode "352x288-124"
    # D: 25.064 MHz, H: 50.840 kHz, V: 124.000 Hz
    geometry 352 288   352 288   8
    timings 39897  40 76  84 36  25 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x640+100/97 -y360+30 -r120
mode "640x360-120"
    # D: 36.503 MHz, H: 47.040 kHz, V: 120.000 Hz
    geometry 640 360   640 360   8
    timings 27394  97 3  27 3  36 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x640+200 -y480+50 -r120
mode "640x480-120"
    # D: 57.264 MHz, H: 63.840 kHz, V: 120.000 Hz
    geometry 640 480   640 480   8
    timings 17462  160 40  45 5  57 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x512+110/90 -y384+30 -r120
mode "512x384-120"
    # D: 32.648 MHz, H: 49.920 kHz, V: 120.000 Hz
    geometry 512 384   512 384   8
    timings 30630  99 11  27 3  32 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x720+250/45 -y480+200/50 -r100
mode "720x480-100"
    # D: 71.100 MHz, H: 68.300 kHz, V: 100.000 Hz
    geometry 720 480   720 480   8
    timings 14064  112 138  100 100  71 3
    vsync high
    hsync high
endmode

# Generated with: modetest -x640+160/58 -y272+240/60 -r120
mode "640x272-120"
    # D: 52.551 MHz, H: 61.680 kHz, V: 120.000 Hz
    geometry 640 272   640 272   8
    timings 19029  92 68  144 96  52 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x632+240/42 -y476+180/50 -r100
mode "632x476-100"
    # D: 61.485 MHz, H: 65.900 kHz, V: 100.000 Hz
    geometry 632 476   632 476   8
    timings 16264  100 140  90 90  61 3
    vsync high
    hsync high
endmode

# Generated with: modetest -x512+160/53 -y480+146/60 -r100
mode "512x480-100"
    # D: 45.028 MHz, H: 62.800 kHz, V: 100.000 Hz
    geometry 512 480   512 480   8
    timings 22208  84 76  87 59  45 2
    vsync high
    hsync high
endmode

# Generated with: modetest -x1600+380/90 -y1070+30/75 -r60 -X1.5e-6 -Y90e-6
Modeline "1600x1070-60"     145.727  1600 1638 1856 2198   1070 1078 1083 1105

Most of these I made to be able to play mpeg4 videos full screen without software rescaling.

The utilities to use MPlayer in Linux framebuffer console can be found at http://iki.fi/bisqwit/source/mplayscript.html.

4. fb.modes -> modeline converter

The package now contains fb2x.rb, a Ruby script to convert the mode descriptions from fb.modes to modeline format used by X11.
Usage:
    ruby fb2x.rb < fb.modes > modelines.txt

5. Online demo

Desired resolution: x , Hz
Sync area: x
Screen position: % left, % top

Note: All fields must be filled!
Set the desired resolution to be what you want. 640x480, 90 Hz is a nice example.
Sync area is the amount of blank space the video card must render. It's usually something like 25% of the screen width and height. Try 100 for starters, grow or shrink it then if it seems too small or big.
And screen position decides how much of the sync area is at left/right and top/bottom. 50 and 50 are good starters.
Demo out of commission until further notice. Sorry.

6. Copying

modetest has been written by Joel Yliluoma, a.k.a. Bisqwit,
and is distributed under the terms of the General Public License (GPL).

If you happen to see this program useful for you, I'd appreciate if you tell me :) Perhaps it would motivate me to enhance the program.
As of 21.8.2002, still nobody has emailed me anything about this program, although I have seen hits and downloads from this page many times a day for half a year already.

7. Drawbacks

  • Doublescan-modes and interlaced modes are not yet supported, and they won't work in Linux atyfb anyway.
    Therefore, the low resolution modes (320x200 for example) don't look as good as you might expect.
  • Being able to produce screenmodes like 320x1024 @ 120 fps, you might damage your monitor while playing with these utilities. Newer monitors don't usually suffer a lot, but older ones might. I offer no warranty whatsoever. However, if you happen to make your monitor explode or at least damage when using this program, you are encouraged to tell me about it.
  • The programs have *no* kind of database of standard video modes. Therefore, when using modetest, you almost always have to specify the blank area sizes and positions explicitly. It has been made as easy as possible though.
  • Flat displays (LCD, TFT) are not so flexible in clocking as CRT displays are. If you have a 1024x768 flat display, there most probably is no way to get 1280x1024 resolution with it. I have a 1280x1024 Belinea monitor (model 10 70 20), and it can display even 2000x1750 when given suitable input.

8. Feedback

If you have problems using this program or ideas how to develop it, email me your questions or ideas.
Please do not omit the details.
My email address:za.0Joelegto.zrl Yli@1de@luomw0gyo2qza <bi2koybKznsqwinedu5t@ike@J2oui.fi>

9. Requirements

Only tested with GNU make and GCC version 3.03 in Linux.
Mode tester (visualizer and tester) part works only on Linux (it uses /dev/vcsa0 and fbset).

10. Installation

$ make
$ su
# make install
If you do not want to install libargh (included in the archive), do not use "make install" and edit Makefile and enable the STATIC linking instead of DYNAMIC.

11. Downloading

Downloading help

  • Do not download everything - you only need one file (newest version for your platform)!
  • Do not use download accelerators or you will be banned from this server before your download is complete!

Date (Y-md-Hi) acc        Size Name                
2003-0912-0603 r--       38611 fbmodes-1.2.3.tar.bz2
2003-0912-0603 r--       21277 patch-fbmodes-1.2.2.1-1.2.3.bz2
2003-0912-0603 r--       12971 patch-fbmodes-1.2.2-1.2.3.bz2
2003-0530-0259 r--       37605 fbmodes-1.2.2.1.tar.bz2
2003-0530-0259 r--        2495 patch-fbmodes-1.2.2-1.2.2.1.bz2
2003-0406-0538 r--       37551 fbmodes-1.2.2.tar.bz2
2003-0406-0538 r--       13622 patch-fbmodes-1.2.1.6-1.2.2.bz2
2003-0406-0538 r--       19338 patch-fbmodes-1.2.1-1.2.2.bz2
2002-1229-2124 r--       36716 fbmodes-1.2.1.6.tar.bz2
2002-1229-2124 r--        9084 patch-fbmodes-1.2.1.5-1.2.1.6.bz2
2002-1130-1905 r--       35346 fbmodes-1.2.1.5.tar.bz2
2002-1130-1905 r--        6775 patch-fbmodes-1.2.1.4-1.2.1.5.bz2
2002-1016-2030 r--       35731 fbmodes-1.2.1.4.tar.bz2
2002-1016-2030 r--        5115 patch-fbmodes-1.2.1.3-1.2.1.4.bz2
2002-0821-0114 r--        5604 patch-fbmodes-1.2.1.1-1.2.1.3.sh.bz2
2002-0821-0114 r--       34802 fbmodes-1.2.1.3.tar.bz2
2002-0821-0114 r--        5501 patch-fbmodes-1.2.1.1-1.2.1.3.bz2
2002-0813-1358 r--       32403 fbmodes-1.2.1.1.tar.bz2
2002-0813-1358 r--        6664 patch-fbmodes-1.2.1-1.2.1.1.bz2
2002-0607-0026 r--       30944 fbmodes-1.2.1.tar.bz2
2002-0607-0025 r--         889 patch-fbmodes-1.2.0.1-1.2.1.bz2
2002-0607-0026 r--        4189 patch-fbmodes-1.2.0-1.2.1.bz2
2002-0514-1848 r--       30690 fbmodes-1.2.0.tar.bz2
2002-0514-1848 r--       11764 patch-fbmodes-1.1.0-1.2.0.bz2
2002-0501-2237 r--       27285 fbmodes-1.1.0.tar.bz2
2002-0501-2237 r--        3503 patch-fbmodes-1.0.9-1.1.0.bz2
2002-0412-1811 r--       26345 fbmodes-1.0.9.tar.bz2
2002-0412-1811 r--        2074 patch-fbmodes-1.0.8-1.0.9.bz2
2002-0331-0427 r--       26038 fbmodes-1.0.8.tar.bz2
2002-0331-0427 r--         647 patch-fbmodes-1.0.7-1.0.8.bz2
2002-0327-1420 r--       26029 fbmodes-1.0.7.tar.bz2
2002-0327-1420 r--        1085 patch-fbmodes-1.0.6-1.0.7.bz2
2002-0314-2105 r--       25843 fbmodes-1.0.6.tar.bz2
2002-0314-2105 r--         913 patch-fbmodes-1.0.5-1.0.6.bz2
2002-0122-0107 r--       25643 fbmodes-1.0.5.rar
2002-0314-0147 r--       25876 fbmodes-1.0.5.tar.bz2
2002-0314-0147 r--        4890 patch-fbmodes-1.0.4-1.0.5.bz2
2002-0121-1356 r--       25776 fbmodes-1.0.4.rar
2002-0121-1356 r--       25440 fbmodes-1.0.4.tar.bz2
2002-0121-1356 r--        4679 patch-fbmodes-1.0.3-1.0.4.bz2
2002-0118-2259 r--       24910 fbmodes-1.0.3.rar
2002-0118-2259 r--       24723 fbmodes-1.0.3.tar.bz2
2002-0118-2259 r--       19003 patch-fbmodes-1.0.2-1.0.3.bz2
2002-0118-1954 r--       11054 fbmodes-1.0.2.rar
2002-0118-1954 r--       11558 fbmodes-1.0.2.tar.bz2
2002-0118-1954 r--        4455 patch-fbmodes-1.0.1-1.0.2.bz2
Back to the source directory index at Bisqwit's homepage