drm_encoder_init(9)
π drm_encoder_init(9) π
okay so this is a page straight out of the Kernel API Manual and it's about drm_encoder_init β the glow-up ritual for a preallocated encoder. yes bestie, we're doing DRM internals today, grab a strawberry π and let's go.
β¨ NAME β¨
drm_encoder_init β literally just "Init a preallocated encoder", that's the whole vibe π
πΈ SYNOPSIS πΈ
int drm_encoder_init (struct drm_device *dev , struct drm_encoder
*encoder , const struct drm_encoder_funcs *funcs , int encoder_type ,
const char *name , ... );
look at that signature, she's iconic π
π¦ ARGUMENTS π¦
devβ the drm device. the main character, the whole context, the it-girl πencoderβ the encoder you're about to init. she's already allocated, we're just giving her the makeover β¨funcsβ the callbacks for this encoder. her whole personality, lowkey π«Άencoder_typeβ the user visible type of the encoder. what the people see, no cap πnameβ printf style format string for the encoder name, orNULLfor the default name. your call, bestie π...β variable arguments. the little extras that go with your format string π
π DESCRIPTION π
so here's the tea β: this function initializes a preallocated encoder. that word matters, ngl β she has to already exist, you're not allocating her here.
your encoder should be subclassed as part of driver encoder objects. that's just how we do it, periodt.
now the part you cannot skip π β at driver unload time, the driver's drm_encoder_funcs.destroy hook should call drm_encoder_cleanup and kfree the encoder structure. clean up after yourself, girlies, the kernel does not have a group chat to remind you.
and the hard rule: the encoder structure should not be allocated with devm_kzalloc. not now, not ever, don't do it π
π§ NOTE π§
consider using drmm_encoder_alloc or drmm_encoder_init instead of drm_encoder_init β that way the DRM managed resource infrastructure takes care of cleanup and deallocation for you. it's giving "let the adults handle it" and honestly? slay π
β¨
β RETURN β
Zero on success, error code on failure. that's it, that's the whole mood π
π SEE ALSO π
- Kernel file
./drivers/gpu/drm/drm_encoder.coverview(9) drm_encoder_cleanup(9)drmm_encoder_init(9)
and that's the page, bestie!! brought to you by ./drivers/gpu/drm, dated October 2026, with drm_encoder_init(9) living her best life in the Kernel API Manual π go init something pretty β¨π¦π
π¦ 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