drm_universal_plane_init(9)
๐ drm_universal_plane_init(9) โ like, the kernel API manual, but make it make sense ๐
okay bestie, so this is a page from the Kernel API Manual, and it's all about drm_universal_plane_init โ the lil function that births a brand-new universal plane object into the world โจ no cap, it's giving "congratulations, it's a plane" energy.
โจ NAME โจ
drm_universal_plane_init โ initializes a new universal plane object ๐ฆ (yes that's literally the whole job, and it eats every time)
๐ธ SYNOPSIS ๐ธ
int drm_universal_plane_init (struct drm_device *dev , struct drm_plane
*plane , uint32_t possible_crtcs , const struct drm_plane_funcs *funcs ,
const uint32_t *formats , unsigned int format_count , const uint64_t
*format_modifiers , enum drm_plane_type type , const char *name , ... );
like, look at all those arguments ๐ญ she's high maintenance but she's worth it
๐ ARGUMENTS ๐
devโ the DRM device, the whole main character here ๐planeโ the plane object to init, i.e. the baby we're delivering ๐ผpossible_crtcsโ bitmask of possible CRTCs, lowkey just a vibe map of who's allowed to hang with this planefuncsโ callbacks for the new plane, her whole personality basicallyformatsโ array of supported formats (DRM_FORMAT_โฆ yeah the manpage cuts off mid-token there, that's just how it is, we don't gatekeep ๐)format_countโ number of elements informats, the count, the receipts, the number of things ๐งฎformat_modifiersโ array ofstruct drm_formatmodifiers terminated byDRM_FORMAT_MOD_INVALID(theDRM_FORMAT_MOD_INVALIDis literally the periodt at the end of the sentence, it's how you know she's done)typeโ type of plane (overlay,primary,cursor) โ pick her aesthetic ๐nameโprintfstyle format string for the plane name, orNULLfor the default name (no thoughts, head empty, default name it is)...โ variable arguments, the surprise guests at the party ๐
๐ฆ DESCRIPTION ๐ฆ
So like, this function initializes a plane object of type type. That's the entire plot.
The drm_plane_funcs.destroy hook should call drm_plane_cleanup and kfree the plane structure โ both, bestie, not one, not the other, both ๐ซถ
๐จ and listen: the plane structure should not be allocated with devm_kzalloc. Do not do that. I'm serious. Not the move. ๐
๐ NOTE ๐
okay so first thing โ consider using drmm_universal_plane_alloc instead of drm_universal_plane_init, because that way you let the DRM managed resource infrastructure take care of cleanup and deallocation for you. That's it. That's the whole tip. Let the infrastructure be your unproblematic fave โจ
Second thing โ drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set format_modifiers to NULL. When you do that, the plane will advertise the linear modifier. (yes the original says "support" twice like that, we're leaving it, it's iconic ๐)
๐ RETURN ๐
- Zero on success ๐ฅ
- error code on failure ๐ญ
that's it. zero means slay. anything else means go read the error code, babe.
โญ SEE ALSO โญ
the whole group chat, fr fr:
- Kernel file
./drivers/gpu/drm/drm_plane.c overview(9)standard plane properties(9)hotspot properties(9)drm_plane_create_hotspot_properties(9)drm_plane_cleanup(9)drm_plane_from_index(9)drm_plane_force_disable(9)drm_mode_plane_set_obj_prop(9)drm_plane_has_format(9)drm_any_plane_has_format(9)damage tracking(9)drm_plane_enable_fb_damage_clips(9)drm_plane_get_damage_clips_count(9)drm_plane_get_damage_clips(9)drm_plane_create_scaling_filter_property(9)drm_plane_add_size_hints_property(9)drm_plane_create_color_pipeline_property(9)
and that's the page ๐ this little masterpiece lives under ./drivers/gpu/drm, and the version stamp says October 2026 โ so mark your calendars, she's dated and she's slaying, periodt ๐ iykyk
๐ฆ 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