The DRM display framework I understand

What is DRM:

The full name of DRM is DirectRenderingManager, which is a mainstream display framework of linux. It supports multi-layer composition and provides a unified API (libdrm) for user layers to access GPU and realize unified management. It was created to solve the problem of multiple programs accessing video card and using collaborative resources. DRM can be simply divided into three modules:

  • libdrm: It is a library that provides a general API to the upper layer, and encapsulates various ioctl interfaces at the bottom layer for image display and image processing. Of course, it is also possible to use drm's ioctl or framebuffer to operate and display images.
  • GEM: memory management, mainly responsible for display buffer allocation and release, video memory sharing and processing CPU, GPU memory synchronization
  • KMS: Kernel Mode Setting, which is used to update the screen and parameter settings, complete the configuration of the graphics card, and encapsulate the hardware gpu operation with a layer of interface. Can be abstracted into: Framebuffer, CRTC, Plane, Encoder, Connector and other modules.

DRM framework diagram:

The KMS framework consists of:

  • Framebuffer: A memory area for storing displayed image data, which can be accessed by both the driver and the application layer, and saves information such as resolution, color mode (yuv, rgb).
  • Crtc: Display control, such as display timings, resolution and other configurations, scan and read the data of Framebuffer, and transmit the content of superimposed Plane to Encoder. In vop (Video Output Processor), it is the lcdc controller.
  • Plane: Like Framebuffer, it is a piece of memory, a hardware image layer, and an image layer consists of one or more planes. The superposition of different interfaces of mobile phones is this principle. There are three types of planes:
    • DRM_PLANE_TYPE_PRIMARY: primary layer, display background or image content
    • DRM_PLANE_TYPE_OVERLAY: for display overlay, scaling
    • DRM_PLANE_TYPE_CURSOR: used to display the mouse
  • Encoder: The encoder converts the received data into different signals: mipi, edp, vga, etc.
  • Connector: Specific external interfaces, such as edp, hdmi, mipi, etc., are connected to the physical display output device, and store relevant information of the output device, such as: EDID, video mode, etc.

        The general process is that the user fills the displayed data in the Framebuffer, and then notifies the VOP device through the libdrm interface. The (crtc) vop driver superimposes the data of the Framebuffer and plane and converts it into a standard LCDC timing sequence, and then converts it into a specific mipi, edp, vga and other signals, to the Connector display output.

KMS frame diagram:

Guess you like

Origin blog.csdn.net/weixin_42432281/article/details/124837273