drm_kunit_h...rimary_plane(9)
π« 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 bestiehelper_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 informats, she's the count, she's precise πmodifiersβ array of structdrm_formatmodifiers terminated byDRM_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:
funcswill default to the default helpers implementations.helper_funcswill default to an empty implementation.formatswill default toXRGB8888only.modifierswill 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:
drm_kunit_helper_alloc_device(9)drm_kunit_helper_free_device(9)drm_kunit_helper_atomic_state_alloc(9)drm_kunit_helper_create_crtc(9)drm_kunit_helper_enable_crtc_connector(9)drm_kunit_add_mode_destroy_action(9)drm_kunit_display_mode_from_cea_vic(9)
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
- 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