Framebuffer的配置及应用


借助于framebuffer,我们能够在console下面作很多事情。首先下载framebuffer的配置工具fbset:
# apt-get install fbset 下载完毕后,配置文件/etc/fb.modes随之产生。

比较简单的作法是用万能的vesafb,如果它被编译进了内核,如:
Device Drivers -> Graphics support ->

  • VESA VGA graphics support
    那么在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
    中文显示的效果完美。

    文章出处:飞诺网(http://www.diybl.com/course/6_system/linux/Linuxjs/2008721/133651.html)

    ------------------------------------------------------------------------
    在内核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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Framebuffer应用是指在Linux系统中使用Framebuffer驱动程序来控制LCD显示设备。Framebuffer是一块内存,保存着一帧图像的每一个像素颜色值。通过设置LCD控制器的时序、信号极性以及分配Framebuffer的大小和位置,可以实现在LCD上显示图像。在应用层,可以使用ioctl函数读取屏幕的参数信息,然后通过mmap映射Framebuffer,在Framebuffer中写入数据来实现图像的显示。Framebuffer应用的好处是可以直接对显存缓冲区进行读写操作,不必关心硬件的物理地址,简化了读写速度和方便性。\[2\]\[3\] #### 引用[.reference_title] - *1* [Framebuffer配置应用——先转载留着,以后一定要弄懂](https://blog.csdn.net/weixin_33890499/article/details/85844617)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [【嵌入式Linux】嵌入式Linux应用开发基础知识之Framebuffer应用编程和字符汉字显示](https://blog.csdn.net/weixin_43444989/article/details/122918794)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [19.Frambuffer应用编程](https://blog.csdn.net/qq_42174306/article/details/125589673)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值