drm_encoder_init(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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, or NULL for 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 🌈


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