vesafb - Generic graphic framebuffer driver

This is a generic driver for a graphic framebuffer on intel boxes.

The idea is simple: Turn on graphics mode at boot time with the helpof the BIOS, and use this as framebuffer device /dev/fb0, like the m68k(and other) ports do.

This means we decide at boot time whenever we want to run in text orgraphics mode. Switching mode later on (in protected mode) isimpossible; BIOS calls work in real mode only. VESA BIOS ExtensionsVersion 2.0 are required, because we need a linear frame buffer.

Advantages:

  • It provides a nice large console (128 cols + 48 lines with 1024x768)without using tiny, unreadable fonts.

  • You can run XF68_FBDev on top of /dev/fb0 (=> non-accelerated X11support for every VBE 2.0 compliant graphics board).

  • Most important: boot logo :-)

Disadvantages:

  • graphic mode is slower than text mode...

How to use it?

Switching modes is done using the vga=... boot parameter. ReadVideo Mode Selection Support 2.13 for details.

You should compile in both vgacon (for text mode) and vesafb (forgraphics mode). Which of them takes over the console depends onwhenever the specified mode is text or graphics.

The graphic modes are NOT in the list which you get if you boot withvga=ask and hit return. The mode you wish to use is derived from theVESA mode number. Here are those VESA mode numbers:

colors

640x480

800x600

1024x768

1280x1024

256

0x101

0x103

0x105

0x107

32k

0x110

0x113

0x116

0x119

64k

0x111

0x114

0x117

0x11A

16M

0x112

0x115

0x118

0x11B

The video mode number of the Linux kernel is the VESA mode number plus0x200:

Linux_kernel_mode_number = VESA_mode_number + 0x200

So the table for the Kernel mode numbers are:

colors

640x480

800x600

1024x768

1280x1024

256

0x301

0x303

0x305

0x307

32k

0x310

0x313

0x316

0x319

64k

0x311

0x314

0x317

0x31A

16M

0x312

0x315

0x318

0x31B

To enable one of those modes you have to specify “vga=ask” in thelilo.conf file and rerun LILO. Then you can type in the desiredmode at the “vga=ask” prompt. For example if you like to use1024x768x256 colors you have to say “305” at this prompt.

If this does not work, this might be because your BIOS does not supportlinear framebuffers or because it does not support this mode at all.Even if your board does, it might be the BIOS which does not. VESA BIOSExtensions v2.0 are required, 1.2 is NOT sufficient. You will get a“bad mode number” message if something goes wrong.

  1. Note: LILO cannot handle hex, for booting directly with“vga=mode-number” you have to transform the numbers to decimal.

  2. Note: Some newer versions of LILO appear to work with those hex values,if you set the 0x in front of the numbers.

X11

XF68_FBDev should work just fine, but it is non-accelerated. Runninganother (accelerated) X-Server like XF86_SVGA might or might not work.It depends on X-Server and graphics board.

The X-Server must restore the video mode correctly, else you end upwith a broken console (and vesafb cannot do anything about this).

Refresh rates

There is no way to change the vesafb video mode and/or timings afterbooting linux. If you are not happy with the 60 Hz refresh rate, youhave these options:

  • configure and load the DOS-Tools for the graphics board (ifavailable) and boot linux with loadlin.

  • use a native driver (matroxfb/atyfb) instead if vesafb. If noneis available, write a new one!

  • VBE 3.0 might work too. I have neither a gfx board with VBE 3.0support nor the specs, so I have not checked this yet.

Configuration

The VESA BIOS provides protected mode interface for changingsome parameters. vesafb can use it for palette changes andto pan the display. It is turned off by default because itseems not to work with some BIOS versions, but there are optionsto turn it on.

You can pass options to vesafb using “video=vesafb:option” onthe kernel command line. Multiple options should be separatedby comma, like this: “video=vesafb:ypan,inverse”

Accepted options:

inverse use inverse color map

ypan

enable display panning using the VESA protected modeinterface. The visible screen is just a window of thevideo memory, console scrolling is done by changing thestart of the window.

pro:

  • scrolling (fullscreen) is fast, because there isno need to copy around data.

kontra:

  • scrolling only parts of the screen causes someugly flicker effects (boot logo flickers forexample).

ywrap

Same as ypan, but assumes your gfx board can wrap-aroundthe video memory (i.e. starts reading from top if itreaches the end of video memory). Faster than ypan.

redraw

Scroll by redrawing the affected part of the screen, thisis the safe (and slow) default.

vgapal

Use the standard vga registers for palette changes.This is the default.

pmipal

Use the protected mode interface for palette changes.

mtrr:n

Setup memory type range registers for the vesafb framebufferwhere n:

  • 0 - disabled (equivalent to nomtrr) (default)

  • 1 - uncachable

  • 2 - write-back

  • 3 - write-combining

  • 4 - write-through

If you see the following in dmesg, choose the type that matches theold one. In this example, use “mtrr:2”.

...

mtrr:

type mismatch for e0000000,8000000 old: write-back new:write-combining

...

nomtrr

disable mtrr

vremap:n

Remap ‘n’ MiB of video RAM. If 0 or not specified, remap memoryaccording to video mode. (2.5.66 patch/idea by Antonino Daplasreversed to give override possibility (allocate more fb memorythan the kernel would) to 2.4 bytmb@iki.fi)

vtotal:n

If the video BIOS of your card incorrectly determines the totalamount of video RAM, use this option to override the BIOS (in MiB).

Have fun!

Gerd Knorr <kraxel@goldbach.in-berlin.de>

Minor (mostly typo) changesby Nico Schmoigl <schmoigl@rumms.uni-mannheim.de>