for_each_old...tate_reverse(9)
π for_each_oldnew_plane_in_state_reverse β the manual, but make it make sense
okay bestie so you found for_each_oldnew_plane_in_state_reverse(9) in the Kernel API Manual and you're like "girl what is this whole entire name" β don't worry, i got you. this is a macro. it loops. it goes backwards. and it keeps receipts on both the old state AND the new state. let's get into it π
β¨ NAME β¨
for_each_oldnew_plane_in_state_reverse β literally just iterate over all planes in an atomic update, but in reverse order. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
for_each_oldnew_plane_in_state_reverse (__state , plane ,
old_plane_state , new_plane_state , __i );
π«Ά ARGUMENTS π«Ά
she takes five (5) arguments, each one more of a mouthful than the last:
__stateβ astruct drm_atomic_commitpointer. the main character of this whole operation tbh πplaneβ astruct drm_planeiteration cursor. this is the one that actually walks the loop πold_plane_stateβ astruct drm_plane_stateiteration cursor, but for the old state. it's giving nostalgia πnew_plane_stateβ astruct drm_plane_stateiteration cursor, but for the new state. glow-up arc β¨__iβ anintiteration cursor, and it's for macro-internal use only. do NOT touch. pretend you didn't even see it π
π DESCRIPTION π
okay so here's the tea β β this macro iterates over all planes in an atomic update, and it does it in reverse order. but the slay part? it tracks both the old state and the new state the entire time. both. at once. multitasking queen π§
and like, why do you care? because it's genuinely useful in places where the state delta needs to be considered β for example in atomic check functions. if you need to know what changed between before and after, this loop is literally your bestie. periodt. π₯
π SEE ALSO π
a whole friend group, honestly. the kernel file lives at ./include/drm/drm_atomic.h, and here's everybody it hangs out with:
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_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).
like i said. big friend group. iykyk π
and that's the whole page, bestie β mwah π
cute little sign-off: this one's brought to you from the kernel file ./include/drm, dated October 2026, and yes the header still says for_each_old...tate_reverse(9) because that name is honestly iconically long and we respect it. πβ
π¦ 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