for_each_old...rop_in_state(9)
okay bestie, welcome to theKernel API Manual β and the page we're reading today is none other than for_each_old...rop_in_state(9), which (spoiler) is the whole entire for_each_oldnew_colorop_in_state situation. it's giving "macro that knows both your past and your future" and honestly? iconic. π«
β¨ NAME β¨
for_each_oldnew_colorop_in_state β iterate over all colorops in an atomic update π¨
like, all of them. every single one. we're not skipping anybody. π
π¦ SYNOPSIS π¦
for_each_oldnew_colorop_in_state (__state , colorop , old_colorop_state
, new_colorop_state , __i );
yes queen, five arguments, that's the whole lineup, no cap. π«Ά
π ARGUMENTS π
__stateβ astruct drm_atomic_commitpointer. the atomic commit we're poking around inside, main character of the whole operation fr. πcoloropβ astruct drm_coloropiteration cursor. it's literally just the thing that walks the list, one colorop at a time. πΆββοΈold_colorop_stateβ astruct drm_colorop_stateiteration cursor for the old state. yes, the before picture. π°οΈnew_colorop_stateβ astruct drm_colorop_stateiteration cursor for the new state. the glow-up picture. β¨__iβ anintiteration cursor, for macro-internal use. bestie do NOT touch this one, it's private, it's the macro's own little business. π
πΈ DESCRIPTION πΈ
okay so here's the tea β: this macro iterates over all the colorops in an atomic update, and the whole point is it tracks both the old state and the new state at the same time. two cursors, one loop, absolutely slaying. π
and like, why do you care? because sometimes you genuinely need to consider the state delta β the difference between what it was and what it's becoming. for example, in atomic check functions. that's the vibe. that's when you reach for this one. π₯
π SEE ALSO π
kernel file ./include/drm/drm_atomic.h β go read it, it's right there. π
and then the whole friend group, all of them, no one left behind:
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_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)
like genuinely go click through them, they're all connected, it's a whole ecosystem. π
k bye bestie!! π«Ά this page lives in ./include/drm, and it's dated October 2026, so yes it's fresh, yes it's current, and no I will not be explaining why the header truncates the name like that. mwah πβ¨
π¦ 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