User's View of /dev/fb*

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):

- First frame buffer
  0 = `/dev/fb0current`

    Current resolution

  1 = `/dev/fb0autodetect`

    Default resolution

  2 = `/dev/fb0predefined0`

    Predefined resolution 1

  ...
  23 = `/dev/fb0predefined21`

    Predefined resolution 22

  24 = `/dev/fb0user0`

    User defined resolutions 1

  ...
  31 = `/dev/fb0user7`

    User defined resolutions 8

- Second frame buffer
  32 = `/dev/fb1current`

    Current resolution

  33 = `/dev/fb1autodetect`

    Default resolution

  34 = `/dev/fb1predefined0`

    Predefined resolutions 1

  ...
  55 = `/dev/fb1predefined21`

    Predefined resolution 22

  56 = `/dev/fb1user0`

    User defined resolutions 1

  ...
  63 = `/dev/fb1user7`

    User defined resolutions 8

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*`