DRM(4) | Device Drivers Manual | DRM(4)

# NAME

`drm` — Direct Rendering Manager — display configuration and graphics rendering acceleration

# SYNOPSIS

## Kernel mode-setting drivers

`amdgpu* at pci? dev ? function ?`
`i915drmkms* at pci? dev ? function ?`
`nouveau* at pci? dev ? function ?`
`radeon* at pci? dev ? function ?`
`rkdrm* at fdt? pass 5`
`sunxidrm* at fdt? pass 5`
`tegradrm* at fdt? pass 5`

## Legacy user mode-setting options and drivers

`options DRM_LEGACY`
`viadrmums* at drm?`

## Options

`options DRM_MAX_RESOLUTION_HORIZONTAL=integer`
`options DRM_MAX_RESOLUTION_VERTICAL=integer`

# DESCRIPTION

The Direct Rendering Manager is part of the Direct Rendering Infrastructure for supporting display configuration and hardware acceleration for graphics rendering and other computation on a graphics processing unit (GPU).

`drm` drivers come in two generations:

Kernel mode-setting (KMS)
  Modern drivers that query and control display configuration in the kernel via ioctl(2) commands exposed to userland.

  The /dev/dri/render* device nodes provide access to graphics buffers and command stream submission for rendering. The /dev/dri/card* device nodes additionally provide access to the display configuration.

  KMS drivers provided as modules must generally be loaded by the bootloader, configured in boot.cfg(8), and cannot be loaded dynamically.

User mode-setting (UMS)
  Legacy drivers that rely on userland support code that accesses device registers in the X(7) server to query and control display configuration. The kernel may be unable to recover if the display server crashes, or the device is suspended or resumed.

  The kernel driver and /dev/dri/card* interfaces only manage buffers mapped in the GPU address space. Display configuration from userland requires the `INSECURE` option (see options(4)) to allow userland access to device registers.

  The `DRM_LEGACY` option allows legacy UMS drivers to be loaded as modules (see module(7)).

The `drm` drivers provide support for the following graphics devices:

amdgpu
  Newer AMD graphics devices.
i915drmkms
  Intel integrated graphics devices from the i915 series onward. (Some i8xx support is included but not well-maintained. i7xx is not supported.)
nouveau
  NVIDIA graphics devices.
radeon
  Older AMD (including formerly ATI) Radeon graphics devices.
viadrmums (legacy UMS)
  VIA graphics devices.

With some drivers (at least radeon(4)), in some cases the driver does not choose the resolution correctly. The options `DRM_MAX_RESOLUTION_HORIZONTAL` and `DRM_MAX_RESOLUTION_VERTICAL` allow limiting the maximum resolution in X and Y direction.

X(7) will attempt to create the device nodes automatically and use `drm` automatically. To create a device node manually:

    mkdir -p /dev/dri
    mknod /dev/dri/card0 c 180 0
    chgrp wheel /dev/dri/card0
    chmod 0660 /dev/dri/card0

Debugging output can be enabled and disabled by setting flag bits in the sysctl(8) node `hw.drm2.__drm_debug`. Various other knobs may be available under `hw.drm2`.

# FILES

/dev/dri/render*
  Provides access to graphics buffers and command stream submission for rendering. Generally unprivileged.
/dev/dri/card*
  In addition to everything provided by /dev/dri/render*, provides access to change the display configuration. Usually privileged.

# CODE REFERENCES

The `drm` subsystem and drivers mostly live under sys/external/bsd/drm2, with various Linux API shims in sys/external/bsd/common and some individual `drm` drivers scattered elsewhere in the tree.

# SEE ALSO

Xorg(1), agp(4), xorg.conf(5), X(7)

Direct Rendering Infrastructure

# HISTORY

`drm` was first available for Linux and later ported to FreeBSD and NetBSD. The port to NetBSD was redone after the introduction of KMS.

The first generation of `drm` drivers appeared in NetBSD 5.0. The second generation of `drm` with KMS appeared in NetBSD 7.0.

# AUTHORS

Too many to list.

Work on the NetBSD port was contributed by: Anonymous, Nia Alarie, Eric Anholt, Rafal Boni, Taylor R Campbell, Mihai Chelaru, David Brownlee, Jaromír Doleek, Matthias Drochner, Christoph Egger, FUKAUMI Naoki, Paul Goyette, matthew green, Yorick Hardy, Nick Hudson, Martin Husemann, Arto Huusko, Thomas Klausner, Jonathan Kollasch, Tonnerre Lombard, Jared McNeill, Jeremy Morse, Kimihiro Nonaka, Tobias Nygren, Rin Okuyama, Maya Rashish, Erik Reid, Masanobu SAITOH, Blair Sadewitz, Chuck Silvers, Nathanial Sloss, Jörg Sonnenberger, Grégoire Sutre, Matt Thomas, Izumi Tsutsui, Patrick Welche, and Christos Zoulas.

# CAVEATS

`drm` is large and complicated and has no shortage of bugs. On systems where graphics is not important, you may wish to use userconf(4) to disable the special-purpose `drm` drivers for your graphics device and fall back to vga(4) or genfb(4) with the default display configuration provided by firmware.

`drm` is not ‘Digital Rights Management’ and does not deprive you of agency over your own computer, except insofar as the code base is difficult to maintain.

October 21, 2023 | NetBSD 11.99