概述
- 了解Linux framebuffer.
1.Framebuffer Intro
FrameBuffer是出现在 2.2.xx 内核当中的一种驱动程序接口。Linux是工作在保护模式下,所以用户态进程是无法象DOS那样使用显卡BIOS里提供的中断调用来实现直接写屏,Linux抽象出 FrameBuffer这 个设备来供用户态进程实现直接写屏。
Framebuffer机制模仿显卡的功能,将显卡硬件结构抽象掉,可以通过Framebuffer的读写直接对显存进行操作。用户可以将Framebuffer看成是显示内存的一个映像,将其映射到进程地址空间之后,就可以直接进行读写操作,而写操作可以立即反应在屏幕上。 这种操作是抽象的,统一的。用户不必关心物理显存的位置、换页机制等等具体细节。这些都是由Framebuffer设备驱动来完成的。
但Framebuffer本身不具备任何运算数据的能力,就只好比是一个暂时存放水的水池。CPU将运算后的结果放到这个水池,水池再将结果流到显示器,中间不会对数据做处理,应用程序也可以直接读写这个水池的内容。在这种机制下,尽管Framebuffer需要真正的显卡驱动的支持,但所有显示任务都有CPU完成,因此CPU 负担很重。
2.Accessing Graphics
There are 3 different ways that graphics can be performed:
- Using a kernel framebuffer driver
- Using a kernel DRM driver
- Mapping the card’s control registers into user-space (via mmap() calls on /dev/mem), and using user-space code to access the card (very complex)
3.What is a Framebuffer Driver?
It is a Linux kernel driver which exposes a file /dev/fb{N} for a graphics card it is responsible for. Through that file, userspace apps can perform reads/writes to directly access the video card framebuffer - ie the pixel values being displayed on the screen. Via IOCTL calls on that file, other functionality can be accessed including:
- setting the graphics mode (width, height, pixel-depth, etc)
- passing bitmaps to be copied into video memory
- passing coordinates of a rectangle to be filled with a specified colour
The framebuffer interface does not offer much in the way of acceleration other than the bitblits and fills mentioned above.
There is a fairly generic “vesafb” driver that is capable of controlling any graphics card compatible with the VESA standard. Linux also comes with dozens of card-specific framebuffer drivers that support products of specific manufacturers. On boot, Linux uses the PCI ID of a graphics card to load the most appropriate framebuffer driver, which in turn creates the /dev/fb{n} control file.
4.Why Use a Framebuffer Driver?
Embedded systems use them because they often don’t have complex graphics requirements, want a small kernel, and don’t want an X server running in userspace. While X can use a framebuffer to display graphics, so can other simpler graphical libraries.
For many graphics chips, there is a framebuffer driver available but no specific X driver, and no 3D driver.
Graphics display during startup is also a candidate for a framebuffer driver.
And linux text consoles can use a framebuffer driver to display text at nice resolutions (better than available via the BIOS) without otherwise actually wanting to display graphics.
refer to
- http://moi.vonos.net/linux/framebuffer-drivers/
最后
以上就是感性吐司为你收集整理的Linux Framebuffer(一) - 概述的全部内容,希望文章能够帮你解决Linux Framebuffer(一) - 概述所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复