FrameBuffer

The Linux framebuffer is a graphic hardware-independent abstraction layer to show graphics on a console without relying on system-specific libraries such as SVGALib or the heavy overhead of the X Window System. It can be used to change the resolution of your console (virtual terminal) and to fix the - my system seems to work but my screen is black - problem

Disclaimer: I am not an expert in this subject (my mother tongue is not even english) so if the information on this page is not exact forgive me in advance (or feel free to correct it).

What is the Framebuffer?

Definitions

Frame: In this case it is the surface of the screen or window. (Yes I know. In a normal world a frame is supposed to surround a window)

Buffer: A section of RAM reserved for temporary storage of data waiting to be directed to a device.

Quick/Dirty overview

The frame buffer is a "man in the middle" between the graphic operations and the video output. It can use the video cards own framebuffer memory or map directly to the CPU memory to manipulate graphics. The size of the assigned memory will determine the maximum resolution and colour depth.

It can be used to provide video modes that the video card does not natively support. For example, you might have a wide screen monitor but your current video card driver might lack the wide screen resolution. The framebuffer can be used to create a widescreen resolution using the video cards own memory and then pass it straight to the monitor.

It can be used to perform page flipping (a technique that is also called "double buffering" many games use this technique to give you a better, smoother experience). It can be offscreen or onscreen, so it can therefore be used by so called headless systems. It can be used to produce 3D imagery in real time using a graphic accelerator.

The framebuffer is used when you want the graphical boot screen. Turning off the framebuffer will most likely disable this feature.

The use of the framebuffer functionality is more or less optional since, in Xorg, many video card drivers communicate with the video card hardware directly in order to provide you with accelerated graphics, correct resolutions, etc.

The black screen

A common problem for systems with older video cards and/or some laptops is that the screen is black but the login welcome sound is heard. During this time the monitor may display an error message, go into power saving mode or turn itself off. The computer seem to function normally but without displaying any picture.

Why does this happen?

In the Dirty overview above it was mentioned that the framebuffer can be used to provide video display modes not natively supported by the graphic/video card. Instead of using the hardware directly, the framebuffer is used to calculate the display and then send it to the hardware.

Most modern monitors have a built in safety check. If your monitor detects a resolution it is not made to handle it refuse to display it. Some monitors display an error, some enter standby mode and some simply turn itself off.

Ok, but ...

... why is the framebuffer used instead of using the hardware directly?

The framebuffer will be automatically enabled if that option is set in the BIOS and Ubuntu is detecting it.

How to disable the framebuffer

  • Q: I'm not sure that the framebuffer is the root of my problem. How can I test this without modifying my system? A: I will give you four options that I know of:

Temporary disable framebuffer in GRUB boot menu

Making this change will have no impact on your installed system and is to be considered safe. If you reboot your system this change will disappear. It is temporary.

Start your computer normally and after a few seconds you will see the GRUB boot loader menu.

  • With the use of the arrow keys, highlight the title of your choice you want to edit (the first Ubuntu entry should be ok) and press "e" to go to the entry editor interface. You will now see the boot entries for the title you selected.
  • Highlight, again with the use of the arrow keys, the line that say "kernel" and press "e" to edit that line.
  • Add, without the quotes " vga=normal nomodeset" and press the enter key to go out of edit mode.
  • Press the "b" key to boot your system.

Note: To cancel your changes press the Escape key until the main menu appear.

Permanently disable framebuffer in GRUB config file

See "Setting different framebuffer resolutions in GRUB" below.

Disable the framebuffer in CMOS/BIOS

Making this change will have no impact on your installed system. However, the change will remain until you change the setting back.

This wiki will not go into the details of this option for a very simple reason; many systems have different BIOS and versions of it. How you enter your BIOS and where to make the change can differ quite alot.

  • Enter your BIOS
  • Find the framebuffer reference and disable it
  • Save your settings and reboot the system
  • Boot your Ubuntu system normally

Disable framebuffer at install time

When installing your Ubuntu system, you can tell the Ubuntu installer not to use the framebuffer. Type F6 at the Start Menu then add without the quotes "vga=711" and press the enter key.

Setting different framebuffer resolutions in old versions of GRUB

NOTE: Modern versions of GRUB build their configuration files from pieces kept under /etc/grub.d/ and in the parameter file /etc/default/grub. To make changes to modern GRUB, you will need to learn how to make changes to the /etc/default/grub file, and then run "update-grub" to create the new GRUB configuration file /boot/grub/grub.cfg. The changes described below to menu.lst only work for older versions of GRUB.

In the configuration file for GRUB (/boot/grub/menu.lst) you can set a different resolution for, or disable, the framebuffer.

The option you must add to the "kernel ..." row for your selected menu item is "vga=value" (without the quotes).

  • adding "vga=normal" or "nofb" to the kernel line disables the framebuffer
  • if "nofb" does not help, try "nomodeset" to disable kernel mode setting
  • adding "vga=ask" will enable you to set a value at each boot - good for testing out the various modes.

So, to disable the framebuffer, enter "vga=normal", or "nofb" to the kernel line of the active kernel that you are using in menu.lst and then reboot. You will need to re-edit the menu.lst file every time you update the kernel version or GRUB itself. These changes will disable the framebuffer for ONLY this specific GRUB entry; to disable them for all kernels see below.

Example (old versions of GRUB only):

title           Ubuntu, kernel 2.6.15-20-386
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.15-20-386 root=/dev/hda5 ro nofb
initrd          /boot/initrd.img-2.6.15-20-386
savedefault
boot

For other resolutions, here is a list:

Colour depth

640x480

800x600

1024x768

1280x1024

1400x1050

1600x1200

8 (256)

769

771

773

775

15 (32K)

784

787

790

793

16 (65K)

785

788

791

794

834

884

24 (16M)

786

789

792

795

So, to use the framebuffer with 16 bit colour depth at a resolution of 1024x768 you would add "vga=791" (again without quotes) to the kernel line (the active kernel that you are using - you will need to re-edit menu.lst every time you update the kernel version). Example:

title           Ubuntu, kernel 2.6.15-20-386
root            (hd0,4)
kernel          /boot/vmlinuz-2.6.15-20-386 root=/dev/hda5 ro vga=791
initrd          /boot/initrd.img-2.6.15-20-386
savedefault
boot

Simply Disabling the Framebuffer in the menu.lst file for all kernels

One can alter the menu.lst file to disable the framebuffer for all kernels, and all new kernels. Edit the /boot/grub/menu.lst file with whatever editor you prefer, with sudo rights. Be sure to backup your original just in case you really mess things up.

sudo cp /boot/grub/menu.lst  /boot/grub/menu.list.backup_date

sudo nano /boot/grub/menu.lst

We are interested in the following lines. The Last Line is the one that needs to be changed. Note that unlike other config files 2 comments ## marks are actually a comment for Grub and the update-grub command. One # is just a comment for grub, but IS a configuration line for the update-grub command. Be very careful to leave the # of #'s correct.

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
## The following Line is the default for all kernels. Yours may vary the nofb option disables the framebuffer
## the nosplash option also disables the fancy splash screen. You may want to disable this to allow easier troubleshooting of the system
# defoptions=quiet nosplash nofb

Once the last line is edited as you like. You need to run the update-grub command with root rights in order for all the grub kernel entries to be fixed with the new options.

sudo update-grub

Now the framebuffer should be disabled for all current and new kernels.

Other Framebuffer tools and tweaks

*This section needs to be expanded *

Most of this wiki has been on how to disable the framebuffer, It does have some actual use however. Some things the framebuffer device allows include.

  • video playback on the console without need for the X system being installed.
  • some games can use the framebuffer
  • customization of the console background to include logos and other images
  • image viewers with out the need for X to be installe.
  • X can even be configured to use the framebuffer device instead of a specific video card driver.

If one does wish to use and explore the framebuffer, the 'fbset' command allows one to change several settings of the framebuffer on the fly.

sudo apt-get install fbset

To see other applications that have framebuffer features (not a complete list) the following will get you started.

apt-cache search framebuffer | less

Mplayer, and other players can also have framebuffer support.

FrameBuffer (last edited 2010-09-30 04:57:27 by idallen)