drm.7.rst revision 41687f09
141687f09Smrg=== 241687f09Smrgdrm 341687f09Smrg=== 441687f09Smrg 541687f09Smrg------------------------ 641687f09SmrgDirect Rendering Manager 741687f09Smrg------------------------ 841687f09Smrg 941687f09Smrg:Date: September 2012 1041687f09Smrg:Manual section: 7 1141687f09Smrg:Manual group: Direct Rendering Manager 1241687f09Smrg 1341687f09SmrgSynopsis 1441687f09Smrg======== 1541687f09Smrg 1641687f09Smrg``#include <xf86drm.h>`` 1741687f09Smrg 1841687f09SmrgDescription 1941687f09Smrg=========== 2041687f09Smrg 2141687f09SmrgThe *Direct Rendering Manager* (DRM) is a framework to manage *Graphics 2241687f09SmrgProcessing Units* (GPUs). It is designed to support the needs of complex 2341687f09Smrggraphics devices, usually containing programmable pipelines well suited 2441687f09Smrgto 3D graphics acceleration. Furthermore, it is responsible for memory 2541687f09Smrgmanagement, interrupt handling and DMA to provide a uniform interface to 2641687f09Smrgapplications. 2741687f09Smrg 2841687f09SmrgIn earlier days, the kernel framework was solely used to provide raw 2941687f09Smrghardware access to privileged user-space processes which implement all 3041687f09Smrgthe hardware abstraction layers. But more and more tasks were moved into 3141687f09Smrgthe kernel. All these interfaces are based on **ioctl**\ (2) commands on 3241687f09Smrgthe DRM character device. The *libdrm* library provides wrappers for these 3341687f09Smrgsystem-calls and many helpers to simplify the API. 3441687f09Smrg 3541687f09SmrgWhen a GPU is detected, the DRM system loads a driver for the detected 3641687f09Smrghardware type. Each connected GPU is then presented to user-space via a 3741687f09Smrgcharacter-device that is usually available as ``/dev/dri/card0`` and can 3841687f09Smrgbe accessed with **open**\ (2) and **close**\ (2). However, it still 3941687f09Smrgdepends on the graphics driver which interfaces are available on these 4041687f09Smrgdevices. If an interface is not available, the syscalls will fail with 4141687f09Smrg``EINVAL``. 4241687f09Smrg 4341687f09SmrgAuthentication 4441687f09Smrg-------------- 4541687f09Smrg 4641687f09SmrgAll DRM devices provide authentication mechanisms. Only a DRM master is 4741687f09Smrgallowed to perform mode-setting or modify core state and only one user 4841687f09Smrgcan be DRM master at a time. See **drmSetMaster**\ (3) for information 4941687f09Smrgon how to become DRM master and what the limitations are. Other DRM users 5041687f09Smrgcan be authenticated to the DRM-Master via **drmAuthMagic**\ (3) so they 5141687f09Smrgcan perform buffer allocations and rendering. 5241687f09Smrg 5341687f09SmrgMode-Setting 5441687f09Smrg------------ 5541687f09Smrg 5641687f09SmrgManaging connected monitors and displays and changing the current modes 5741687f09Smrgis called *Mode-Setting*. This is restricted to the current DRM master. 5841687f09SmrgHistorically, this was implemented in user-space, but new DRM drivers 5941687f09Smrgimplement a kernel interface to perform mode-setting called *Kernel Mode 6041687f09SmrgSetting* (KMS). If your hardware-driver supports it, you can use the KMS 6141687f09SmrgAPI provided by DRM. This includes allocating framebuffers, selecting 6241687f09Smrgmodes and managing CRTCs and encoders. See **drm-kms**\ (7) for more. 6341687f09Smrg 6441687f09SmrgMemory Management 6541687f09Smrg----------------- 6641687f09Smrg 6741687f09SmrgThe most sophisticated tasks for GPUs today is managing memory objects. 6841687f09SmrgTextures, framebuffers, command-buffers and all other kinds of commands 6941687f09Smrgfor the GPU have to be stored in memory. The DRM driver takes care of 7041687f09Smrgmanaging all memory objects, flushing caches, synchronizing access and 7141687f09Smrgproviding CPU access to GPU memory. All memory management is hardware 7241687f09Smrgdriver dependent. However, two generic frameworks are available that are 7341687f09Smrgused by most DRM drivers. These are the *Translation Table Manager* 7441687f09Smrg(TTM) and the *Graphics Execution Manager* (GEM). They provide generic 7541687f09SmrgAPIs to create, destroy and access buffers from user-space. However, 7641687f09Smrgthere are still many differences between the drivers so driver-depedent 7741687f09Smrgcode is still needed. Many helpers are provided in *libgbm* (Graphics 7841687f09SmrgBuffer Manager) from the *Mesa* project. For more information on DRM 7941687f09Smrgmemory management, see **drm-memory**\ (7). 8041687f09Smrg 8141687f09SmrgReporting Bugs 8241687f09Smrg============== 8341687f09Smrg 8441687f09SmrgBugs in this manual should be reported to 8541687f09Smrghttps://gitlab.freedesktop.org/mesa/drm/-/issues. 8641687f09Smrg 8741687f09SmrgSee Also 8841687f09Smrg======== 8941687f09Smrg 9041687f09Smrg**drm-kms**\ (7), **drm-memory**\ (7), **drmSetMaster**\ (3), 9141687f09Smrg**drmAuthMagic**\ (3), **drmAvailable**\ (3), **drmOpen**\ (3) 92