ubuntu wiki-FrameBuffer

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

 

独立于硬件的图形抽象层,可以不依赖于系统指定的库,比如SVGAlib和高层的X windows系统,在控制台上显示图形。

可以用于改变控制台(虚拟终端)的分辨率并解决系统运行但是屏幕是黑色的问题。

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.

 

帧: 这里,帧是屏幕或者窗口的表面。现实世界中,帧应该是包围一个窗口的。

缓冲:是RAM的一段,用于临时存储这些 等着直接写入设备的 数据。

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.

 

帧缓冲是图形操作和视频输出之间的一个中立人。帧缓冲可以用显卡自己的帧缓冲内存,也可以映射到CPU的内存来管理图形。

所分配的内存决定了最大分辨率和色深。

帧缓冲可以提供显卡本身不支持的视频模式,比如,你有一个宽的显示器,但是当前的显卡驱动缺乏这么宽的屏幕分辨率,咋办?帧缓冲可以用显卡自身的内存,通过把内存直接传递给显示器,来创建一个宽的屏幕分辨率。

帧缓冲还可以用于页flipping(一种技术,又叫 双缓冲,许多游戏有这个技术,提供更好的、更流畅的体验)。

可以是屏幕之上或者之下,因此被所谓的headless systems所用。

使用图形加速器,可以产生实时的3D影响。当你需要图形启动屏幕的时候,帧缓冲就派上了用场。

关闭帧缓冲,可能就不能有启动图像了。

framebuffer的功能的使用,或多或少是可选的。因为Xorg中,许多显卡驱动与显卡的硬件直接交互,提供加速的图形,正确的分辨率。

 

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.

 

上面说了,framebuffer提供显卡不支持的模式,不直接使用硬件,framebuffer可以计算显示并发往硬件。

大多现代显示器,有内置的安全检查。你的显示器检测到了分辨率,但是没有处理,拒绝显示。一些显示器会报错,一些进入standby 模式,一些直接关闭了自身。

 

Ok, but ...

... why is the framebuffer used instead of using the hardware directly? 为啥直接使用framebuffer,而不使用硬件自身呢?

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

如果bios中设置了,那么framebuffer是自动激活的,ubuntu可以检测到。

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:

 

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

 

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 (在 2010-09-30 04:57:27 由 Ian! D. Allen 编辑)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值