@@ -4909,6 +4909,7 @@ static double get_urgent_bandwidth_required(
49094909 double ReadBandwidthChroma[],
49104910 double PrefetchBandwidthLuma[],
49114911 double PrefetchBandwidthChroma[],
4912+ double PrefetchBandwidthOto[],
49124913 double excess_vactive_fill_bw_l[],
49134914 double excess_vactive_fill_bw_c[],
49144915 double cursor_bw[],
@@ -4972,8 +4973,9 @@ static double get_urgent_bandwidth_required(
49724973 l->vm_row_bw = NumberOfDPP[k] * prefetch_vmrow_bw[k];
49734974 l->flip_and_active_bw = l->per_plane_flip_bw[k] + ReadBandwidthLuma[k] * l->adj_factor_p0 + ReadBandwidthChroma[k] * l->adj_factor_p1 + cursor_bw[k] * l->adj_factor_cur;
49744975 l->flip_and_prefetch_bw = l->per_plane_flip_bw[k] + NumberOfDPP[k] * (PrefetchBandwidthLuma[k] * l->adj_factor_p0_pre + PrefetchBandwidthChroma[k] * l->adj_factor_p1_pre) + prefetch_cursor_bw[k] * l->adj_factor_cur_pre;
4976+ l->flip_and_prefetch_bw_oto = l->per_plane_flip_bw[k] + NumberOfDPP[k] * (PrefetchBandwidthOto[k] * l->adj_factor_p0_pre + PrefetchBandwidthChroma[k] * l->adj_factor_p1_pre) + prefetch_cursor_bw[k] * l->adj_factor_cur_pre;
49754977 l->active_and_excess_bw = (ReadBandwidthLuma[k] + excess_vactive_fill_bw_l[k]) * l->tmp_nom_adj_factor_p0 + (ReadBandwidthChroma[k] + excess_vactive_fill_bw_c[k]) * l->tmp_nom_adj_factor_p1 + dpte_row_bw[k] + meta_row_bw[k];
4976- surface_required_bw[k] = math_max4 (l->vm_row_bw, l->flip_and_active_bw, l->flip_and_prefetch_bw, l->active_and_excess_bw);
4978+ surface_required_bw[k] = math_max5 (l->vm_row_bw, l->flip_and_active_bw, l->flip_and_prefetch_bw, l->active_and_excess_bw, l->flip_and_prefetch_bw_oto );
49774979
49784980 /* export peak required bandwidth for the surface */
49794981 surface_peak_required_bw[k] = math_max2(surface_required_bw[k], surface_peak_required_bw[k]);
@@ -5171,6 +5173,7 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
51715173 s->Tsw_est3 = 0.0;
51725174 s->cursor_prefetch_bytes = 0;
51735175 *p->prefetch_cursor_bw = 0;
5176+ *p->RequiredPrefetchBWOTO = 0.0;
51745177
51755178 dcc_mrq_enable = (p->dcc_enable && p->mrq_present);
51765179
@@ -5384,6 +5387,9 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
53845387 s->prefetch_bw_oto += (p->swath_width_chroma_ub * p->myPipe->BytePerPixelC) / s->LineTime;
53855388 }
53865389
5390+ /* oto prefetch bw should be always be less than total vactive bw */
5391+ DML2_ASSERT(s->prefetch_bw_oto < s->per_pipe_vactive_sw_bw * p->myPipe->DPPPerSurface);
5392+
53875393 s->prefetch_bw_oto = math_max2(s->per_pipe_vactive_sw_bw, s->prefetch_bw_oto) * p->mall_prefetch_sdp_overhead_factor;
53885394
53895395 s->prefetch_bw_oto = math_min2(s->prefetch_bw_oto, *p->prefetch_sw_bytes/(s->min_Lsw_oto*s->LineTime));
@@ -5394,6 +5400,12 @@ static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch
53945400 p->vm_bytes * p->HostVMInefficiencyFactor / (31 * s->LineTime) - *p->Tno_bw,
53955401 (p->PixelPTEBytesPerRow * p->HostVMInefficiencyFactor + p->meta_row_bytes + tdlut_row_bytes) / (15 * s->LineTime));
53965402
5403+ /* oto bw needs to be outputted even if the oto schedule isn't being used to avoid ms/mp mismatch.
5404+ * mp will fail if ms decides to use equ schedule and mp decides to use oto schedule
5405+ * and the required bandwidth increases when going from ms to mp
5406+ */
5407+ *p->RequiredPrefetchBWOTO = s->prefetch_bw_oto;
5408+
53975409#ifdef __DML_VBA_DEBUG__
53985410 dml2_printf("DML::%s: vactive_sw_bw_l = %f\n", __func__, p->vactive_sw_bw_l);
53995411 dml2_printf("DML::%s: vactive_sw_bw_c = %f\n", __func__, p->vactive_sw_bw_c);
@@ -6154,6 +6166,7 @@ static void calculate_peak_bandwidth_required(
61546166 p->surface_read_bandwidth_c,
61556167 l->zero_array, //PrefetchBandwidthLuma,
61566168 l->zero_array, //PrefetchBandwidthChroma,
6169+ l->zero_array, //PrefetchBWOTO
61576170 l->zero_array,
61586171 l->zero_array,
61596172 l->zero_array,
@@ -6190,6 +6203,7 @@ static void calculate_peak_bandwidth_required(
61906203 p->surface_read_bandwidth_c,
61916204 l->zero_array, //PrefetchBandwidthLuma,
61926205 l->zero_array, //PrefetchBandwidthChroma,
6206+ l->zero_array, //PrefetchBWOTO
61936207 p->excess_vactive_fill_bw_l,
61946208 p->excess_vactive_fill_bw_c,
61956209 p->cursor_bw,
@@ -6226,6 +6240,7 @@ static void calculate_peak_bandwidth_required(
62266240 p->surface_read_bandwidth_c,
62276241 p->prefetch_bandwidth_l,
62286242 p->prefetch_bandwidth_c,
6243+ p->prefetch_bandwidth_oto, // to prevent ms/mp mismatch when oto bw > total vactive bw
62296244 p->excess_vactive_fill_bw_l,
62306245 p->excess_vactive_fill_bw_c,
62316246 p->cursor_bw,
@@ -6262,6 +6277,7 @@ static void calculate_peak_bandwidth_required(
62626277 p->surface_read_bandwidth_c,
62636278 p->prefetch_bandwidth_l,
62646279 p->prefetch_bandwidth_c,
6280+ p->prefetch_bandwidth_oto, // to prevent ms/mp mismatch when oto bw > total vactive bw
62656281 p->excess_vactive_fill_bw_l,
62666282 p->excess_vactive_fill_bw_c,
62676283 p->cursor_bw,
@@ -6298,6 +6314,7 @@ static void calculate_peak_bandwidth_required(
62986314 p->surface_read_bandwidth_c,
62996315 p->prefetch_bandwidth_l,
63006316 p->prefetch_bandwidth_c,
6317+ p->prefetch_bandwidth_oto, // to prevent ms/mp mismatch when oto bw > total vactive bw
63016318 p->excess_vactive_fill_bw_l,
63026319 p->excess_vactive_fill_bw_c,
63036320 p->cursor_bw,
@@ -9060,6 +9077,7 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
90609077 CalculatePrefetchSchedule_params->VRatioPrefetchC = &mode_lib->ms.VRatioPreC[k];
90619078 CalculatePrefetchSchedule_params->RequiredPrefetchPixelDataBWLuma = &mode_lib->ms.RequiredPrefetchPixelDataBWLuma[k]; // prefetch_sw_bw_l
90629079 CalculatePrefetchSchedule_params->RequiredPrefetchPixelDataBWChroma = &mode_lib->ms.RequiredPrefetchPixelDataBWChroma[k]; // prefetch_sw_bw_c
9080+ CalculatePrefetchSchedule_params->RequiredPrefetchBWOTO = &mode_lib->ms.RequiredPrefetchBWOTO[k];
90639081 CalculatePrefetchSchedule_params->NotEnoughTimeForDynamicMetadata = &mode_lib->ms.NoTimeForDynamicMetadata[k];
90649082 CalculatePrefetchSchedule_params->Tno_bw = &mode_lib->ms.Tno_bw[k];
90659083 CalculatePrefetchSchedule_params->Tno_bw_flip = &mode_lib->ms.Tno_bw_flip[k];
@@ -9204,6 +9222,7 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
92049222 calculate_peak_bandwidth_params->surface_read_bandwidth_c = mode_lib->ms.vactive_sw_bw_c;
92059223 calculate_peak_bandwidth_params->prefetch_bandwidth_l = mode_lib->ms.RequiredPrefetchPixelDataBWLuma;
92069224 calculate_peak_bandwidth_params->prefetch_bandwidth_c = mode_lib->ms.RequiredPrefetchPixelDataBWChroma;
9225+ calculate_peak_bandwidth_params->prefetch_bandwidth_oto = mode_lib->ms.RequiredPrefetchBWOTO;
92079226 calculate_peak_bandwidth_params->excess_vactive_fill_bw_l = mode_lib->ms.excess_vactive_fill_bw_l;
92089227 calculate_peak_bandwidth_params->excess_vactive_fill_bw_c = mode_lib->ms.excess_vactive_fill_bw_c;
92099228 calculate_peak_bandwidth_params->cursor_bw = mode_lib->ms.cursor_bw;
@@ -9370,6 +9389,7 @@ static bool dml_core_mode_support(struct dml2_core_calcs_mode_support_ex *in_out
93709389 calculate_peak_bandwidth_params->surface_read_bandwidth_c = mode_lib->ms.vactive_sw_bw_c;
93719390 calculate_peak_bandwidth_params->prefetch_bandwidth_l = mode_lib->ms.RequiredPrefetchPixelDataBWLuma;
93729391 calculate_peak_bandwidth_params->prefetch_bandwidth_c = mode_lib->ms.RequiredPrefetchPixelDataBWChroma;
9392+ calculate_peak_bandwidth_params->prefetch_bandwidth_oto = mode_lib->ms.RequiredPrefetchBWOTO;
93739393 calculate_peak_bandwidth_params->excess_vactive_fill_bw_l = mode_lib->ms.excess_vactive_fill_bw_l;
93749394 calculate_peak_bandwidth_params->excess_vactive_fill_bw_c = mode_lib->ms.excess_vactive_fill_bw_c;
93759395 calculate_peak_bandwidth_params->cursor_bw = mode_lib->ms.cursor_bw;
@@ -11286,6 +11306,7 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
1128611306 CalculatePrefetchSchedule_params->VRatioPrefetchC = &mode_lib->mp.VRatioPrefetchC[k];
1128711307 CalculatePrefetchSchedule_params->RequiredPrefetchPixelDataBWLuma = &mode_lib->mp.RequiredPrefetchPixelDataBWLuma[k];
1128811308 CalculatePrefetchSchedule_params->RequiredPrefetchPixelDataBWChroma = &mode_lib->mp.RequiredPrefetchPixelDataBWChroma[k];
11309+ CalculatePrefetchSchedule_params->RequiredPrefetchBWOTO = &s->dummy_single_array[0][k];
1128911310 CalculatePrefetchSchedule_params->NotEnoughTimeForDynamicMetadata = &mode_lib->mp.NotEnoughTimeForDynamicMetadata[k];
1129011311 CalculatePrefetchSchedule_params->Tno_bw = &mode_lib->mp.Tno_bw[k];
1129111312 CalculatePrefetchSchedule_params->Tno_bw_flip = &mode_lib->mp.Tno_bw_flip[k];
@@ -11428,6 +11449,7 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
1142811449 calculate_peak_bandwidth_params->surface_read_bandwidth_c = mode_lib->mp.vactive_sw_bw_c;
1142911450 calculate_peak_bandwidth_params->prefetch_bandwidth_l = mode_lib->mp.RequiredPrefetchPixelDataBWLuma;
1143011451 calculate_peak_bandwidth_params->prefetch_bandwidth_c = mode_lib->mp.RequiredPrefetchPixelDataBWChroma;
11452+ calculate_peak_bandwidth_params->prefetch_bandwidth_oto = s->dummy_single_array[0];
1143111453 calculate_peak_bandwidth_params->excess_vactive_fill_bw_l = mode_lib->mp.excess_vactive_fill_bw_l;
1143211454 calculate_peak_bandwidth_params->excess_vactive_fill_bw_c = mode_lib->mp.excess_vactive_fill_bw_c;
1143311455 calculate_peak_bandwidth_params->cursor_bw = mode_lib->mp.cursor_bw;
@@ -11560,6 +11582,7 @@ static bool dml_core_mode_programming(struct dml2_core_calcs_mode_programming_ex
1156011582 calculate_peak_bandwidth_params->surface_read_bandwidth_c = mode_lib->mp.vactive_sw_bw_c;
1156111583 calculate_peak_bandwidth_params->prefetch_bandwidth_l = mode_lib->mp.RequiredPrefetchPixelDataBWLuma;
1156211584 calculate_peak_bandwidth_params->prefetch_bandwidth_c = mode_lib->mp.RequiredPrefetchPixelDataBWChroma;
11585+ calculate_peak_bandwidth_params->prefetch_bandwidth_oto = s->dummy_single_array[k];
1156311586 calculate_peak_bandwidth_params->excess_vactive_fill_bw_l = mode_lib->mp.excess_vactive_fill_bw_l;
1156411587 calculate_peak_bandwidth_params->excess_vactive_fill_bw_c = mode_lib->mp.excess_vactive_fill_bw_c;
1156511588 calculate_peak_bandwidth_params->cursor_bw = mode_lib->mp.cursor_bw;
0 commit comments