__drm_atomic..._plane_state(9)
β¨ __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 π
struct drm_crtc_commit(9)struct drm_private_state_funcs(9)struct drm_private_obj(9)drm_for_each_privobj(9)struct drm_private_state(9)struct drm_atomic_commit(9)drm_crtc_commit_get(9)drm_crtc_commit_put(9)drm_atomic_commit_get(9)drm_atomic_commit_put(9)drm_atomic_get_old_crtc_state(9)drm_atomic_get_new_crtc_state(9)drm_atomic_get_old_plane_state(9)drm_atomic_get_new_plane_state(9)drm_atomic_get_old_connector_state(9)drm_atomic_get_new_connector_state(9)for_each_oldnew_connector_in_state(9)for_each_old_connector_in_state(9)for_each_new_connector_in_state(9)for_each_oldnew_crtc_in_state(9)for_each_old_crtc_in_state(9)for_each_new_crtc_in_state(9)for_each_oldnew_colorop_in_state(9)for_each_new_colorop_in_state(9)for_each_oldnew_plane_in_state(9)for_each_oldnew_plane_in_state_reverse(9)for_each_new_plane_in_state_reverse(9)for_each_old_plane_in_state(9)for_each_new_plane_in_state(9)for_each_oldnew_private_obj_in_state(9)for_each_old_private_obj_in_state(9)for_each_new_private_obj_in_state(9)drm_atomic_crtc_needs_modeset(9)drm_atomic_crtc_effectively_active(9)struct drm_bus_cfg(9)struct drm_bridge_state(9)
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
- 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