# `Emerge.Config.DRM`
[🔗](https://github.com/emerge-elixir/emerge/blob/v0.5.1/lib/emerge/config/drm.ex#L1)

A display connected directly to Linux DRM/KMS, without a window manager.
Set this record as `Emerge.Config.output`.

```elixir
%Emerge.Config{
  output: %Emerge.Config.DRM{card: "/dev/dri/card0", connector: "DSI-1"},
  renderer: %Emerge.Config.Renderer{api: :opengl}
}
```

## Fields

- `card` — absolute path to the display's KMS device; defaults to
  `"/dev/dri/card0"`. A stable `/dev/dri/by-path/...-card` path is also accepted.
- `connector` — connector name, such as `"DSI-1"` or `"DP-1"`. The default `nil`
  selects an available output automatically.
- `mode` — an advertised mode ID or a mode map returned by
  `EmergeSkia.drm_outputs/1`. Defaults to `nil` for automatic mode selection.
  An explicit mode also requires an explicit connector. Invalid selections
  return an error rather than silently choosing another display or mode.
- `preferred_size` — optional `{width, height}` hint for automatic mode selection.
  Defaults to `nil`. The selected mode determines the actual display size.
- `display` — `:on` (default) or `:off`. Off blanks the display and ignores its
  UI input; it does not suspend your application or the operating system.
- `backlight` — `Emerge.Config.Backlight`, defaulting to automatic association.
  Use it to select a panel backlight and request brightness.
- `hotplug_interval_ms` — connector hotplug polling interval in milliseconds;
  defaults to `750`. Set it to `nil` to disable polling for built-in panels.

Discover connector names and modes with `EmergeSkia.drm_outputs(drm_card: path)`.

## Changing settings

`display` and backlight brightness can change through `config` with an explicit
OpenGL, Vulkan or raster renderer. Raster supports CPU presentation (including
its `:auto` default) and explicit `raster_present: :gpu_upload`, which requires
the OpenGL DRM presenter build. Automatic API selection does not support these
controls. Off destroys the internal presenter;
on recreates it and enables a managed backlight after its first application
presentation. GPU resources are not restored.

Changing the card, connector, mode, size hint, backlight device or hotplug polling
interval requires a new viewport. Applications using off/on need an independent
wake source, such as a power-button reader; input from the blanked display cannot
wake it.

# `display`

```elixir
@type display() :: :on | :off
```

Desired display state, not application or system power state.

# `normalized_t`

```elixir
@type normalized_t() :: %Emerge.Config.DRM{
  backlight: Emerge.Config.Backlight.normalized_t(),
  card: String.t(),
  connector: String.t() | nil,
  display: display(),
  hotplug_interval_ms: pos_integer() | nil,
  mode: String.t() | map() | nil,
  preferred_size: {pos_integer(), pos_integer()} | nil
}
```

Canonical form after nested keyword records have been expanded.

# `t`

```elixir
@type t() :: %Emerge.Config.DRM{
  backlight: Emerge.Config.Backlight.t() | Emerge.Config.Backlight.options(),
  card: String.t(),
  connector: String.t() | nil,
  display: display(),
  hotplug_interval_ms: pos_integer() | nil,
  mode: String.t() | map() | nil,
  preferred_size: {pos_integer(), pos_integer()} | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
