1DRM(7) Direct Rendering Manager DRM(7)
2
3
4
6 drm - Direct Rendering Manager
7
9 #include <xf86drm.h>
10
12 The Direct Rendering Manager (DRM) is a framework to manage Graphics
13 Processing Units (GPUs). It is designed to support the needs of complex
14 graphics devices, usually containing programmable pipelines well suited
15 to 3D graphics acceleration. Furthermore, it is responsible for memory
16 management, interrupt handling and DMA to provide a uniform interface
17 to applications.
18
19 In earlier days, the kernel framework was solely used to provide raw
20 hardware access to privileged user-space processes which implement all
21 the hardware abstraction layers. But more and more tasks were moved
22 into the kernel. All these interfaces are based on ioctl(2) commands on
23 the DRM character device. The libdrm library provides wrappers for
24 these system-calls and many helpers to simplify the API.
25
26 When a GPU is detected, the DRM system loads a driver for the detected
27 hardware type. Each connected GPU is then presented to user-space via a
28 character-device that is usually available as /dev/dri/card0 and can be
29 accessed with open(2) and close(2). However, it still depends on the
30 graphics driver which interfaces are available on these devices. If an
31 interface is not available, the syscalls will fail with EINVAL.
32
33 Authentication
34 All DRM devices provide authentication mechanisms. Only a DRM master is
35 allowed to perform mode-setting or modify core state and only one user
36 can be DRM master at a time. See drmSetMaster(3) for information on how
37 to become DRM master and what the limitations are. Other DRM users can
38 be authenticated to the DRM-Master via drmAuthMagic(3) so they can per‐
39 form buffer allocations and rendering.
40
41 Mode-Setting
42 Managing connected monitors and displays and changing the current modes
43 is called Mode-Setting. This is restricted to the current DRM master.
44 Historically, this was implemented in user-space, but new DRM drivers
45 implement a kernel interface to perform mode-setting called Kernel Mode
46 Setting (KMS). If your hardware-driver supports it, you can use the KMS
47 API provided by DRM. This includes allocating framebuffers, selecting
48 modes and managing CRTCs and encoders. See drm-kms(7) for more.
49
50 Memory Management
51 The most sophisticated tasks for GPUs today is managing memory objects.
52 Textures, framebuffers, command-buffers and all other kinds of commands
53 for the GPU have to be stored in memory. The DRM driver takes care of
54 managing all memory objects, flushing caches, synchronizing access and
55 providing CPU access to GPU memory. All memory management is hardware
56 driver dependent. However, two generic frameworks are available that
57 are used by most DRM drivers. These are the Translation Table Manager
58 (TTM) and the Graphics Execution Manager (GEM). They provide generic
59 APIs to create, destroy and access buffers from user-space. However,
60 there are still many differences between the drivers so driver-depedent
61 code is still needed. Many helpers are provided in libgbm (Graphics
62 Buffer Manager) from the Mesa project. For more information on DRM mem‐
63 ory management, see drm-memory(7).
64
66 Bugs in this manual should be reported to
67 https://gitlab.freedesktop.org/mesa/drm/-/issues.
68
70 drm-kms(7), drm-memory(7), drmSetMaster(3), drmAuthMagic(3), drmAvail‐
71 able(3), drmOpen(3)
72
73
74
75
76 September 2012 DRM(7)