for_each_ol...rtc_in_state(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… for_each_ol...rtc_in_state(9) β€” like, the Kernel API Manual one, bestie ✨

Okay so picture this: you're deep in the kernel docs (the Kernel API Manual, to be exact) and you stumble on for_each_oldnew_crtc_in_state. It's a macro. It's iconic. It's giving "I loop so you don't have to." Let's get into it πŸŽ€


✨ NAME ✨

for_each_oldnew_crtc_in_state β€” the macro that iterates over all CRTCs in an atomic update πŸ¦‹


🌸 SYNOPSIS 🌸

for_each_oldnew_crtc_in_state (__state , crtc , old_crtc_state ,
new_crtc_state , __i );

πŸŽ€ ARGUMENTS πŸŽ€

  • __state β€” a struct drm_atomic_commit pointer. Yep, the whole commit, the main character πŸ‘‘
  • crtc β€” a struct drm_crtc iteration cursor. It's your little walking pointer through the loop πŸ’«
  • old_crtc_state β€” a struct drm_crtc_state iteration cursor, but for the old state. The before pics πŸ“Έ
  • new_crtc_state β€” a struct drm_crtc_state iteration cursor, but for the new state. The glow-up ✨
  • __i β€” an int iteration cursor, strictly for macro-internal use. Don't touch, don't look at it, it's doing its job πŸ™ˆ

πŸ’– DESCRIPTION πŸ’–

So this macro iterates over all the CRTCs in an atomic update, and β€” here's the slay β€” it tracks both the old state and the new state at the same time. Two cursors, one loop, zero drama πŸ’…

Where is that even useful? Anywhere the state delta actually matters, lowkey. Like, for example, in atomic check functions. That's the vibe. That's the whole point. Periodt 🫢


πŸ¦‹ SEE ALSO πŸ¦‹

The kernel file ./include/drm/drm_atomic.h and honestly a whole friend group of related stuff β€” no cap, here's every single one πŸ’œ


Bestie reminder: __i is macro-internal. Do not pass your own thing in there, do not get cute with it, just let the macro cook πŸ“

And that's the whole page, mwah πŸ’‹ signin' off from ./include/drm β€” that's the source, and the date on this baddie is October 2026, and it's all filed under for_each_ol...rtc_in_state(9). Slay, go read your kernel headers 🌈⭐

πŸ“¦ where this page comes from