The Linux/m68k Frame Buffer Device : User's View of /dev/fb*
Previous: Introduction
Next: Programmer's View of /dev/fb*

2. User's View of /dev/fb*

From the user's point of view, the frame buffer device looks just like any other device in /dev. It's a character device using major 29, the minor is divided into a frame buffer number in the upper 3 bits (allowing max. 8 frame buffers simultaneously) and a resolution code in the lower 5 bits of the minor.

By convention, the following device nodes are used (numbers indicate the device minor numbers):

and so on...

The device with (minor & 31) == 0 (/dev/fb?current) stands for the frame buffer together with the currently set video parameters; (minor & 31) == 1 (/dev/fb?autodetect) is the video mode detected at boot time. Any other minor stands for some predefined or user defined video mode.

The predefined entries (/dev/fb?predefined*) usually have a device dependent name, e.g. for major 29, minor 5, we have /dev/fb0multiscan on Amiga and /dev/fb0ttmid on Atari. These are meant to contain hardware dependent resolutions.

The user defined resolutions (/dev/fb?user?) are meant to be filled in by the user. This way the user can store his favorite 8 resolutions during boot up.

Note: if you need more than 8 user defined resolutions, you can always override the predefined resolutions by storing them in one of the predefined entries. But this is not recommended. Similarly, if there are more than 22 predefined resolutions, the device writer can decide to store them in the user defined entries.

If the device is opened (for writing), the frame buffer driver switches to the selected video mode. Thus, you can switch video modes by writing to a frame buffer device, e.g.

    > /dev/fb0ttlow
    

will switch your video to TT low mode. Note: if you specify a resolution which contains a value that's not possible on your hardware, the frame buffer device will round it up (if possible) or return an error condition.

The frame buffer devices are also `normal' memory devices, this means, you can read and write their contents. You can, for example, make a screen snapshot by

    cp /dev/fb0current myfile
    

There also can be more than one frame buffer at a time, e.g. if you have a graphics card in addition to the built-in hardware. The corresponding frame buffer devices (/dev/fb0* and /dev/fb1* etc.) work independently.

Application software that uses the frame buffer device (e.g. the X server) will use /dev/fb0current by default. You can specify an alternative resolution by setting the environment variable $FRAMEBUFFER to the path name of a frame buffer device, e.g. (for sh/bash users):

    export FRAMEBUFFER=/dev/fb0multiscan
    

or (for csh users):

    setenv FRAMEBUFFER /dev/fb0multiscan
    

After this the X server will use the multiscan video mode.


The Linux/m68k Frame Buffer Device : User's View of /dev/fb*
Previous: Introduction
Next: Programmer's View of /dev/fb*