Introduction and use of Linux framebuffer

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.