calculate_sw...idx_from_dst(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ calculate_swath_idx_from_dst β€” a Kernel API Manual moment (section 9, bestie) πŸŽ€

okay so welcome to the Kernel API Manual, section 9, and lemme just say the title got chopped in the header like calculate_sw...idx_from_dst(9) but we know her full name and we're gonna use it. it's giving long function signature energy and honestly? we ate.


✨ NAME ✨

calculate_swath_idx_from_dst β€” a helper function that returns a swath index based on a dst line πŸ¦‹

lowkey it's a helper function. it's not the main character, it's the bestie holding the main character's bag, and honestly that's iconic.


🌸 SYNOPSIS 🌸

uint32_t calculate_swath_idx_from_dst (uint32_t curr_otg_line , uint32_t
curr_frame_count , uint32_t target_frame_count , uint16_t vstartup ,
uint32_t dst_line , uint16_t pre_swath_incl_boundary , uint32_t
rec_swath_incl_boundary , uint16_t prefetch_swaths , uint16_t
total_swaths , uint32_t pre_first_hdl_dst_x1000 , uint16_t
pre_last_hdl_dst , uint32_t earliest_rec_req , uint32_t
rec_first_hdl_dst_x1000 , uint16_t rec_last_hdl_dst , uint16_t
pre_hdl_delta_x1000 , uint16_t rec_hdl_delta_x1000 , bool round_up ,
bool start );

like yes that's eighteen (18) parameters. eighteen. i counted. she's thorough and we respect it πŸ’…


🫢 ARGUMENTS 🫢

so here's the thing β€” the original page is out here giving us -- undescribed -- for literally every single one of these. no cap. zero description. the documentation said "figure it out bestie" 😭

so i'm gonna list them all, exactly as they appear, and i'm not gonna invent lore for them because i'm not a liar:

  • curr_otg_line β€” -- undescribed --
  • curr_frame_count β€” -- undescribed --
  • target_frame_count β€” -- undescribed --
  • vstartup β€” -- undescribed --
  • dst_line β€” -- undescribed --
  • pre_swath_incl_boundary β€” -- undescribed --
  • rec_swath_incl_boundary β€” -- undescribed --
  • prefetch_swaths β€” -- undescribed --
  • total_swaths β€” -- undescribed --
  • pre_first_hdl_dst_x1000 β€” -- undescribed --
  • pre_last_hdl_dst β€” -- undescribed --
  • earliest_rec_req β€” -- undescribed --
  • rec_first_hdl_dst_x1000 β€” -- undescribed --
  • rec_last_hdl_dst β€” -- undescribed --
  • pre_hdl_delta_x1000 β€” -- undescribed --
  • rec_hdl_delta_x1000 β€” -- undescribed --
  • round_up β€” -- undescribed --
  • start β€” -- undescribed --
ngl the -- undescribed -- tag on every single one is a vibe check the docs failed πŸ™ˆ but we're keeping all eighteen names exactly as-is because the one rule is keep every detail and bestie i keep every detail. periodt.

πŸ”₯ DESCRIPTION πŸ”₯

okay so here's what she actually does, straight up:

this function takes in a dst line, and calculates the next or previous swath deadline based on the input dst line. like, you hand her a dst line, she hands you a deadline. mutual exchange. slay.

and the swath index she returns? it's also marked with "current" or "next" β€” and that marking lives in bit 31. bit 31. the top bit. main character bit energy πŸ‘‘

so yeah, the returned index isn't just a number, it's a number with an opinion about whether you're looking at current or next. iconic behaviour, honestly.


⭐ RETURN ⭐

the swath index associated with the input dst line πŸ’–

and then the original page just drops this little divider situation:

***********************************************************************************************************

which i'm keeping verbatim because it's literally part of the page and it's kind of a serve 🌈


🧚 SEE ALSO 🧚

first up, the kernel file where this whole situation lives:

./drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_standalone_libraries/alternate_pstate_shared_lib.c

and then the whole friend group, all of them, no one left behind:


πŸ’€ also the original prose here ends with a big *********** line of stars again β€” that's just how the page rolls, we don't question it, we accept her.

πŸ“ a lil sign-off πŸ“

this page came to you from the source path ./drivers/gpu/drm/amd/display/... and it's dated October 2026 (yes, the future, she's early, she's a trendsetter ✨), and it's filed as calculate_sw...idx_from_dst(9) in the Kernel API Manual.

go read the actual C file if you want the real tea on those eighteen params, because this manpage is out here with zero descriptions and a dream. ily, bye πŸ«ΆπŸ’œ

πŸ“¦ where this page comes from