the framebuffer (frame buffer)

Frame buffer device corresponding device file / dev / fb *

By / dev / fb, operating mainly in the application of these types:

1. R / W (read / write) / dev / fb: the equivalent of Read / Write screen buffer.

2. Mapping (map) operations: Because Linux work in protected mode, each application has its own virtual address space, the application can not directly access the physical address of the buffer. And frame buffer devices may be) through the mapping operation maps mmap (physical address of the section of the screen buffer to the virtual address space of the user, then the user can read and write this address to access virtual screen buffer, the drawing on the screen.

3. I / O control: For the frame buffer, the ioctl operation of the device the file may be read / set the display parameters of the device and a screen related parameters, such as resolution, screen size and the like. ioctl operation by the driver to complete the bottom.

 

In application, the general steps / dev / fb is as follows:

1. On / dev / fb device as a normal file operations, mainly open, close, write, read, lseek and so on.

2. Obtaining a parameter of the current display screen with ioctl operation, calculated according to the screen size of screen buffer parameters.

3. The map screen buffer to user space.

4. After mapping you can read and write directly to the screen buffer, plotting and display pictures.

 

Open a fb equipment:

int fd = 0; 

fd = open("/dev/graphics/fb0", O_RDWR);

if (fd < 0) { 

  perror("cannot open fb0");

  return -1; 

}

Ioctl call to get the setup screen parameters:

static struct fb_var_screeninfo we;

 

 

 

File / dev / fb0 is the color of each point on the control screen file

Guess you like

Origin www.cnblogs.com/yangxingsha/p/11358962.html