xref: /aosp_15_r20/external/libdrm/man/drm.7.rst (revision 7688df22e49036ff52a766b7101da3a49edadb8c)
1*7688df22SAndroid Build Coastguard Worker===
2*7688df22SAndroid Build Coastguard Workerdrm
3*7688df22SAndroid Build Coastguard Worker===
4*7688df22SAndroid Build Coastguard Worker
5*7688df22SAndroid Build Coastguard Worker------------------------
6*7688df22SAndroid Build Coastguard WorkerDirect Rendering Manager
7*7688df22SAndroid Build Coastguard Worker------------------------
8*7688df22SAndroid Build Coastguard Worker
9*7688df22SAndroid Build Coastguard Worker:Date: September 2012
10*7688df22SAndroid Build Coastguard Worker:Manual section: 7
11*7688df22SAndroid Build Coastguard Worker:Manual group: Direct Rendering Manager
12*7688df22SAndroid Build Coastguard Worker
13*7688df22SAndroid Build Coastguard WorkerSynopsis
14*7688df22SAndroid Build Coastguard Worker========
15*7688df22SAndroid Build Coastguard Worker
16*7688df22SAndroid Build Coastguard Worker``#include <xf86drm.h>``
17*7688df22SAndroid Build Coastguard Worker
18*7688df22SAndroid Build Coastguard WorkerDescription
19*7688df22SAndroid Build Coastguard Worker===========
20*7688df22SAndroid Build Coastguard Worker
21*7688df22SAndroid Build Coastguard WorkerThe *Direct Rendering Manager* (DRM) is a framework to manage *Graphics
22*7688df22SAndroid Build Coastguard WorkerProcessing Units* (GPUs). It is designed to support the needs of complex
23*7688df22SAndroid Build Coastguard Workergraphics devices, usually containing programmable pipelines well suited
24*7688df22SAndroid Build Coastguard Workerto 3D graphics acceleration. Furthermore, it is responsible for memory
25*7688df22SAndroid Build Coastguard Workermanagement, interrupt handling and DMA to provide a uniform interface to
26*7688df22SAndroid Build Coastguard Workerapplications.
27*7688df22SAndroid Build Coastguard Worker
28*7688df22SAndroid Build Coastguard WorkerIn earlier days, the kernel framework was solely used to provide raw
29*7688df22SAndroid Build Coastguard Workerhardware access to privileged user-space processes which implement all
30*7688df22SAndroid Build Coastguard Workerthe hardware abstraction layers. But more and more tasks were moved into
31*7688df22SAndroid Build Coastguard Workerthe kernel. All these interfaces are based on **ioctl**\ (2) commands on
32*7688df22SAndroid Build Coastguard Workerthe DRM character device. The *libdrm* library provides wrappers for these
33*7688df22SAndroid Build Coastguard Workersystem-calls and many helpers to simplify the API.
34*7688df22SAndroid Build Coastguard Worker
35*7688df22SAndroid Build Coastguard WorkerWhen a GPU is detected, the DRM system loads a driver for the detected
36*7688df22SAndroid Build Coastguard Workerhardware type. Each connected GPU is then presented to user-space via a
37*7688df22SAndroid Build Coastguard Workercharacter-device that is usually available as ``/dev/dri/card0`` and can
38*7688df22SAndroid Build Coastguard Workerbe accessed with **open**\ (2) and **close**\ (2). However, it still
39*7688df22SAndroid Build Coastguard Workerdepends on the graphics driver which interfaces are available on these
40*7688df22SAndroid Build Coastguard Workerdevices. If an interface is not available, the syscalls will fail with
41*7688df22SAndroid Build Coastguard Worker``EINVAL``.
42*7688df22SAndroid Build Coastguard Worker
43*7688df22SAndroid Build Coastguard WorkerAuthentication
44*7688df22SAndroid Build Coastguard Worker--------------
45*7688df22SAndroid Build Coastguard Worker
46*7688df22SAndroid Build Coastguard WorkerAll DRM devices provide authentication mechanisms. Only a DRM master is
47*7688df22SAndroid Build Coastguard Workerallowed to perform mode-setting or modify core state and only one user
48*7688df22SAndroid Build Coastguard Workercan be DRM master at a time. See **drmSetMaster**\ (3) for information
49*7688df22SAndroid Build Coastguard Workeron how to become DRM master and what the limitations are. Other DRM users
50*7688df22SAndroid Build Coastguard Workercan be authenticated to the DRM-Master via **drmAuthMagic**\ (3) so they
51*7688df22SAndroid Build Coastguard Workercan perform buffer allocations and rendering.
52*7688df22SAndroid Build Coastguard Worker
53*7688df22SAndroid Build Coastguard WorkerMode-Setting
54*7688df22SAndroid Build Coastguard Worker------------
55*7688df22SAndroid Build Coastguard Worker
56*7688df22SAndroid Build Coastguard WorkerManaging connected monitors and displays and changing the current modes
57*7688df22SAndroid Build Coastguard Workeris called *Mode-Setting*. This is restricted to the current DRM master.
58*7688df22SAndroid Build Coastguard WorkerHistorically, this was implemented in user-space, but new DRM drivers
59*7688df22SAndroid Build Coastguard Workerimplement a kernel interface to perform mode-setting called *Kernel Mode
60*7688df22SAndroid Build Coastguard WorkerSetting* (KMS). If your hardware-driver supports it, you can use the KMS
61*7688df22SAndroid Build Coastguard WorkerAPI provided by DRM. This includes allocating framebuffers, selecting
62*7688df22SAndroid Build Coastguard Workermodes and managing CRTCs and encoders. See **drm-kms**\ (7) for more.
63*7688df22SAndroid Build Coastguard Worker
64*7688df22SAndroid Build Coastguard WorkerMemory Management
65*7688df22SAndroid Build Coastguard Worker-----------------
66*7688df22SAndroid Build Coastguard Worker
67*7688df22SAndroid Build Coastguard WorkerThe most sophisticated tasks for GPUs today is managing memory objects.
68*7688df22SAndroid Build Coastguard WorkerTextures, framebuffers, command-buffers and all other kinds of commands
69*7688df22SAndroid Build Coastguard Workerfor the GPU have to be stored in memory. The DRM driver takes care of
70*7688df22SAndroid Build Coastguard Workermanaging all memory objects, flushing caches, synchronizing access and
71*7688df22SAndroid Build Coastguard Workerproviding CPU access to GPU memory. All memory management is hardware
72*7688df22SAndroid Build Coastguard Workerdriver dependent. However, two generic frameworks are available that are
73*7688df22SAndroid Build Coastguard Workerused by most DRM drivers. These are the *Translation Table Manager*
74*7688df22SAndroid Build Coastguard Worker(TTM) and the *Graphics Execution Manager* (GEM). They provide generic
75*7688df22SAndroid Build Coastguard WorkerAPIs to create, destroy and access buffers from user-space. However,
76*7688df22SAndroid Build Coastguard Workerthere are still many differences between the drivers so driver-dependent
77*7688df22SAndroid Build Coastguard Workercode is still needed. Many helpers are provided in *libgbm* (Graphics
78*7688df22SAndroid Build Coastguard WorkerBuffer Manager) from the *Mesa* project. For more information on DRM
79*7688df22SAndroid Build Coastguard Workermemory management, see **drm-memory**\ (7).
80*7688df22SAndroid Build Coastguard Worker
81*7688df22SAndroid Build Coastguard WorkerReporting Bugs
82*7688df22SAndroid Build Coastguard Worker==============
83*7688df22SAndroid Build Coastguard Worker
84*7688df22SAndroid Build Coastguard WorkerBugs in this manual should be reported to
85*7688df22SAndroid Build Coastguard Workerhttps://gitlab.freedesktop.org/mesa/drm/-/issues.
86*7688df22SAndroid Build Coastguard Worker
87*7688df22SAndroid Build Coastguard WorkerSee Also
88*7688df22SAndroid Build Coastguard Worker========
89*7688df22SAndroid Build Coastguard Worker
90*7688df22SAndroid Build Coastguard Worker**drm-kms**\ (7), **drm-memory**\ (7), **drmSetMaster**\ (3),
91*7688df22SAndroid Build Coastguard Worker**drmAuthMagic**\ (3), **drmAvailable**\ (3), **drmOpen**\ (3)
92