STRUCT DRM_ENCODER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct drm_encoder(9)

okay so this is the struct drm_encoder(9) page from the Kernel API Manual, and bestie, it's literally the central DRM encoder structure. like, the main character of encoders. let's get into it πŸŽ€


✨ NAME ✨

struct drm_encoder β€” the central DRM encoder structure, no cap. this is the one πŸ’–


🌸 SYNOPSIS 🌸

struct drm_encoder {
    struct drm_device *dev;
    struct list_head head;
    struct drm_mode_object base;
    char *name;
    int encoder_type;
    unsigned index;
    uint32_t possible_crtcs;
    uint32_t possible_clones;
    struct drm_crtc *crtc;
    struct list_head bridge_chain;
    struct mutex bridge_chain_mutex;
    const struct drm_encoder_funcs *funcs;
    const struct drm_encoder_helper_funcs *helper_private;
    struct dentry *debugfs_entry;
 };

that's the whole struct, every field, exactly as it is. slay 🫢


πŸ¦‹ Members πŸ¦‹

  • dev β€” the parent DRM device. it's giving "who's your parent" energy.
  • head β€” list management. lowkey just bookkeeping.
  • base β€” the base KMS object.
  • name β€” a human readable name, and yes the driver can overwrite it. it's customizable πŸ’…
  • encoder_type β€” one of the DRM_MODE_ENCODER_<foo> types in drm_mode.h. the encoder types defined thus far are:
    • DRM_MODE_ENCODER_DAC for VGA and analog on DVI-I/DVI-A.
    • DRM_MODE_ENCODER_TMDS for DVI, HDMI and (embedded) DisplayPort.
    • DRM_MODE_ENCODER_LVDS for display panels, or in general any panel with a proprietary parallel connector.
    • DRM_MODE_ENCODER_TVDAC for TV output (Composite, S-Video, Component, SCART).
    • DRM_MODE_ENCODER_VIRTUAL for virtual machine displays.
    • DRM_MODE_ENCODER_DSI for panels connected using the DSI serial bus.
    • DRM_MODE_ENCODER_DPI for panels connected using the DPI parallel bus.
    • DRM_MODE_ENCODER_DPMST for special fake encoders used to allow mutliple DP MST streams to share one physical encoder.
  • index β€” its position inside the mode_config.list, usable as an array index. it is invariant over the lifetime of the encoder, so it does not change on you, ever. iconic stability ✨
  • possible_crtcs β€” a bitmask of potential CRTC bindings, using drm_crtc_index as the index into the bitfield. the driver must set the bits for all drm_crtc objects this encoder can be connected to before calling drm_dev_register.
you will get a WARN if you get this wrong in the driver 😭 no pressure tho

note that since CRTC objects can't be hotplugged the assigned indices are stable and hence known before registering all objects.

  • possible_clones β€” a bitmask of potential sibling encoders for cloning, using drm_encoder_index as the index into the bitfield. the driver must set the bits for all drm_encoder objects which can clone a drm_crtc together with this encoder before calling drm_dev_register. drivers should set the bit representing the encoder itself, too. cloning bits should be set such that when two encoders can be used in a cloned configuration, they both should have each another bits set.

as an exception to the above rule, if the driver doesn't implement any cloning it can leave possible_clones set to 0. the core will automagically fix this up by setting the bit for the encoder itself. automagically. we love to see it 🧚

you will get a WARN if you get this wrong in the driver πŸ’€

note that since encoder objects can't be hotplugged the assigned indices are stable and hence known before registering all objects.

  • crtc β€” the currently bound CRTC, only really meaningful for non-atomic drivers. atomic drivers should instead check drm_connector_state.crtc. read the room, atomic drivers πŸŽ€
  • bridge_chain β€” bridges attached to this encoder. drivers shall not access this field directly. hands off, bestie πŸ™ˆ
  • bridge_chain_mutex β€” protect bridge_chain from changes while iterating.
  • funcs β€” control functions, can be NULL for simple managed encoders.
  • helper_private β€” mid-layer private data.
  • debugfs_entry β€” debugfs directory for this CRTC.

πŸ”₯ Description πŸ”₯

CRTCs drive pixels to encoders, which convert them into signals appropriate for a given connector or set of connectors. that's the whole vibe β€” pixels go in, signals come out πŸ‘‘


🌈 SEE ALSO 🌈

Kernel file ./include/drm/drm_encoder.h, plus these besties:


that's the whole page, periodt πŸ’œ this one lives in ./include/drm and it's dated October 2026 β€” so go forth, set your possible_crtcs bits correctly, and don't make the kernel WARN at you. mwah 🫢⭐

πŸ“¦ where this page comes from