calculate_copy_swaths(9)
β¨ calculate_copy_swaths(9) β¨
okay so this is from the Kernel API Manual, and it's literally about calculate_copy_swaths β the function that figures out a tight upper bound for how many swaths you need to copy. yes bestie, we're in the DCN math mines today π
πΈ NAME πΈ
calculate_copy_swaths β Calculates a tight upper bound for the swaths required for copy given swath params and svp0 + svp1 dst lines
like, that's the whole vibe. upper bound. tight. swaths. svp0. svp1. dst lines. periodt π
β SYNOPSIS β
unsigned int calculate_copy_swaths (double pre_first_hdl , double
rec_first_hdl , double pre_hdl_delta , double rec_hdl_delta , unsigned
int prefetch_swaths , unsigned int total_swaths , unsigned int
svp0_dst_lines , unsigned int svp1_dst_lines , unsigned int vtotal );
that's a lot of args, i know π nine of them. count 'em. we'll get through it together, i promise π«Ά
π¦ ARGUMENTS π¦
ngl, the source doc for these is genuinely just -- undescribed -- for every single one, so i'm not gonna sit here and make stuff up (that would be a crime fr fr π). here's the full list, exactly as it appears:
pre_first_hdlβ -- undescribed --rec_first_hdlβ -- undescribed --pre_hdl_deltaβ -- undescribed --rec_hdl_deltaβ -- undescribed --prefetch_swathsβ -- undescribed --total_swathsβ -- undescribed --svp0_dst_linesβ -- undescribed --svp1_dst_linesβ -- undescribed --vtotalβ -- undescribed --
nine params, nine shrugs π the names are doing all the heavy lifting here, iykyk.
π DESCRIPTION π
Given the first hdl position of pre and rec swaths, and the delta in dst lines between the hdls, this function calculates the number of swaths to be copied in the worst case given svp0 and svp1 dst lines.
read that again if you need to. worst case. swaths. copied. we love a bounded problem π§
The upper bound is "tight" because this function assumes svp0 and svp1 cannot both overlap with prefetch (prefetch potentially has the most amount of swaths per dst line).
so the tightness comes from one specific assumption: svp0 and svp1 can't both overlap with prefetch at the same time. and the reason that matters is that prefetch potentially has the most amount of swaths per dst line. that's the whole trick, bestie β no cap π₯
π SEE ALSO π
the kernel file itself lives right here, character for character:
./drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn6_calcs_dchub.c
and the friends in the group chat π«Ά:
get_plane_params(9)compute_pre_rec_first_hdl(9)calculate_alt_copy_time_us(9)calculate_ub_copy_size_per_plane_per_dpp_per_svp(9)calculate_swath_params(9)
and that's the page!! π written up as part of the Kernel API Manual, source path ./drivers/gpu/drm/amd/display/... (yes it's truncated like that in the original, don't come for me π), dated October 2026, and every last bit of it is signed calculate_copy_swaths(9). slay, go read your hdls π
β¨
π¦ 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