drmm_crtc_alloc_with_planes(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ drmm_crtc_alloc_with_planes πŸ’…

okay bestie, so this one is from the kernel API manual, section 9 β€” and it's genuinely one of the good ones. it lives in ./include/drm/drm_crtc.h and it's about making a whole new CRTC for your DRM device. let's get into it ✨


🌸 NAME 🌸

drmm_crtc_alloc_with_planes β€” allocate and initialize a shiny new CRTC object with the primary and cursor planes you specify. that's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

drmm_crtc_alloc_with_planes (dev , type , member , primary , cursor ,
        funcs , name , ... );

like, yes, that's a lot of arguments. no cap, it's giving "trust the process". 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the DRM device. your main character. the whole thing runs through this.
  • type β€” the type of the struct that contains the struct drm_crtc. yes, type. you're telling it where to look.
  • member β€” the name of the drm_crtc inside type. so it can find the exact member, iykyk.
  • primary β€” the Primary plane for the CRTC. essential. πŸ”₯
  • cursor β€” the Cursor plane for the CRTC. also here, also iconic.
  • funcs β€” the callbacks for the new CRTC. all the behavior lives here.
  • name β€” a printf style format string for the CRTC name, or NULL for the default name. you can be cute with it, or you can just let the default handle it. πŸ™ˆ
  • ... β€” variable arguments. the ... is literally there, do not forget it, it's the vibe-check pass-through. πŸ’…

🧚 DESCRIPTION 🧚

so what it actually does: it allocates and initializes a new crtc object. that's it, that's the job. ⭐

and here's the slay part β€” cleanup is automatically handled through registering drmm_crtc_cleanup with drmm_add_action. so you don't have to manually remember to tear everything down later. the managed-resource machinery has your back. πŸ’œ

🚨 important caveat, no skipping: the drm_crtc_funcs.destroy hook must be NULL. not "should be", not "ideally", must. if you set it, you're doing it wrong. periodt.

πŸ’€ RETURN πŸ’€

  • Pointer to the new crtc πŸŽ‰
  • or ERR_PTR on failure 😭

that's it. check it, don't ignore it. ERR_PTR is not your friend, but it will show up if something goes sideways.


🌈 SEE ALSO 🌈

literally all the relatives, bestie, they're all in the family group chat:


okay and one last thing before you close the tab 🫢 β€” this page comes out of ./include/drm, dated October 2026, and it's the drmm_crtc_alloc_with_planes(9) page itself. go forth and allocate responsibly. mwah. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from