drmm_crtc_alloc_with_planes(9)
π 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 thestruct drm_crtc. yes, type. you're telling it where to look.memberβ the name of thedrm_crtcinside 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β aprintfstyle format string for the CRTC name, orNULLfor 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: thedrm_crtc_funcs.destroyhook must beNULL. not "should be", not "ideally", must. if you set it, you're doing it wrong. periodt.
π RETURN π
- Pointer to the new crtc π
- or
ERR_PTRon 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:
- Kernel file
./include/drm/drm_crtc.h - struct
drm_crtc_state(9) - struct
drm_crtc_funcs(9) - struct
drm_crtc(9) - struct
drm_mode_set(9) drm_crtc_index(9)drm_crtc_mask(9)drm_crtc_find(9)drm_for_each_crtc(9)drm_for_each_crtc_reverse(9)
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
- 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