STRUCT DRM_PRIVATE_STATE_FUNCS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct drm_private_state_funcs(9) πŸŽ€

okay bestie, welcome to the Kernel API Manual ✨ this one's all about struct drm_private_state_funcs β€” the atomic state functions for private objects. yes it's a whole vibe. let's get into it πŸ’…


🌸 NAME 🌸

struct drm_private_state_funcs β€” atomic state functions for private objects πŸ¦‹


✨ SYNOPSIS ✨

struct drm_private_state_funcs {
    struct drm_private_state *(*atomic_create_state)(struct drm_private_obj *obj);
    struct drm_private_state *(*atomic_duplicate_state)(struct drm_private_obj *obj);
    void (*atomic_destroy_state)(struct drm_private_obj *obj, struct drm_private_state *state);
    void (*atomic_print_state)(struct drm_printer *p, const struct drm_private_state *state);
 };

like, that's the whole struct. four function pointers. she's small but she's doing the MOST πŸ’–


πŸ‘‘ Members πŸ‘‘

🫢 atomic_create_state

Allocates a pristine, initialized state for the private object and hands it back to you. 🎁

⚠️ okay this part is literally the rule, do not break it: this callback must have no side effects. In particular, the returned state must not be assigned to the object's state pointer, and it must not affect the hardware state. no cap. like, it's window shopping only, no buying πŸ’€

RETURNS:

A new, pristine, private state instance, or an error pointer on failure. 😭

🌈 atomic_duplicate_state

Duplicate the current state of the private object and return it. πŸͺž

🚨 it is an error to call this before obj->state has been initialized. like, you gotta have a state before you can duplicate it, bestie, that's just logic πŸ™ˆ

RETURNS:

Duplicated atomic state, or NULL when obj->state is not initialized or allocation failed. πŸ’€

🧚 atomic_destroy_state

Frees the private object state created with atomic_duplicate_state. πŸ—‘οΈβœ¨ she cleans up after herself, icon behaviour.

πŸ“ atomic_print_state

If your driver subclasses struct drm_private_state, you should implement this optional hook for printing additional driver-specific state. πŸ–¨οΈπŸ’œ optional but recommended, iykyk.

⚠️ Do not call this directly β€” use drm_atomic_private_obj_print_state instead. fr fr, go through the proper channel.

πŸ’« Description πŸ’«

These hooks are used by atomic helpers to create, swap and destroy states of private objects. the way that atomic helpers just do all the heavy lifting for you πŸ”₯

The structure itself is used as a vtable to identify the associated private object type. πŸ‘‘

Each private object type that needs to be added to the atomic states is expected to have an implementation of these hooks and pass a pointer to its drm_private_state_funcs struct to drm_atomic_get_private_obj_state. 🫑 that's the assignment. periodt.


πŸ” SEE ALSO πŸ”

Kernel file ./include/drm/drm_atomic.h πŸ—‚οΈ and also, like, a whole friend group:

like, go read them. they're all gonna be there. slay πŸ¦‹πŸ’œ


and that's the page, bestie 🫢 this one came from ./include/drm, dated October 2026, and it's filed under the Kernel API Manual. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from