As shown in, in addition to the upper-layer graphics applications, the kernel space includes the Linux FB device layer and the driver layer related to the specific HW, the source files are fb_mem.c, msm_fb.c, and mddi_toshiba.c. Next we will introduce them one by one.
Fb_mem.c functions and data structures
This file contains all interfaces of the Linux FB device. The main function interfaces and data structures are as follows:
A. file operation interface of the FB Device
B. Three Important data structures
Framebuffer has three important struct, defined in FB. H, as follows:
1), frame_var_screeninfo
This struct defines some variable features of the video card. These features can be dynamically changed by the application during the program running, typical examples include xrex and yres, which indicate the actual resolution and number of BITs displayed on the display. The user space of this struct can be accessed.
2) frame_fix_screeninfo
This struct defines some fixed features of the video card, which cannot be changed after hardware initialization. Among them, the most important members are smem_len and smem_start. The former indicates the size of the video memory (the size of the video memory defined in the program is twice the size of the whole screen data rgb565 ), the latter provides the physical address of the video memory. The struct user space can be accessed.
Note: smem_start is the physical address of the video. applications cannot directly access it. The application can only access it after the Matrix Function in fb_ops is mapped to a virtual address.
3) fb_info
The most important struct in framebuffer, which can only be accessed in the kernel space. The fb_ops struct is defined internally (including a series of framebuffer operation functions, such as open/read/write and address ing ).
C. Others
1) An important global variable
Struct fb_info * registered_fb [fb_max];
This variable records all instances of the fb_info structure. The fb_info Structure describes the current status of the video card. The fb_info structure of all devices is saved in this array, when a framebuffer Device Driver registers itself with the system, its corresponding fb_info structure will be added to this structure, and num_registered_fb will automatically add 1.
2) register the framebuffer Function
register_framebuffer(struct fb_info *fb_info);unregister_framebuffer(struct fb_info *fb_info);
These two interfaces are provided to the underlying framebuffer device drivers. The device drivers use these two functions to register or deregister themselves with the system. Almost all required for the underlying device driver is to fill in the fb_info structure and then register or deregister it with the system.