1. Introduction
Linux framebuffer is a hardware-independent abstraction layer for displaying images on a monitor, meaning a piece of memory area containing the current video frame
Framebuffer as an image of the display memory, mapped to the process address space, can be directly read and write operations, write operations can be immediately reflected on the screen, the operation is abstract unified, the user state process does not have to care about the physical memory location, the page change mechanism and other specific details ( Completed by framebuffer device driver)
2. Use of framebuffer
Framebuffer corresponding device files are generally/dev/fb0,/DEV/FB1, etc.
2.1 Related structures
Framebuffer need to know about two structures before use
Fb_var_screeninfo: Display properties of the graphics card, such as screen resolution, number of bits per pixel, user modifiable
Fb_fix_screeninfo: Hardware properties of the graphics card, the user is not modifiable, the driver is initialized when the settings
2.2 How to use
The general steps are as follows:
-Open Framebuffer Device (/DEV/FBX)
-Get current Fb_var_screeninfo information via the IOCTL Fbioget_vscreeninfo command
-Set the Fb_var_screeninfo parameters that need to be modified and set the information via the IOCTL fbioput_vscreeninfo (optional)
-Set global alpha and Blank/unblank parameters, by using multiple FB cases (optional)
-Calculate total screen size (in bytes): Xres * yres * BITS_PER_PIXEL/8
-Map to User process address space: mmap
-Write data to the mapped address space
-Delete Mapping (MUNMAP), turn off framebuffer device
2.3 Example
Instance
3. Implementation of framebuffer drivers in Linux
The Linux implementation framebuffer the part of the file layer, provides the interface to the user (some interfaces need to be driven at the same time), and provides a registration interface to the driver.
See document LINUX/DRIVERS/VIDEO/FBMEM.C for details
The registration interface provided to the driver is Register_framebuffer (struct fb_info *fb_info)
Where the parameter fb_info describes the framebuffer driver information for a particular hardware
Main members include Fb_var_screeninfo, Fb_fix_screeninfo, Fb_cmap and Fb_ops
Introduction and use of Linux framebuffer