for_each_ne...obj_in_state(9)
π
for_each_ne...obj_in_state(9) β Kernel API Manual
okay so bestie, welcome to the Kernel API Manual page for for_each_ne...obj_in_state(9) β yes the name is truncated with the little dots, that's just how the header do π β and it's genuinely one of those macro-girlies that eats. let's get into it π₯
β¨ NAME β¨
for_each_new_private_obj_in_state β iterate over all private objects in an atomic update π¦
no cap, that's the whole vibe: loop over private objects, new state only.
π SYNOPSIS π
for_each_new_private_obj_in_state (__state , obj , new_obj_state , __i );
four args, all of them, copy them exactly, iykyk π
πΈ ARGUMENTS πΈ
__stateβ astruct drm_atomic_commitpointer. the whole commit situation, main character energy πobjβ astruct drm_private_objiteration cursor. it's the thing you're walkin' through, one private object at a time β¨new_obj_stateβ astruct drm_private_stateiteration cursor for the new state. literally the fresh state, the one we actually care about π__iβ anintiteration cursor, for macro-internal use. do not touch her, she's busy doing bookkeeping π«Ά
π₯ DESCRIPTION π₯
so this macro iterates over all private objects in an atomic update, but check it β it tracks only the new state π
it's giving extremely useful in enable functions, where we need the new state the hardware should be in when the atomic commit operation has completed. like, the after-picture π the state the hardware is gonna be living in post-commit, periodt.
ngl, if you're reaching for this, you're probably writing an enable function and you already know what you want. slay. the macro just hands you the new private state per object and gets out of your way π
π¦ SEE ALSO π¦
the kernel file is ./include/drm/drm_atomic.h β go read the source, it's iconic π§
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_oldnew_private_obj_in_state(9)for_each_old_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)
like, that's the whole friend group fr fr β every one of them is in there, no skips π«Ά
and that's the page!! mwah π this lil' beauty lives in ./include/drm, dated October 2026, and it's for_each_ne...obj_in_state(9) til the end. go forth and iterate, bestie β you're gonna slay those private objects πβ¨π
π¦ 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