calculate_sw...idx_from_dst(9)
π 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:
in_circular_range(9)apply_svp1_workaround(9)calculate_start_line_and_height_from_swath(9)get_swath_deadlines(9)calculate_swath_deadline_dst(9)is_dst_in_next_frame(9)is_end_swath_in_next_frame(9)is_svp_dst_in_next_frame(9)populate_svp_params(9)populate_start_index_num_swaths_helper(9)calculate_start_index_num_swaths(9)calculate_hubp_start_end_lines(9)get_prefetch_end_line(9)get_effective_vblank_start(9)
π 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
- 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