STRUCT DRM_ENCODER(9)
π 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 theDRM_MODE_ENCODER_<foo>types indrm_mode.h. the encoder types defined thus far are:DRM_MODE_ENCODER_DACfor VGA and analog on DVI-I/DVI-A.DRM_MODE_ENCODER_TMDSfor DVI, HDMI and (embedded) DisplayPort.DRM_MODE_ENCODER_LVDSfor display panels, or in general any panel with a proprietary parallel connector.DRM_MODE_ENCODER_TVDACfor TV output (Composite, S-Video, Component, SCART).DRM_MODE_ENCODER_VIRTUALfor virtual machine displays.DRM_MODE_ENCODER_DSIfor panels connected using the DSI serial bus.DRM_MODE_ENCODER_DPIfor panels connected using the DPI parallel bus.DRM_MODE_ENCODER_DPMSTfor special fake encoders used to allow mutliple DP MST streams to share one physical encoder.
indexβ its position inside themode_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, usingdrm_crtc_indexas the index into the bitfield. the driver must set the bits for alldrm_crtcobjects this encoder can be connected to before callingdrm_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, usingdrm_encoder_indexas the index into the bitfield. the driver must set the bits for alldrm_encoderobjects which can clone adrm_crtctogether with this encoder before callingdrm_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 checkdrm_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β protectbridge_chainfrom changes while iterating.funcsβ control functions, can beNULLfor 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:
struct drm_encoder_funcs(9)drmm_encoder_alloc(9)drmm_plain_encoder_alloc(9)drm_encoder_index(9)drm_encoder_mask(9)drm_encoder_crtc_ok(9)drm_encoder_find(9)drm_for_each_encoder_mask(9)drm_for_each_encoder(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms