drm_kunit_h...rimary_plane(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« drm_kunit_helper_create_primary_plane(9) πŸ’«

okay so bestie, welcome to the Kernel API Manual β€” this one is genuinely a little baddie for KUnit testing, and we're gonna get through it together, no cap 🫢


✨ NAME ✨

drm_kunit_helper_create_primary_plane β€” literally creates a mock primary plane for a KUnit test πŸ’…


🌸 SYNOPSIS 🌸

struct drm_plane * drm_kunit_helper_create_primary_plane (struct kunit
*test , struct drm_device *drm , const struct drm_plane_funcs *funcs ,
const struct drm_plane_helper_funcs *helper_funcs , const uint32_t
*formats , unsigned int num_formats , const uint64_t *modifiers );

she's long, she's gorgeous, she takes seven arguments and she ate, periodt ✨


πŸŽ€ ARGUMENTS πŸŽ€

  • test β€” the test context object, i.e. the main character of this whole situation πŸ‘‘
  • drm β€” the device you're allocating the plane for πŸ¦‹
  • funcs β€” callbacks for the new plane. Optional. no pressure bestie
  • helper_funcs β€” helper callbacks for the new plane. Optional. also no pressure 🌸
  • formats β€” array of supported formats (DRM_FORMAT_…). Optional. (yes the original really does cut off there, iykyk πŸ™ˆ)
  • num_formats β€” number of elements in formats, she's the count, she's precise πŸ’œ
  • modifiers β€” array of struct drm_format modifiers terminated by DRM_FORMAT_MOD_INVALID. Optional. ⭐

πŸ’– DESCRIPTION πŸ’–

so what she actually does: this allocates and initializes a mock struct drm_plane that's meant to be part of a mock device for a KUnit test. it's giving "build a little fake world so you can test in peace" energy, and honestly? iconic 🧚

Resources will be cleaned up automatically β€” so you can just vibe, no manual cleanup arc needed πŸ”₯

Now the defaults, and this is the part you don't wanna skip, bestie:

  • funcs will default to the default helpers implementations.
  • helper_funcs will default to an empty implementation.
  • formats will default to XRGB8888 only.
  • modifiers will default to a linear modifier only.

slay, sensible defaults, we love to see it πŸ’…


🌈 RETURN 🌈

A pointer to the new plane, or an ERR_PTR otherwise 😭 β€” so yeah, check that pointer, don't just assume she's fine.


πŸ”₯ SEE ALSO πŸ”₯

the Kernel file ./drivers/gpu/drm/tests/drm_kunit_helpers.c (that's the home base, go say hi 🏠), plus the whole friend group:


ngl bestie, this whole page lives in ./drivers/gpu/drm/tests, and the version note is dated October 2026 β€” so she's from the future, and she's thriving πŸ’€βœ¨

and that's the page!! you understood it, you're basically a DRM test wizard now, mwah πŸ«ΆπŸ’–πŸŽ€

πŸ“¦ where this page comes from