全部博文(1159)
分类: 嵌入式
2011-10-17 11:11:54
那么在grub内核引导那一行的后面加上vga=791 它的含义是VESA framebuffer console @ 1024x768x64k,进入系统后可以直接使用framebuffer,看一下这种情况下的各项数据: # fbset -s mode "1024x768-76" # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz geometry 1024 768 1024 768 16 timings 12714 128 32 16 4 128 4 rgba 5/11,6/5,5/0,0/0 endmode 用具体显卡的framebuffer驱动是另一种选择,拿Nvidia显卡为例,Nvidia显卡的xorg驱动模块与其framebuffer的驱动模块是互相排斥的,如果要用一个就必须清除另一个: # rmmod nvidia 装载nvidia的framebuffer驱动: # modprobe nvidiafb 装载成功的时候,会产生/dev/fb0设备,console屏幕上的字体会有变化。 看一下当前的配置: # fbset -s mode "1024x768-85" # D: 94.500 MHz, H: 68.677 kHz, V: 84.997 Hz geometry 1024 768 1024 32767 8 timings 10582 208 48 36 1 96 3 hsync high vsync high accel true rgba 8/0,8/0,8/0,0/0 endmode 需要改变一下geometry及色深: # fbset -g 1024 768 1024 768 32 # fbset -s mode "1024x768-85" # D: 94.500 MHz, H: 68.677 kHz, V: 84.997 Hz geometry 1024 768 1024 768 32 timings 10582 208 48 36 1 96 3 hsync high vsync high accel true rgba 8/16,8/8,8/0,8/24 endmode 我们把它与使用VESA ramebuffer后的数据比较一下,显然,根据具体的显卡来驱动framebuffer可以在颜色上达到最佳值,好,现在我们在console下面能够作的事情: 一、视频播放,可以用mplayer 或者 fbxine: # mplayer -vo fbdev -vf scale=1024:768 video_file.avi -vo fbdev 是告诉mplayer用framebuffer作视频驱动. -vf scale=1024:768 是全屏的方法,可按屏幕的具体情况作调整 用fbxine的话需要下载: # apt-get install xine-console 二、图片文件与pdf文件浏览: # apt-get install fbi 用这个软件包里的fbi可以浏览图片,fbgs可以观看pdf文件: # fbi -a *jpg # fbgs -c *pdf 三、中文显示: # apt-get install jfbterm # jfbterm 中文显示的效果完美。 文章出处:飞诺网() ------------------------------------------------------------------------ 在内核Documentation/fb/vesafb.txt文件中,有如下vesa-framebuffer的说明 Switching modes is done using the vga=... boot parameter. Read Documentation/svga.txt for details. You should compile in both vgacon (for text mode) and vesafb (for graphics mode). Which of them takes over the console depends on whenever the specified mode is text or graphics. The graphic modes are NOT in the list which you get if you boot with vga=ask and hit return. The mode you wish to use is derived from the VESA mode number. Here are those VESA mode numbers: | 640x480 800x600 1024x768 1280x1024 ----+------------------------------------- 256 | 0x101 0x103 0x105 0x107 8位色 32k | 0x110 0x113 0x116 0x119 15位色 64k | 0x111 0x114 0x117 0x11A 16位色 16M | 0x112 0x115 0x118 0x11B 24位色 The video mode number of the Linux kernel is the VESA mode number plus 0x200. Linux_kernel_mode_number = VESA_mode_number + 0x200 So the table for the Kernel mode numbers are: | 640x480 800x600 1024x768 1280x1024 ----+------------------------------------- 256 | 0x301 0x303 0x305 0x307 8位色 32k | 0x310 0x313 0x316 0x319 15位色 64k | 0x311 0x314 0x317 0x31A 16位色 16M | 0x312 0x315 0x318 0x31B 24位色 To enable one of those modes you have to specify "vga=ask" in the lilo.conf file and rerun LILO. Then you can type in the desired mode at the "vga=ask" prompt. For example if you like to use 1024x768x256 colors you have to say "305" at this prompt. If this does not work, this might be because your BIOS does not support linear 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 BIOS Extensions 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. 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/songbohr/archive/2010/03/25/5415637.aspx |
这两天拾起以前做过的Framebuffer,不相同的是以前在嵌入式上做的,现在在自己电脑上Debian上进行测试,不过都类似罢了,嵌入式里要初始化很多东西。下面具体列一下步骤。至于Framebuffer的原理,就我的理解是比较简单的,无非往mmap好的fb上填写显示数据罢了,不对这些数据进行处理,FrameBuffer 只是一个提供显示内存和显示芯片寄存器从物理内存映射到进程地址空间中的设备,它需要真正的显卡驱动的支持。在这次测试中,我用了默认就安装的vesafb,好像又被称为万能Fb驱动。
1、 首先在系统Grub启动时按e进入命令启动行的编辑模式,改为:kernel /boot/vmlinuz-2.6.18-5-686 root=/dev/sda6 ro vga=791(vga=791表示fb用1024 * 768 * 16bpp,其他模式的参数可以上网查查);
2、 进入系统的命令行模式,编译fb测试例子:gcc fb_test.c;
3、 允许测试例子:sudo ./a.out >> fb.txt(必须要用超级用户权限,>>将屏幕打印写到fb.txt中),效果如下:
打印如下:
Fixed screen info: id: VESA VGA smem_start: 0xf0000000 smem_len: 3145728 type: 0 type_aux: 0 visual: 2 xpanstep: 0 ypanstep: 0 ywrapstep: 0 line_length: 2048 mmio_start: 0x0 mmio_len: 0 accel: 0 Variable screen info: xres: 1024 yres: 768 xres_virtual: 1024 yres_virtual: 768 yoffset: 0 xoffset: 0 bits_per_pixel: 16 grayscale: 0 red: offset: 11, length: 5, msb_right: 0 green: offset: 5, length: 6, msb_right: 0 blue: offset: 0, length: 5, msb_right: 0 transp: offset: 0, length: 0, msb_right: 0 nonstd: 0 activate: 0 height: -1 width: -1 accel_flags: 0x0 pixclock: 12714 left_margin: 128 right_margin: 32 upper_margin: 16 lower_margin: 4 hsync_len: 128 vsync_len: 4 sync: 0 vmode: 0 Frame Buffer Performance test... Average: 2508 usecs Bandwidth: 1196.172 MByte/Sec Max. FPS: 398.724 fps |
4、还可以通过fb在命令行模式下看视频,如:sudo mplayer –vo fbdev ./air_nessesity.mpg。