for_each_old...rop_in_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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 β€” a struct drm_atomic_commit pointer. the atomic commit we're poking around inside, main character of the whole operation fr. 🌟
  • colorop β€” a struct drm_colorop iteration cursor. it's literally just the thing that walks the list, one colorop at a time. πŸšΆβ€β™€οΈ
  • old_colorop_state β€” a struct drm_colorop_state iteration cursor for the old state. yes, the before picture. πŸ•°οΈ
  • new_colorop_state β€” a struct drm_colorop_state iteration cursor for the new state. the glow-up picture. ✨
  • __i β€” an int iteration 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:

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