Introduction

As mentioned in the first post of this series, DRM is a subsystem of the Linux kernel responsible for interfacing with GPUs of modern video cards. It exposes an API that user-space programs can use to send commands and data to the GPU and perform operations such as configuring the mode setting of the display and hardware-accelerated 3D rendering.

This post will focus on DRM’s KMS subsystem.

Kernel Mode Setting (KMS)

KMS1 is a component of the DRM subsystem that is responsible for setting the display mode2 and configuration for the graphics hardware. It is used to initialize the graphics hardware at boot time and to change the display configuration dynamically as needed.

KMS is composed of the following data structures:

  • Framebuffers3 are a memory buffer containing data representing all the pixels in an on-screen image, plus information about the image’s color format and size. The framebuffer stores the compositor’s (i.e. Wayland) image.
  • Planes4 represent an image source that specifies the position, orientation, and scaling factors. They are exposed by the hardware and exposed by the Kernel driver.
  • Cathode-ray tube controller (CRTC)5 represent the overall display pipeline. It fetches pixel data from one or more planes (or even no), blends overlapping planes where necessary, and forwards the result to its outputs. CRTC are created and set by the driver.
  • Encoders6 are the hardware components that encode pixel data into the physical signal understood by the connector. They are created and set by the driver. Encoders are associated with a specific connector.
  • Connectors7 represent the physical connection to an output device, such as HDMI or VGA ports with a connected monitor. The connector also provides information on the output device’s supported display modes, physical resolution, color space, and the like. Connectors are created and set by the driver.
Github Actions
Source: https://lwn.net/Articles/955708/

Conclusion

This is the most basic stuff needed to understand KMS and start working with the modern Linux Kernel graphic stack. If you want to know more about KMS I recommend you to read the The Linux graphics stack in a nutshell, part 2 8 written by Thomas Zimmermann. It is very good! By the way, there’s no need to read part 1 to understand part 2.

Next

A Kernel story III: Presenting the hardware

References

  1. KMS
  2. Mode setting
  3. Framebuffer
  4. Plane
  5. CRTC
  6. Encode
  7. Connector
  8. The Linux graphics stack in a nutshell, part 2)