for_each_old...obj_in_state(9)
π for_each_old...obj_in_state(9) π
okay bestie, welcome to the Kernel API Manual β yes this is a real kernel macro page and yes it's lowkey iconic β¨
πΈ NAME πΈ
for_each_oldnew_private_obj_in_state β iterate over all private objects in an atomic update π«Ά
π¦ SYNOPSIS π¦
for_each_oldnew_private_obj_in_state (__state , obj , old_obj_state , new_obj_state , __i );
β¨ ARGUMENTS β¨
__stateβstruct drm_atomic_commitpointer. this is your main character, the atomic update itself π«objβstruct drm_private_objiteration cursor. it walks the loop for you, no capold_obj_stateβstruct drm_private_stateiteration cursor for the old state πnew_obj_stateβstruct drm_private_stateiteration cursor for the new state π__iβintiteration cursor, strictly for macro-internal use. bestie do NOT touch this one, it's giving backstage pass only π
π DESCRIPTION π
so the way that this works is it iterates over all private objects in an atomic update, and it tracks both the old state AND the new state at the same time. like a glow-up in real time, obsessed π
that makes it super useful in places where you actually need to look at the state delta β i.e. what changed between old and new β for example in atomic check functions. it's giving "spot the difference" but make it kernel π₯
π§ SEE ALSO π§
the whole friend group, fr fr:
- Kernel file
./include/drm/drm_atomic.h(this is home base π‘)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)__drm_atomic_get_current_plane_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_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)
ok that's a lot of siblings but every single one of them is mandatory reading, i don't make the rules π
π SIGN-OFF π
this little gem lives in ./include/drm and the page is dated October 2026 β and the title at the tippy top is still for_each_old...obj_in_state(9), no cap. stay hydrated, read your state deltas, and slay ππ
π¦ 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