Module drm::buffer

source · []
Expand description

Memory management and buffer functionality that the DRM subsystem exposes.

Summary

The DRM subsystem exposes functionality for managing memory on modern GPU devices using a system called the Graphics Execution Manager (GEM). This system manages GPU buffers and exposes them to userspace using 32-bit handles. These handles are automatically reference counted in the kernel.

GEM provides a small API for sharing buffers between processes. However, it does not provide any generic API for creating these. Instead, each driver provides its own method of creating these buffers. The libgbm library (part of the mesa project) provides a driver agnostic method of creating these buffers.

There are two methods of sharing a GEM handle between processes:

  1. Using Flink to globally publish a handle using a 32-bit ‘name’. This requires either holding the DRM Master lock or having the process’ AuthToken authenticated. However, any process can open these handles if they know (or even guess) the global name.

  2. Converting the GEM handle into a PRIME file descriptor, and passing it like a regular one. This allows better control and security, and is the recommended method of sharing buffers.

Structs

A handle to a GEM buffer

The name of a GEM buffer.

Wraps some u32 that isn’t a DRM fourcc we recognize

Wraps some u8 that isn’t a DRM vendor we recognize

Enums

Traits

Common functionality of all regular buffers.

Planar buffers are buffers where each channel/plane is in its own buffer.