__drm_atomic..._plane_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ __drm_atomic..._plane_state(9) ✨

okay bestie, buckle up β€” this one is from the Kernel API Manual and it's genuinely so useful once you get the vibe πŸ’…


🌸 NAME 🌸

__drm_atomic_get_current_plane_state β€” get current plane state. that's the whole mission, no cap 🎯


πŸ¦‹ SYNOPSIS πŸ¦‹

const struct drm_plane_state * __drm_atomic_get_current_plane_state
(const struct drm_atomic_commit *state , struct drm_plane *plane );

like, yes, that's a const pointer-to-struct drm_plane_state returning from a function that takes two args. we love a signature that eats πŸ’–


πŸŽ€ ARGUMENTS πŸŽ€

  • state β€” the global atomic state object. the big picture, the whole group chat 🫢
  • plane β€” the plane you're trying to grab. the one you're pulling up on πŸ‘‘

⭐ DESCRIPTION ⭐

so here's the tea β˜• β€” this function returns the plane state for the given plane. and it's lowkey flexible about where it gets it from:

  • either the new plane state from state, or
  • if the plane isn't part of the atomic state update, straight from plane

it's giving "i'll find it wherever it lives" energy and honestly? iconic.

this is super useful in atomic check callbacks, when drivers need to peek at β€” but not change β€” the state of other planes. and the reason it's a whole moment is that it avoids threading an error code back up the call chain. no error plumbing, no drama, just vibes ✨

⚠️ WARNING: 🚨
bestie, listen to me. this function is in general unsafe, because it doesn't check for the required locking for access state structures. like fr fr, no lock check, none πŸ’€
drivers must ensure that it's safe to access the returned state structure through other means. one common example is when planes are fixed to a single CRTC, and the driver knows that the CRTC lock is held already. in that case, holding the CRTC lock gives you a read-lock on all planes connected to that CRTC. cute, clean, works 🧚
but β€” and this is the plot twist πŸ™ˆ β€” if planes can be reassigned, things get more tricky. in that case it's better to use drm_atomic_get_plane_state and wire up full error handling. do the extra work, your future self will thank you 🫢

and what do you actually get back? a read-only pointer to the current plane state. thats it, thats the prize 🌈


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file ./include/drm/drm_atomic.h β€” plus the whole friend group, in order, no one left out πŸ’œ


and that's the whole page, bestie β€” go peek at those plane states responsibly 🫢✨

source lives at ./include/drm, dated October 2026, and this lil page is still called __drm_atomic..._plane_state(9) β€” mwah, bye πŸ‘‘πŸ’…πŸ“

πŸ“¦ where this page comes from