1/*
2 * Copyright 2022 Advanced Micro Devices, Inc. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: AMD
23 *
24 */
25
26#include "dc.h"
27#include "../display_mode_lib.h"
28#include "display_mode_vba_32.h"
29#include "../dml_inline_defs.h"
30#include "display_mode_vba_util_32.h"
31
32void dml32_recalculate(struct display_mode_lib *mode_lib);
33static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
34 struct display_mode_lib *mode_lib);
35void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib);
36
37void dml32_recalculate(struct display_mode_lib *mode_lib)
38{
39 ModeSupportAndSystemConfiguration(mode_lib);
40
41 dml32_CalculateMaxDETAndMinCompressedBufferSize(ConfigReturnBufferSizeInKByte: mode_lib->vba.ConfigReturnBufferSizeInKByte,
42 ROBBufferSizeInKByte: mode_lib->vba.ROBBufferSizeInKByte,
43 DC__NUM_DPP,
44 nomDETInKByteOverrideEnable: false, //mode_lib->vba.override_setting.nomDETInKByteOverrideEnable,
45 nomDETInKByteOverrideValue: 0, //mode_lib->vba.override_setting.nomDETInKByteOverrideValue,
46
47 /* Output */
48 MaxTotalDETInKByte: &mode_lib->vba.MaxTotalDETInKByte, nomDETInKByte: &mode_lib->vba.nomDETInKByte,
49 MinCompressedBufferSizeInKByte: &mode_lib->vba.MinCompressedBufferSizeInKByte);
50
51 PixelClockAdjustmentForProgressiveToInterlaceUnit(mode_lib);
52#ifdef __DML_VBA_DEBUG__
53 dml_print("DML::%s: Calling DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation\n", __func__);
54#endif
55 DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(mode_lib);
56}
57
58static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
59 struct display_mode_lib *mode_lib)
60{
61 struct vba_vars_st *v = &mode_lib->vba;
62 unsigned int j, k;
63 bool ImmediateFlipRequirementFinal;
64 int iteration;
65 double MaxTotalRDBandwidth;
66 unsigned int NextPrefetchMode;
67 double MaxTotalRDBandwidthNoUrgentBurst = 0.0;
68 bool DestinationLineTimesForPrefetchLessThan2 = false;
69 bool VRatioPrefetchMoreThanMax = false;
70 double TWait;
71 double TotalWRBandwidth = 0;
72 double WRBandwidth = 0;
73
74#ifdef __DML_VBA_DEBUG__
75 dml_print("DML::%s: --- START ---\n", __func__);
76 dml_print("DML::%s: mode_lib->vba.PrefetchMode = %d\n", __func__, mode_lib->vba.PrefetchMode);
77 dml_print("DML::%s: mode_lib->vba.ImmediateFlipSupport = %d\n", __func__, mode_lib->vba.ImmediateFlipSupport);
78 dml_print("DML::%s: mode_lib->vba.VoltageLevel = %d\n", __func__, mode_lib->vba.VoltageLevel);
79#endif
80
81 v->WritebackDISPCLK = 0.0;
82 v->GlobalDPPCLK = 0.0;
83
84 // DISPCLK and DPPCLK Calculation
85 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
86 if (mode_lib->vba.WritebackEnable[k]) {
87 v->WritebackDISPCLK = dml_max(a: v->WritebackDISPCLK,
88 b: dml32_CalculateWriteBackDISPCLK(
89 WritebackPixelFormat: mode_lib->vba.WritebackPixelFormat[k],
90 PixelClock: mode_lib->vba.PixelClock[k], WritebackHRatio: mode_lib->vba.WritebackHRatio[k],
91 WritebackVRatio: mode_lib->vba.WritebackVRatio[k],
92 WritebackHTaps: mode_lib->vba.WritebackHTaps[k],
93 WritebackVTaps: mode_lib->vba.WritebackVTaps[k],
94 WritebackSourceWidth: mode_lib->vba.WritebackSourceWidth[k],
95 WritebackDestinationWidth: mode_lib->vba.WritebackDestinationWidth[k],
96 HTotal: mode_lib->vba.HTotal[k], WritebackLineBufferSize: mode_lib->vba.WritebackLineBufferSize,
97 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed));
98 }
99 }
100
101 v->DISPCLK_calculated = v->WritebackDISPCLK;
102
103 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
104 if (mode_lib->vba.BlendingAndTiming[k] == k) {
105 v->DISPCLK_calculated = dml_max(a: v->DISPCLK_calculated,
106 b: dml32_CalculateRequiredDispclk(
107 ODMMode: mode_lib->vba.ODMCombineEnabled[k],
108 PixelClock: mode_lib->vba.PixelClock[k],
109 DISPCLKDPPCLKDSCCLKDownSpreading: mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading,
110 DISPCLKRampingMargin: mode_lib->vba.DISPCLKRampingMargin,
111 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed,
112 MaxDispclk: mode_lib->vba.MaxDppclk[v->soc.num_states - 1]));
113 }
114 }
115
116 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
117 dml32_CalculateSinglePipeDPPCLKAndSCLThroughput(HRatio: mode_lib->vba.HRatio[k],
118 HRatioChroma: mode_lib->vba.HRatioChroma[k],
119 VRatio: mode_lib->vba.VRatio[k],
120 VRatioChroma: mode_lib->vba.VRatioChroma[k],
121 MaxDCHUBToPSCLThroughput: mode_lib->vba.MaxDCHUBToPSCLThroughput,
122 MaxPSCLToLBThroughput: mode_lib->vba.MaxPSCLToLBThroughput,
123 PixelClock: mode_lib->vba.PixelClock[k],
124 SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k],
125 HTaps: mode_lib->vba.htaps[k],
126 HTapsChroma: mode_lib->vba.HTAPsChroma[k],
127 VTaps: mode_lib->vba.vtaps[k],
128 VTapsChroma: mode_lib->vba.VTAPsChroma[k],
129
130 /* Output */
131 PSCL_THROUGHPUT: &v->PSCL_THROUGHPUT_LUMA[k], PSCL_THROUGHPUT_CHROMA: &v->PSCL_THROUGHPUT_CHROMA[k],
132 DPPCLKUsingSingleDPP: &v->DPPCLKUsingSingleDPP[k]);
133 }
134
135 dml32_CalculateDPPCLK(NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces, DISPCLKDPPCLKDSCCLKDownSpreading: mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading,
136 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed, DPPCLKUsingSingleDPP: v->DPPCLKUsingSingleDPP, DPPPerSurface: mode_lib->vba.DPPPerPlane,
137 /* Output */
138 GlobalDPPCLK: &v->GlobalDPPCLK, Dppclk: v->DPPCLK);
139
140 for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
141 v->DPPCLK_calculated[k] = v->DPPCLK[k];
142 }
143
144 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
145 dml32_CalculateBytePerPixelAndBlockSizes(
146 SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k],
147 SurfaceTiling: mode_lib->vba.SurfaceTiling[k],
148
149 /* Output */
150 BytePerPixelY: &v->BytePerPixelY[k],
151 BytePerPixelC: &v->BytePerPixelC[k],
152 BytePerPixelDETY: &v->BytePerPixelDETY[k],
153 BytePerPixelDETC: &v->BytePerPixelDETC[k],
154 BlockHeight256BytesY: &v->BlockHeight256BytesY[k],
155 BlockHeight256BytesC: &v->BlockHeight256BytesC[k],
156 BlockWidth256BytesY: &v->BlockWidth256BytesY[k],
157 BlockWidth256BytesC: &v->BlockWidth256BytesC[k],
158 MacroTileHeightY: &v->BlockHeightY[k],
159 MacroTileHeightC: &v->BlockHeightC[k],
160 MacroTileWidthY: &v->BlockWidthY[k],
161 MacroTileWidthC: &v->BlockWidthC[k]);
162 }
163
164#ifdef __DML_VBA_DEBUG__
165 dml_print("DML::%s: %d\n", __func__, __LINE__);
166#endif
167 dml32_CalculateSwathWidth(
168 ForceSingleDPP: false, // ForceSingleDPP
169 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
170 SourcePixelFormat: mode_lib->vba.SourcePixelFormat,
171 SourceScan: mode_lib->vba.SourceRotation,
172 ViewportStationary: mode_lib->vba.ViewportStationary,
173 ViewportWidth: mode_lib->vba.ViewportWidth,
174 ViewportHeight: mode_lib->vba.ViewportHeight,
175 ViewportXStart: mode_lib->vba.ViewportXStartY,
176 ViewportYStart: mode_lib->vba.ViewportYStartY,
177 ViewportXStartC: mode_lib->vba.ViewportXStartC,
178 ViewportYStartC: mode_lib->vba.ViewportYStartC,
179 SurfaceWidthY: mode_lib->vba.SurfaceWidthY,
180 SurfaceWidthC: mode_lib->vba.SurfaceWidthC,
181 SurfaceHeightY: mode_lib->vba.SurfaceHeightY,
182 SurfaceHeightC: mode_lib->vba.SurfaceHeightC,
183 ODMMode: mode_lib->vba.ODMCombineEnabled,
184 BytePerPixY: v->BytePerPixelY,
185 BytePerPixC: v->BytePerPixelC,
186 Read256BytesBlockHeightY: v->BlockHeight256BytesY,
187 Read256BytesBlockHeightC: v->BlockHeight256BytesC,
188 Read256BytesBlockWidthY: v->BlockWidth256BytesY,
189 Read256BytesBlockWidthC: v->BlockWidth256BytesC,
190 BlendingAndTiming: mode_lib->vba.BlendingAndTiming,
191 HActive: mode_lib->vba.HActive,
192 HRatio: mode_lib->vba.HRatio,
193 DPPPerSurface: mode_lib->vba.DPPPerPlane,
194
195 /* Output */
196 SwathWidthdoubleDPPY: v->SwathWidthSingleDPPY, SwathWidthdoubleDPPC: v->SwathWidthSingleDPPC, SwathWidthY: v->SwathWidthY, SwathWidthC: v->SwathWidthC,
197 MaximumSwathHeightY: v->dummy_vars
198 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
199 .dummy_integer_array[0], // Integer MaximumSwathHeightY[]
200 MaximumSwathHeightC: v->dummy_vars
201 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
202 .dummy_integer_array[1], // Integer MaximumSwathHeightC[]
203 swath_width_luma_ub: v->swath_width_luma_ub, swath_width_chroma_ub: v->swath_width_chroma_ub);
204
205 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
206 v->ReadBandwidthSurfaceLuma[k] = v->SwathWidthSingleDPPY[k] * v->BytePerPixelY[k]
207 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * mode_lib->vba.VRatio[k];
208 v->ReadBandwidthSurfaceChroma[k] = v->SwathWidthSingleDPPC[k] * v->BytePerPixelC[k]
209 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k])
210 * mode_lib->vba.VRatioChroma[k];
211#ifdef __DML_VBA_DEBUG__
212 dml_print("DML::%s: ReadBandwidthSurfaceLuma[%i] = %fBps\n",
213 __func__, k, v->ReadBandwidthSurfaceLuma[k]);
214 dml_print("DML::%s: ReadBandwidthSurfaceChroma[%i] = %fBps\n",
215 __func__, k, v->ReadBandwidthSurfaceChroma[k]);
216#endif
217 }
218
219 {
220 // VBA_DELTA
221 // Calculate DET size, swath height
222 dml32_CalculateSwathAndDETConfiguration(
223 DETSizeOverride: mode_lib->vba.DETSizeOverride,
224 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
225 ConfigReturnBufferSizeInKByte: mode_lib->vba.ConfigReturnBufferSizeInKByte,
226 MaxTotalDETInKByte: mode_lib->vba.MaxTotalDETInKByte,
227 MinCompressedBufferSizeInKByte: mode_lib->vba.MinCompressedBufferSizeInKByte,
228 ForceSingleDPP: false, /* ForceSingleDPP */
229 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
230 nomDETInKByte: mode_lib->vba.nomDETInKByte,
231 UseUnboundedRequestingFinal: mode_lib->vba.UseUnboundedRequesting,
232 DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment: mode_lib->vba.DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment,
233 PixelChunkSizeKBytes: mode_lib->vba.ip.pixel_chunk_size_kbytes,
234 ROBSizeKBytes: mode_lib->vba.ip.rob_buffer_size_kbytes,
235 CompressedBufferSegmentSizeInkByteFinal: mode_lib->vba.CompressedBufferSegmentSizeInkByteFinal,
236 Output: v->dummy_vars
237 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
238 .dummy_output_encoder_array, /* output_encoder_class Output[] */
239 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
240 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
241 MaximumSwathWidthLuma: v->dummy_vars
242 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
243 .dummy_single_array[0], /* Single MaximumSwathWidthLuma[] */
244 MaximumSwathWidthChroma: v->dummy_vars
245 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
246 .dummy_single_array[1], /* Single MaximumSwathWidthChroma[] */
247 SourceRotation: mode_lib->vba.SourceRotation,
248 ViewportStationary: mode_lib->vba.ViewportStationary,
249 SourcePixelFormat: mode_lib->vba.SourcePixelFormat,
250 SurfaceTiling: mode_lib->vba.SurfaceTiling,
251 ViewportWidth: mode_lib->vba.ViewportWidth,
252 ViewportHeight: mode_lib->vba.ViewportHeight,
253 ViewportXStart: mode_lib->vba.ViewportXStartY,
254 ViewportYStart: mode_lib->vba.ViewportYStartY,
255 ViewportXStartC: mode_lib->vba.ViewportXStartC,
256 ViewportYStartC: mode_lib->vba.ViewportYStartC,
257 SurfaceWidthY: mode_lib->vba.SurfaceWidthY,
258 SurfaceWidthC: mode_lib->vba.SurfaceWidthC,
259 SurfaceHeightY: mode_lib->vba.SurfaceHeightY,
260 SurfaceHeightC: mode_lib->vba.SurfaceHeightC,
261 Read256BytesBlockHeightY: v->BlockHeight256BytesY,
262 Read256BytesBlockHeightC: v->BlockHeight256BytesC,
263 Read256BytesBlockWidthY: v->BlockWidth256BytesY,
264 Read256BytesBlockWidthC: v->BlockWidth256BytesC,
265 ODMMode: mode_lib->vba.ODMCombineEnabled,
266 BlendingAndTiming: mode_lib->vba.BlendingAndTiming,
267 BytePerPixY: v->BytePerPixelY,
268 BytePerPixC: v->BytePerPixelC,
269 BytePerPixDETY: v->BytePerPixelDETY,
270 BytePerPixDETC: v->BytePerPixelDETC,
271 HActive: mode_lib->vba.HActive,
272 HRatio: mode_lib->vba.HRatio,
273 HRatioChroma: mode_lib->vba.HRatioChroma,
274 DPPPerSurface: mode_lib->vba.DPPPerPlane,
275
276 /* Output */
277 swath_width_luma_ub: v->dummy_vars
278 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
279 .dummy_long_array[0], /* Long swath_width_luma_ub[] */
280 swath_width_chroma_ub: v->dummy_vars
281 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
282 .dummy_long_array[1], /* Long swath_width_chroma_ub[] */
283 SwathWidth: v->dummy_vars
284 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
285 .dummy_double_array[0], /* Long SwathWidth[] */
286 SwathWidthChroma: v->dummy_vars
287 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
288 .dummy_double_array[1], /* Long SwathWidthChroma[] */
289 SwathHeightY: mode_lib->vba.SwathHeightY,
290 SwathHeightC: mode_lib->vba.SwathHeightC,
291 DETBufferSizeInKByte: mode_lib->vba.DETBufferSizeInKByte,
292 DETBufferSizeY: mode_lib->vba.DETBufferSizeY,
293 DETBufferSizeC: mode_lib->vba.DETBufferSizeC,
294 UnboundedRequestEnabled: &v->UnboundedRequestEnabled,
295 CompressedBufferSizeInkByte: &v->CompressedBufferSizeInkByte,
296 CompBufReservedSpaceKBytes: &v->CompBufReservedSpaceKBytes,
297 CompBufReservedSpaceNeedAdjustment: &v->dummy_vars
298 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
299 .dummy_boolean, /* bool *CompBufReservedSpaceNeedAjustment */
300 ViewportSizeSupportPerSurface: v->dummy_vars
301 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
302 .dummy_boolean_array, /* bool ViewportSizeSupportPerSurface[] */
303 ViewportSizeSupport: &v->dummy_vars
304 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
305 .dummy_boolean); /* bool *ViewportSizeSupport */
306 }
307
308 v->CompBufReservedSpaceZs = v->CompBufReservedSpaceKBytes * 1024.0 / 256.0;
309 v->CompBufReservedSpace64B = v->CompBufReservedSpaceKBytes * 1024.0 / 64.0;
310
311 // DCFCLK Deep Sleep
312 dml32_CalculateDCFCLKDeepSleep(
313 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
314 BytePerPixelY: v->BytePerPixelY,
315 BytePerPixelC: v->BytePerPixelC,
316 VRatio: mode_lib->vba.VRatio,
317 VRatioChroma: mode_lib->vba.VRatioChroma,
318 SwathWidthY: v->SwathWidthY,
319 SwathWidthC: v->SwathWidthC,
320 DPPPerSurface: mode_lib->vba.DPPPerPlane,
321 HRatio: mode_lib->vba.HRatio,
322 HRatioChroma: mode_lib->vba.HRatioChroma,
323 PixelClock: mode_lib->vba.PixelClock,
324 PSCL_THROUGHPUT: v->PSCL_THROUGHPUT_LUMA,
325 PSCL_THROUGHPUT_CHROMA: v->PSCL_THROUGHPUT_CHROMA,
326 Dppclk: mode_lib->vba.DPPCLK,
327 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
328 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
329 ReturnBusWidth: mode_lib->vba.ReturnBusWidth,
330
331 /* Output */
332 DCFClkDeepSleep: &v->DCFCLKDeepSleep);
333
334 // DSCCLK
335 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
336 if ((mode_lib->vba.BlendingAndTiming[k] != k) || !mode_lib->vba.DSCEnabled[k]) {
337 v->DSCCLK_calculated[k] = 0.0;
338 } else {
339 if (mode_lib->vba.OutputFormat[k] == dm_420)
340 mode_lib->vba.DSCFormatFactor = 2;
341 else if (mode_lib->vba.OutputFormat[k] == dm_444)
342 mode_lib->vba.DSCFormatFactor = 1;
343 else if (mode_lib->vba.OutputFormat[k] == dm_n422)
344 mode_lib->vba.DSCFormatFactor = 2;
345 else
346 mode_lib->vba.DSCFormatFactor = 1;
347 if (mode_lib->vba.ODMCombineEnabled[k] == dm_odm_combine_mode_4to1)
348 v->DSCCLK_calculated[k] = mode_lib->vba.PixelClockBackEnd[k] / 12
349 / mode_lib->vba.DSCFormatFactor
350 / (1 - mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading / 100);
351 else if (mode_lib->vba.ODMCombineEnabled[k] == dm_odm_combine_mode_2to1)
352 v->DSCCLK_calculated[k] = mode_lib->vba.PixelClockBackEnd[k] / 6
353 / mode_lib->vba.DSCFormatFactor
354 / (1 - mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading / 100);
355 else
356 v->DSCCLK_calculated[k] = mode_lib->vba.PixelClockBackEnd[k] / 3
357 / mode_lib->vba.DSCFormatFactor
358 / (1 - mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading / 100);
359 }
360 }
361
362 // DSC Delay
363 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
364 v->DSCDelay[k] = dml32_DSCDelayRequirement(DSCEnabled: mode_lib->vba.DSCEnabled[k],
365 ODMMode: mode_lib->vba.ODMCombineEnabled[k], DSCInputBitPerComponent: mode_lib->vba.DSCInputBitPerComponent[k],
366 OutputBpp: mode_lib->vba.OutputBppPerState[mode_lib->vba.VoltageLevel][k],
367 HActive: mode_lib->vba.HActive[k], HTotal: mode_lib->vba.HTotal[k],
368 NumberOfDSCSlices: mode_lib->vba.NumberOfDSCSlices[k], OutputFormat: mode_lib->vba.OutputFormat[k],
369 Output: mode_lib->vba.Output[k], PixelClock: mode_lib->vba.PixelClock[k],
370 PixelClockBackEnd: mode_lib->vba.PixelClockBackEnd[k], dsc_delay_factor_wa: mode_lib->vba.ip.dsc_delay_factor_wa);
371 }
372
373 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
374 for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j) // NumberOfSurfaces
375 if (j != k && mode_lib->vba.BlendingAndTiming[k] == j && mode_lib->vba.DSCEnabled[j])
376 v->DSCDelay[k] = v->DSCDelay[j];
377
378 //Immediate Flip
379 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
380 v->ImmediateFlipSupportedSurface[k] = mode_lib->vba.ImmediateFlipSupport
381 && (mode_lib->vba.ImmediateFlipRequirement[k] != dm_immediate_flip_not_required);
382 }
383
384 // Prefetch
385 dml32_CalculateSurfaceSizeInMall(
386 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
387 MALLAllocatedForDCN: mode_lib->vba.MALLAllocatedForDCNFinal,
388 UseMALLForStaticScreen: mode_lib->vba.UseMALLForStaticScreen,
389 UsesMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
390 DCCEnable: mode_lib->vba.DCCEnable,
391 ViewportStationary: mode_lib->vba.ViewportStationary,
392 ViewportXStartY: mode_lib->vba.ViewportXStartY,
393 ViewportYStartY: mode_lib->vba.ViewportYStartY,
394 ViewportXStartC: mode_lib->vba.ViewportXStartC,
395 ViewportYStartC: mode_lib->vba.ViewportYStartC,
396 ViewportWidthY: mode_lib->vba.ViewportWidth,
397 ViewportHeightY: mode_lib->vba.ViewportHeight,
398 BytesPerPixelY: v->BytePerPixelY,
399 ViewportWidthC: mode_lib->vba.ViewportWidthChroma,
400 ViewportHeightC: mode_lib->vba.ViewportHeightChroma,
401 BytesPerPixelC: v->BytePerPixelC,
402 SurfaceWidthY: mode_lib->vba.SurfaceWidthY,
403 SurfaceWidthC: mode_lib->vba.SurfaceWidthC,
404 SurfaceHeightY: mode_lib->vba.SurfaceHeightY,
405 SurfaceHeightC: mode_lib->vba.SurfaceHeightC,
406 Read256BytesBlockWidthY: v->BlockWidth256BytesY,
407 Read256BytesBlockWidthC: v->BlockWidth256BytesC,
408 Read256BytesBlockHeightY: v->BlockHeight256BytesY,
409 Read256BytesBlockHeightC: v->BlockHeight256BytesC,
410 ReadBlockWidthY: v->BlockWidthY,
411 ReadBlockWidthC: v->BlockWidthC,
412 ReadBlockHeightY: v->BlockHeightY,
413 ReadBlockHeightC: v->BlockHeightC,
414 DCCMetaPitchY: mode_lib->vba.DCCMetaPitchY,
415 DCCMetaPitchC: mode_lib->vba.DCCMetaPitchC,
416
417 /* Output */
418 SurfaceSizeInMALL: v->SurfaceSizeInMALL,
419 ExceededMALLSize: &v->dummy_vars.
420 DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
421 .dummy_boolean2); /* Boolean *ExceededMALLSize */
422
423 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
424 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].PixelClock = mode_lib->vba.PixelClock[k];
425 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].DPPPerSurface = mode_lib->vba.DPPPerPlane[k];
426 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].SourceRotation = mode_lib->vba.SourceRotation[k];
427 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportHeight = mode_lib->vba.ViewportHeight[k];
428 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportHeightChroma = mode_lib->vba.ViewportHeightChroma[k];
429 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockWidth256BytesY = v->BlockWidth256BytesY[k];
430 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockHeight256BytesY = v->BlockHeight256BytesY[k];
431 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockWidth256BytesC = v->BlockWidth256BytesC[k];
432 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockHeight256BytesC = v->BlockHeight256BytesC[k];
433 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockWidthY = v->BlockWidthY[k];
434 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockHeightY = v->BlockHeightY[k];
435 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockWidthC = v->BlockWidthC[k];
436 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BlockHeightC = v->BlockHeightC[k];
437 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].InterlaceEnable = mode_lib->vba.Interlace[k];
438 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].HTotal = mode_lib->vba.HTotal[k];
439 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].DCCEnable = mode_lib->vba.DCCEnable[k];
440 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].SourcePixelFormat = mode_lib->vba.SourcePixelFormat[k];
441 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].SurfaceTiling = mode_lib->vba.SurfaceTiling[k];
442 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BytePerPixelY = v->BytePerPixelY[k];
443 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].BytePerPixelC = v->BytePerPixelC[k];
444 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ProgressiveToInterlaceUnitInOPP = mode_lib->vba.ProgressiveToInterlaceUnitInOPP;
445 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].VRatio = mode_lib->vba.VRatio[k];
446 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].VRatioChroma = mode_lib->vba.VRatioChroma[k];
447 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].VTaps = mode_lib->vba.vtaps[k];
448 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].VTapsChroma = mode_lib->vba.VTAPsChroma[k];
449 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].PitchY = mode_lib->vba.PitchY[k];
450 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].DCCMetaPitchY = mode_lib->vba.DCCMetaPitchY[k];
451 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].PitchC = mode_lib->vba.PitchC[k];
452 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].DCCMetaPitchC = mode_lib->vba.DCCMetaPitchC[k];
453 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportStationary = mode_lib->vba.ViewportStationary[k];
454 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportXStart = mode_lib->vba.ViewportXStartY[k];
455 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportYStart = mode_lib->vba.ViewportYStartY[k];
456 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportXStartC = mode_lib->vba.ViewportXStartC[k];
457 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].ViewportYStartC = mode_lib->vba.ViewportYStartC[k];
458 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].FORCE_ONE_ROW_FOR_FRAME = mode_lib->vba.ForceOneRowForFrame[k];
459 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].SwathHeightY = mode_lib->vba.SwathHeightY[k];
460 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters[k].SwathHeightC = mode_lib->vba.SwathHeightC[k];
461 }
462
463 {
464
465 dml32_CalculateVMRowAndSwath(
466 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
467 myPipe: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.SurfaceParameters,
468 SurfaceSizeInMALL: v->SurfaceSizeInMALL,
469 PTEBufferSizeInRequestsLuma: mode_lib->vba.PTEBufferSizeInRequestsLuma,
470 PTEBufferSizeInRequestsChroma: mode_lib->vba.PTEBufferSizeInRequestsChroma,
471 DCCMetaBufferSizeBytes: mode_lib->vba.DCCMetaBufferSizeBytes,
472 UseMALLForStaticScreen: mode_lib->vba.UseMALLForStaticScreen,
473 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
474 MALLAllocatedForDCN: mode_lib->vba.MALLAllocatedForDCNFinal,
475 SwathWidthY: v->SwathWidthY,
476 SwathWidthC: v->SwathWidthC,
477 GPUVMEnable: mode_lib->vba.GPUVMEnable,
478 HostVMEnable: mode_lib->vba.HostVMEnable,
479 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
480 GPUVMMaxPageTableLevels: mode_lib->vba.GPUVMMaxPageTableLevels,
481 GPUVMMinPageSizeKBytes: mode_lib->vba.GPUVMMinPageSizeKBytes,
482 HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
483
484 /* Output */
485 PTEBufferSizeNotExceeded: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_boolean_array2[0], // Boolean PTEBufferSizeNotExceeded[]
486 DCCMetaBufferSizeNotExceeded: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_boolean_array2[1], // Boolean DCCMetaBufferSizeNotExceeded[]
487 dpte_row_width_luma_ub: v->dpte_row_width_luma_ub,
488 dpte_row_width_chroma_ub: v->dpte_row_width_chroma_ub,
489 dpte_row_height_luma: v->dpte_row_height,
490 dpte_row_height_chroma: v->dpte_row_height_chroma,
491 dpte_row_height_linear_luma: v->dpte_row_height_linear,
492 dpte_row_height_linear_chroma: v->dpte_row_height_linear_chroma,
493 meta_req_width: v->meta_req_width,
494 meta_req_width_chroma: v->meta_req_width_chroma,
495 meta_req_height: v->meta_req_height,
496 meta_req_height_chroma: v->meta_req_height_chroma,
497 meta_row_width: v->meta_row_width,
498 meta_row_width_chroma: v->meta_row_width_chroma,
499 meta_row_height: v->meta_row_height,
500 meta_row_height_chroma: v->meta_row_height_chroma,
501 vm_group_bytes: v->vm_group_bytes,
502 dpte_group_bytes: v->dpte_group_bytes,
503 PixelPTEReqWidthY: v->PixelPTEReqWidthY,
504 PixelPTEReqHeightY: v->PixelPTEReqHeightY,
505 PTERequestSizeY: v->PTERequestSizeY,
506 PixelPTEReqWidthC: v->PixelPTEReqWidthC,
507 PixelPTEReqHeightC: v->PixelPTEReqHeightC,
508 PTERequestSizeC: v->PTERequestSizeC,
509 dpde0_bytes_per_frame_ub_l: v->dpde0_bytes_per_frame_ub_l,
510 meta_pte_bytes_per_frame_ub_l: v->meta_pte_bytes_per_frame_ub_l,
511 dpde0_bytes_per_frame_ub_c: v->dpde0_bytes_per_frame_ub_c,
512 meta_pte_bytes_per_frame_ub_c: v->meta_pte_bytes_per_frame_ub_c,
513 PrefetchSourceLinesY: v->PrefetchSourceLinesY,
514 PrefetchSourceLinesC: v->PrefetchSourceLinesC,
515 VInitPreFillY: v->VInitPreFillY, VInitPreFillC: v->VInitPreFillC,
516 MaxNumSwathY: v->MaxNumSwathY,
517 MaxNumSwathC: v->MaxNumSwathC,
518 meta_row_bw: v->meta_row_bw,
519 dpte_row_bw: v->dpte_row_bw,
520 PixelPTEBytesPerRow: v->PixelPTEBytesPerRow,
521 PDEAndMetaPTEBytesFrame: v->PDEAndMetaPTEBytesFrame,
522 MetaRowByte: v->MetaRowByte,
523 use_one_row_for_frame: v->Use_One_Row_For_Frame,
524 use_one_row_for_frame_flip: v->Use_One_Row_For_Frame_Flip,
525 UsesMALLForStaticScreen: v->UsesMALLForStaticScreen,
526 PTE_BUFFER_MODE: v->PTE_BUFFER_MODE,
527 BIGK_FRAGMENT_SIZE: v->BIGK_FRAGMENT_SIZE);
528 }
529
530
531 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.ReorderBytes = mode_lib->vba.NumberOfChannels
532 * dml_max3(a: mode_lib->vba.UrgentOutOfOrderReturnPerChannelPixelDataOnly,
533 b: mode_lib->vba.UrgentOutOfOrderReturnPerChannelPixelMixedWithVMData,
534 c: mode_lib->vba.UrgentOutOfOrderReturnPerChannelVMDataOnly);
535
536 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.VMDataOnlyReturnBW = dml32_get_return_bw_mbps_vm_only(
537 soc: &mode_lib->vba.soc,
538 VoltageLevel: mode_lib->vba.VoltageLevel,
539 DCFCLK: mode_lib->vba.DCFCLK,
540 FabricClock: mode_lib->vba.FabricClock,
541 DRAMSpeed: mode_lib->vba.DRAMSpeed);
542
543#ifdef __DML_VBA_DEBUG__
544 dml_print("DML::%s: mode_lib->vba.ReturnBusWidth = %f\n", __func__, mode_lib->vba.ReturnBusWidth);
545 dml_print("DML::%s: mode_lib->vba.DCFCLK = %f\n", __func__, mode_lib->vba.DCFCLK);
546 dml_print("DML::%s: mode_lib->vba.FabricClock = %f\n", __func__, mode_lib->vba.FabricClock);
547 dml_print("DML::%s: mode_lib->vba.FabricDatapathToDCNDataReturn = %f\n", __func__,
548 mode_lib->vba.FabricDatapathToDCNDataReturn);
549 dml_print("DML::%s: mode_lib->vba.PercentOfIdealSDPPortBWReceivedAfterUrgLatency = %f\n",
550 __func__, mode_lib->vba.PercentOfIdealSDPPortBWReceivedAfterUrgLatency);
551 dml_print("DML::%s: mode_lib->vba.DRAMSpeed = %f\n", __func__, mode_lib->vba.DRAMSpeed);
552 dml_print("DML::%s: mode_lib->vba.NumberOfChannels = %f\n", __func__, mode_lib->vba.NumberOfChannels);
553 dml_print("DML::%s: mode_lib->vba.DRAMChannelWidth = %f\n", __func__, mode_lib->vba.DRAMChannelWidth);
554 dml_print("DML::%s: mode_lib->vba.PercentOfIdealDRAMBWReceivedAfterUrgLatencyVMDataOnly = %f\n",
555 __func__, mode_lib->vba.PercentOfIdealDRAMBWReceivedAfterUrgLatencyVMDataOnly);
556 dml_print("DML::%s: VMDataOnlyReturnBW = %f\n", __func__, VMDataOnlyReturnBW);
557 dml_print("DML::%s: ReturnBW = %f\n", __func__, mode_lib->vba.ReturnBW);
558#endif
559
560 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor = 1.0;
561
562 if (mode_lib->vba.GPUVMEnable && mode_lib->vba.HostVMEnable)
563 v->dummy_vars
564 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
565 .HostVMInefficiencyFactor =
566 mode_lib->vba.ReturnBW / v->dummy_vars
567 .DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation
568 .VMDataOnlyReturnBW;
569
570 mode_lib->vba.TotalDCCActiveDPP = 0;
571 mode_lib->vba.TotalActiveDPP = 0;
572 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
573 mode_lib->vba.TotalActiveDPP = mode_lib->vba.TotalActiveDPP + mode_lib->vba.DPPPerPlane[k];
574 if (mode_lib->vba.DCCEnable[k])
575 mode_lib->vba.TotalDCCActiveDPP = mode_lib->vba.TotalDCCActiveDPP
576 + mode_lib->vba.DPPPerPlane[k];
577 }
578
579 v->UrgentExtraLatency = dml32_CalculateExtraLatency(
580 RoundTripPingLatencyCycles: mode_lib->vba.RoundTripPingLatencyCycles,
581 ReorderingBytes: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.ReorderBytes,
582 DCFCLK: mode_lib->vba.DCFCLK,
583 TotalNumberOfActiveDPP: mode_lib->vba.TotalActiveDPP,
584 PixelChunkSizeInKByte: mode_lib->vba.PixelChunkSizeInKByte,
585 TotalNumberOfDCCActiveDPP: mode_lib->vba.TotalDCCActiveDPP,
586 MetaChunkSize: mode_lib->vba.MetaChunkSize,
587 ReturnBW: mode_lib->vba.ReturnBW,
588 GPUVMEnable: mode_lib->vba.GPUVMEnable,
589 HostVMEnable: mode_lib->vba.HostVMEnable,
590 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
591 NumberOfDPP: mode_lib->vba.DPPPerPlane,
592 dpte_group_bytes: v->dpte_group_bytes,
593 HostVMInefficiencyFactor: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor,
594 HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
595 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels);
596
597 mode_lib->vba.TCalc = 24.0 / v->DCFCLKDeepSleep;
598
599 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
600 if (mode_lib->vba.BlendingAndTiming[k] == k) {
601 if (mode_lib->vba.WritebackEnable[k] == true) {
602 v->WritebackDelay[mode_lib->vba.VoltageLevel][k] = mode_lib->vba.WritebackLatency
603 + dml32_CalculateWriteBackDelay(
604 WritebackPixelFormat: mode_lib->vba.WritebackPixelFormat[k],
605 WritebackHRatio: mode_lib->vba.WritebackHRatio[k],
606 WritebackVRatio: mode_lib->vba.WritebackVRatio[k],
607 WritebackVTaps: mode_lib->vba.WritebackVTaps[k],
608 WritebackDestinationWidth: mode_lib->vba.WritebackDestinationWidth[k],
609 WritebackDestinationHeight: mode_lib->vba.WritebackDestinationHeight[k],
610 WritebackSourceHeight: mode_lib->vba.WritebackSourceHeight[k],
611 HTotal: mode_lib->vba.HTotal[k]) / mode_lib->vba.DISPCLK;
612 } else
613 v->WritebackDelay[mode_lib->vba.VoltageLevel][k] = 0;
614 for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j) {
615 if (mode_lib->vba.BlendingAndTiming[j] == k &&
616 mode_lib->vba.WritebackEnable[j] == true) {
617 v->WritebackDelay[mode_lib->vba.VoltageLevel][k] =
618 dml_max(a: v->WritebackDelay[mode_lib->vba.VoltageLevel][k],
619 b: mode_lib->vba.WritebackLatency +
620 dml32_CalculateWriteBackDelay(
621 WritebackPixelFormat: mode_lib->vba.WritebackPixelFormat[j],
622 WritebackHRatio: mode_lib->vba.WritebackHRatio[j],
623 WritebackVRatio: mode_lib->vba.WritebackVRatio[j],
624 WritebackVTaps: mode_lib->vba.WritebackVTaps[j],
625 WritebackDestinationWidth: mode_lib->vba.WritebackDestinationWidth[j],
626 WritebackDestinationHeight: mode_lib->vba.WritebackDestinationHeight[j],
627 WritebackSourceHeight: mode_lib->vba.WritebackSourceHeight[j],
628 HTotal: mode_lib->vba.HTotal[k]) / mode_lib->vba.DISPCLK);
629 }
630 }
631 }
632 }
633
634 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
635 for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j)
636 if (mode_lib->vba.BlendingAndTiming[k] == j)
637 v->WritebackDelay[mode_lib->vba.VoltageLevel][k] =
638 v->WritebackDelay[mode_lib->vba.VoltageLevel][j];
639
640 v->UrgentLatency = dml32_CalculateUrgentLatency(UrgentLatencyPixelDataOnly: mode_lib->vba.UrgentLatencyPixelDataOnly,
641 UrgentLatencyPixelMixedWithVMData: mode_lib->vba.UrgentLatencyPixelMixedWithVMData,
642 UrgentLatencyVMDataOnly: mode_lib->vba.UrgentLatencyVMDataOnly,
643 DoUrgentLatencyAdjustment: mode_lib->vba.DoUrgentLatencyAdjustment,
644 UrgentLatencyAdjustmentFabricClockComponent: mode_lib->vba.UrgentLatencyAdjustmentFabricClockComponent,
645 UrgentLatencyAdjustmentFabricClockReference: mode_lib->vba.UrgentLatencyAdjustmentFabricClockReference,
646 FabricClock: mode_lib->vba.FabricClock);
647
648 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
649 dml32_CalculateUrgentBurstFactor(UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange[k],
650 swath_width_luma_ub: v->swath_width_luma_ub[k],
651 swath_width_chroma_ub: v->swath_width_chroma_ub[k],
652 SwathHeightY: mode_lib->vba.SwathHeightY[k],
653 SwathHeightC: mode_lib->vba.SwathHeightC[k],
654 LineTime: mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k],
655 UrgentLatency: v->UrgentLatency,
656 CursorBufferSize: mode_lib->vba.CursorBufferSize,
657 CursorWidth: mode_lib->vba.CursorWidth[k][0],
658 CursorBPP: mode_lib->vba.CursorBPP[k][0],
659 VRatio: mode_lib->vba.VRatio[k],
660 VRatioC: mode_lib->vba.VRatioChroma[k],
661 BytePerPixelInDETY: v->BytePerPixelDETY[k],
662 BytePerPixelInDETC: v->BytePerPixelDETC[k],
663 DETBufferSizeY: mode_lib->vba.DETBufferSizeY[k],
664 DETBufferSizeC: mode_lib->vba.DETBufferSizeC[k],
665
666 /* output */
667 UrgentBurstFactorCursor: &v->UrgBurstFactorCursor[k],
668 UrgentBurstFactorLuma: &v->UrgBurstFactorLuma[k],
669 UrgentBurstFactorChroma: &v->UrgBurstFactorChroma[k],
670 NotEnoughUrgentLatencyHiding: &v->NoUrgentLatencyHiding[k]);
671
672 v->cursor_bw[k] = mode_lib->vba.NumberOfCursors[k] * mode_lib->vba.CursorWidth[k][0] * mode_lib->vba.CursorBPP[k][0] / 8 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * mode_lib->vba.VRatio[k];
673 }
674
675 v->NotEnoughDETSwathFillLatencyHiding = dml32_CalculateDETSwathFillLatencyHiding(
676 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
677 ReturnBW: mode_lib->vba.ReturnBW,
678 UrgentLatency: v->UrgentLatency,
679 SwathHeightY: mode_lib->vba.SwathHeightY,
680 SwathHeightC: mode_lib->vba.SwathHeightC,
681 SwathWidthY: v->swath_width_luma_ub,
682 SwathWidthC: v->swath_width_chroma_ub,
683 BytePerPixelInDETY: v->BytePerPixelDETY,
684 BytePerPixelInDETC: v->BytePerPixelDETC,
685 DETBufferSizeY: mode_lib->vba.DETBufferSizeY,
686 DETBufferSizeC: mode_lib->vba.DETBufferSizeC,
687 NumOfDPP: mode_lib->vba.DPPPerPlane,
688 HTotal: mode_lib->vba.HTotal,
689 PixelClock: mode_lib->vba.PixelClock,
690 VRatioY: mode_lib->vba.VRatio,
691 VRatioC: mode_lib->vba.VRatioChroma,
692 UsesMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
693 UseUnboundedRequesting: mode_lib->vba.UseUnboundedRequesting);
694
695 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
696 v->MaxVStartupLines[k] = ((mode_lib->vba.Interlace[k] &&
697 !mode_lib->vba.ProgressiveToInterlaceUnitInOPP) ?
698 dml_floor(a: (mode_lib->vba.VTotal[k] - mode_lib->vba.VActive[k]) / 2.0, granularity: 1.0) :
699 mode_lib->vba.VTotal[k] - mode_lib->vba.VActive[k]) - dml_max(a: 1.0,
700 b: dml_ceil(a: (double) v->WritebackDelay[mode_lib->vba.VoltageLevel][k]
701 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]), granularity: 1));
702
703 // Clamp to max OTG vstartup register limit
704 if (v->MaxVStartupLines[k] > 1023)
705 v->MaxVStartupLines[k] = 1023;
706
707#ifdef __DML_VBA_DEBUG__
708 dml_print("DML::%s: k=%d MaxVStartupLines = %d\n", __func__, k, v->MaxVStartupLines[k]);
709 dml_print("DML::%s: k=%d VoltageLevel = %d\n", __func__, k, mode_lib->vba.VoltageLevel);
710 dml_print("DML::%s: k=%d WritebackDelay = %f\n", __func__,
711 k, v->WritebackDelay[mode_lib->vba.VoltageLevel][k]);
712#endif
713 }
714
715 v->MaximumMaxVStartupLines = 0;
716 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
717 v->MaximumMaxVStartupLines = dml_max(a: v->MaximumMaxVStartupLines, b: v->MaxVStartupLines[k]);
718
719 ImmediateFlipRequirementFinal = false;
720
721 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
722 ImmediateFlipRequirementFinal = ImmediateFlipRequirementFinal
723 || (mode_lib->vba.ImmediateFlipRequirement[k] == dm_immediate_flip_required);
724 }
725#ifdef __DML_VBA_DEBUG__
726 dml_print("DML::%s: ImmediateFlipRequirementFinal = %d\n", __func__, ImmediateFlipRequirementFinal);
727#endif
728 // ModeProgramming will not repeat the schedule calculation using different prefetch mode,
729 //it is just calcualated once with given prefetch mode
730 dml32_CalculateMinAndMaxPrefetchMode(
731 AllowForPStateChangeOrStutterInVBlankFinal: mode_lib->vba.AllowForPStateChangeOrStutterInVBlankFinal,
732 MinPrefetchMode: &mode_lib->vba.MinPrefetchMode,
733 MaxPrefetchMode: &mode_lib->vba.MaxPrefetchMode);
734
735 v->VStartupLines = __DML_VBA_MIN_VSTARTUP__;
736
737 iteration = 0;
738 MaxTotalRDBandwidth = 0;
739 NextPrefetchMode = mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb];
740
741 do {
742 MaxTotalRDBandwidth = 0;
743 DestinationLineTimesForPrefetchLessThan2 = false;
744 VRatioPrefetchMoreThanMax = false;
745#ifdef __DML_VBA_DEBUG__
746 dml_print("DML::%s: Start loop: VStartup = %d\n", __func__, mode_lib->vba.VStartupLines);
747#endif
748 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
749 /* NOTE PerfetchMode variable is invalid in DAL as per the input received.
750 * Hence the direction is to use PrefetchModePerState.
751 */
752 TWait = dml32_CalculateTWait(
753 PrefetchMode: mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb],
754 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange[k],
755 SynchronizeDRRDisplaysForUCLKPStateChangeFinal: mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
756 DRRDisplay: mode_lib->vba.DRRDisplay[k],
757 DRAMClockChangeLatency: mode_lib->vba.DRAMClockChangeLatency,
758 FCLKChangeLatency: mode_lib->vba.FCLKChangeLatency, UrgentLatency: v->UrgentLatency,
759 SREnterPlusExitTime: mode_lib->vba.SREnterPlusExitTime);
760
761 memset(&v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe, 0, sizeof(DmlPipe));
762
763 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.Dppclk = mode_lib->vba.DPPCLK[k];
764 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.Dispclk = mode_lib->vba.DISPCLK;
765 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.PixelClock = mode_lib->vba.PixelClock[k];
766 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.DCFClkDeepSleep = v->DCFCLKDeepSleep;
767 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.DPPPerSurface = mode_lib->vba.DPPPerPlane[k];
768 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.ScalerEnabled = mode_lib->vba.ScalerEnabled[k];
769 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.SourceRotation = mode_lib->vba.SourceRotation[k];
770 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BlockWidth256BytesY = v->BlockWidth256BytesY[k];
771 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BlockHeight256BytesY = v->BlockHeight256BytesY[k];
772 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BlockWidth256BytesC = v->BlockWidth256BytesC[k];
773 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BlockHeight256BytesC = v->BlockHeight256BytesC[k];
774 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.InterlaceEnable = mode_lib->vba.Interlace[k];
775 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.NumberOfCursors = mode_lib->vba.NumberOfCursors[k];
776 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.VBlank = mode_lib->vba.VTotal[k] - mode_lib->vba.VActive[k];
777 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.HTotal = mode_lib->vba.HTotal[k];
778 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.HActive = mode_lib->vba.HActive[k];
779 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.DCCEnable = mode_lib->vba.DCCEnable[k];
780 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.ODMMode = mode_lib->vba.ODMCombineEnabled[k];
781 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.SourcePixelFormat = mode_lib->vba.SourcePixelFormat[k];
782 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BytePerPixelY = v->BytePerPixelY[k];
783 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BytePerPixelC = v->BytePerPixelC[k];
784 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.ProgressiveToInterlaceUnitInOPP = mode_lib->vba.ProgressiveToInterlaceUnitInOPP;
785 v->ErrorResult[k] = dml32_CalculatePrefetchSchedule(
786 v,
787 k,
788 HostVMInefficiencyFactor: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor,
789 myPipe: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe,
790 DSCDelay: v->DSCDelay[k],
791 DPP_RECOUT_WIDTH: (unsigned int) (v->SwathWidthY[k] / v->HRatio[k]),
792 VStartup: dml_min(a: v->VStartupLines, b: v->MaxVStartupLines[k]),
793 MaxVStartup: v->MaxVStartupLines[k],
794 UrgentLatency: v->UrgentLatency,
795 UrgentExtraLatency: v->UrgentExtraLatency,
796 TCalc: v->TCalc,
797 PDEAndMetaPTEBytesFrame: v->PDEAndMetaPTEBytesFrame[k],
798 MetaRowByte: v->MetaRowByte[k],
799 PixelPTEBytesPerRow: v->PixelPTEBytesPerRow[k],
800 PrefetchSourceLinesY: v->PrefetchSourceLinesY[k],
801 SwathWidthY: v->SwathWidthY[k],
802 VInitPreFillY: v->VInitPreFillY[k],
803 MaxNumSwathY: v->MaxNumSwathY[k],
804 PrefetchSourceLinesC: v->PrefetchSourceLinesC[k],
805 SwathWidthC: v->SwathWidthC[k],
806 VInitPreFillC: v->VInitPreFillC[k],
807 MaxNumSwathC: v->MaxNumSwathC[k],
808 swath_width_luma_ub: v->swath_width_luma_ub[k],
809 swath_width_chroma_ub: v->swath_width_chroma_ub[k],
810 SwathHeightY: v->SwathHeightY[k],
811 SwathHeightC: v->SwathHeightC[k],
812 TWait,
813 TPreReq: (v->DRAMSpeedPerState[mode_lib->vba.VoltageLevel] <= MEM_STROBE_FREQ_MHZ ||
814 v->DCFCLKPerState[mode_lib->vba.VoltageLevel] <= DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ) ?
815 mode_lib->vba.ip.min_prefetch_in_strobe_us : 0,
816 ExtendPrefetchIfPossible: mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] > 0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false,
817
818 /* Output */
819 DSTXAfterScaler: &v->DSTXAfterScaler[k],
820 DSTYAfterScaler: &v->DSTYAfterScaler[k],
821 DestinationLinesForPrefetch: &v->DestinationLinesForPrefetch[k],
822 PrefetchBandwidth: &v->PrefetchBandwidth[k],
823 DestinationLinesToRequestVMInVBlank: &v->DestinationLinesToRequestVMInVBlank[k],
824 DestinationLinesToRequestRowInVBlank: &v->DestinationLinesToRequestRowInVBlank[k],
825 VRatioPrefetchY: &v->VRatioPrefetchY[k],
826 VRatioPrefetchC: &v->VRatioPrefetchC[k],
827 RequiredPrefetchPixDataBWLuma: &v->RequiredPrefetchPixDataBWLuma[k],
828 RequiredPrefetchPixDataBWChroma: &v->RequiredPrefetchPixDataBWChroma[k],
829 NotEnoughTimeForDynamicMetadata: &v->NotEnoughTimeForDynamicMetadata[k],
830 Tno_bw: &v->Tno_bw[k], prefetch_vmrow_bw: &v->prefetch_vmrow_bw[k],
831 Tdmdl_vm: &v->Tdmdl_vm[k],
832 Tdmdl: &v->Tdmdl[k],
833 TSetup: &v->TSetup[k],
834 VUpdateOffsetPix: &v->VUpdateOffsetPix[k],
835 VUpdateWidthPix: &v->VUpdateWidthPix[k],
836 VReadyOffsetPix: &v->VReadyOffsetPix[k]);
837
838#ifdef __DML_VBA_DEBUG__
839 dml_print("DML::%s: k=%0d Prefetch calculation errResult=%0d\n",
840 __func__, k, mode_lib->vba.ErrorResult[k]);
841#endif
842 v->VStartup[k] = dml_min(a: v->VStartupLines, b: v->MaxVStartupLines[k]);
843 }
844
845 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
846 dml32_CalculateUrgentBurstFactor(UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange[k],
847 swath_width_luma_ub: v->swath_width_luma_ub[k],
848 swath_width_chroma_ub: v->swath_width_chroma_ub[k],
849 SwathHeightY: mode_lib->vba.SwathHeightY[k],
850 SwathHeightC: mode_lib->vba.SwathHeightC[k],
851 LineTime: mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k],
852 UrgentLatency: v->UrgentLatency,
853 CursorBufferSize: mode_lib->vba.CursorBufferSize,
854 CursorWidth: mode_lib->vba.CursorWidth[k][0],
855 CursorBPP: mode_lib->vba.CursorBPP[k][0],
856 VRatio: v->VRatioPrefetchY[k],
857 VRatioC: v->VRatioPrefetchC[k],
858 BytePerPixelInDETY: v->BytePerPixelDETY[k],
859 BytePerPixelInDETC: v->BytePerPixelDETC[k],
860 DETBufferSizeY: mode_lib->vba.DETBufferSizeY[k],
861 DETBufferSizeC: mode_lib->vba.DETBufferSizeC[k],
862 /* Output */
863 UrgentBurstFactorCursor: &v->UrgBurstFactorCursorPre[k],
864 UrgentBurstFactorLuma: &v->UrgBurstFactorLumaPre[k],
865 UrgentBurstFactorChroma: &v->UrgBurstFactorChromaPre[k],
866 NotEnoughUrgentLatencyHiding: &v->NoUrgentLatencyHidingPre[k]);
867
868 v->cursor_bw_pre[k] = mode_lib->vba.NumberOfCursors[k] * mode_lib->vba.CursorWidth[k][0] * mode_lib->vba.CursorBPP[k][0] /
869 8.0 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * v->VRatioPrefetchY[k];
870
871#ifdef __DML_VBA_DEBUG__
872 dml_print("DML::%s: k=%0d DPPPerSurface=%d\n", __func__, k, mode_lib->vba.DPPPerPlane[k]);
873 dml_print("DML::%s: k=%0d UrgBurstFactorLuma=%f\n", __func__, k, v->UrgBurstFactorLuma[k]);
874 dml_print("DML::%s: k=%0d UrgBurstFactorChroma=%f\n", __func__, k, v->UrgBurstFactorChroma[k]);
875 dml_print("DML::%s: k=%0d UrgBurstFactorLumaPre=%f\n", __func__, k,
876 v->UrgBurstFactorLumaPre[k]);
877 dml_print("DML::%s: k=%0d UrgBurstFactorChromaPre=%f\n", __func__, k,
878 v->UrgBurstFactorChromaPre[k]);
879
880 dml_print("DML::%s: k=%0d VRatioPrefetchY=%f\n", __func__, k, v->VRatioPrefetchY[k]);
881 dml_print("DML::%s: k=%0d VRatioY=%f\n", __func__, k, mode_lib->vba.VRatio[k]);
882
883 dml_print("DML::%s: k=%0d prefetch_vmrow_bw=%f\n", __func__, k, v->prefetch_vmrow_bw[k]);
884 dml_print("DML::%s: k=%0d ReadBandwidthSurfaceLuma=%f\n", __func__, k,
885 v->ReadBandwidthSurfaceLuma[k]);
886 dml_print("DML::%s: k=%0d ReadBandwidthSurfaceChroma=%f\n", __func__, k,
887 v->ReadBandwidthSurfaceChroma[k]);
888 dml_print("DML::%s: k=%0d cursor_bw=%f\n", __func__, k, v->cursor_bw[k]);
889 dml_print("DML::%s: k=%0d meta_row_bw=%f\n", __func__, k, v->meta_row_bw[k]);
890 dml_print("DML::%s: k=%0d dpte_row_bw=%f\n", __func__, k, v->dpte_row_bw[k]);
891 dml_print("DML::%s: k=%0d RequiredPrefetchPixDataBWLuma=%f\n", __func__, k,
892 v->RequiredPrefetchPixDataBWLuma[k]);
893 dml_print("DML::%s: k=%0d RequiredPrefetchPixDataBWChroma=%f\n", __func__, k,
894 v->RequiredPrefetchPixDataBWChroma[k]);
895 dml_print("DML::%s: k=%0d cursor_bw_pre=%f\n", __func__, k, v->cursor_bw_pre[k]);
896 dml_print("DML::%s: k=%0d MaxTotalRDBandwidthNoUrgentBurst=%f\n", __func__, k,
897 MaxTotalRDBandwidthNoUrgentBurst);
898#endif
899 if (v->DestinationLinesForPrefetch[k] < 2)
900 DestinationLineTimesForPrefetchLessThan2 = true;
901
902 if (v->VRatioPrefetchY[k] > v->MaxVRatioPre
903 || v->VRatioPrefetchC[k] > v->MaxVRatioPre)
904 VRatioPrefetchMoreThanMax = true;
905
906 //bool DestinationLinesToRequestVMInVBlankEqualOrMoreThan32 = false;
907 //bool DestinationLinesToRequestRowInVBlankEqualOrMoreThan16 = false;
908 //if (v->DestinationLinesToRequestVMInVBlank[k] >= 32) {
909 // DestinationLinesToRequestVMInVBlankEqualOrMoreThan32 = true;
910 //}
911
912 //if (v->DestinationLinesToRequestRowInVBlank[k] >= 16) {
913 // DestinationLinesToRequestRowInVBlankEqualOrMoreThan16 = true;
914 //}
915 }
916
917 v->FractionOfUrgentBandwidth = MaxTotalRDBandwidthNoUrgentBurst / mode_lib->vba.ReturnBW;
918
919#ifdef __DML_VBA_DEBUG__
920 dml_print("DML::%s: MaxTotalRDBandwidthNoUrgentBurst=%f\n",
921 __func__, MaxTotalRDBandwidthNoUrgentBurst);
922 dml_print("DML::%s: ReturnBW=%f\n", __func__, mode_lib->vba.ReturnBW);
923 dml_print("DML::%s: FractionOfUrgentBandwidth=%f\n",
924 __func__, mode_lib->vba.FractionOfUrgentBandwidth);
925#endif
926
927 {
928 dml32_CalculatePrefetchBandwithSupport(
929 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
930 ReturnBW: mode_lib->vba.ReturnBW,
931 NotUrgentLatencyHiding: v->NoUrgentLatencyHidingPre,
932 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
933 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
934 PrefetchBandwidthLuma: v->RequiredPrefetchPixDataBWLuma,
935 PrefetchBandwidthChroma: v->RequiredPrefetchPixDataBWChroma,
936 cursor_bw: v->cursor_bw,
937 meta_row_bandwidth: v->meta_row_bw,
938 dpte_row_bandwidth: v->dpte_row_bw,
939 cursor_bw_pre: v->cursor_bw_pre,
940 prefetch_vmrow_bw: v->prefetch_vmrow_bw,
941 NumberOfDPP: mode_lib->vba.DPPPerPlane,
942 UrgentBurstFactorLuma: v->UrgBurstFactorLuma,
943 UrgentBurstFactorChroma: v->UrgBurstFactorChroma,
944 UrgentBurstFactorCursor: v->UrgBurstFactorCursor,
945 UrgentBurstFactorLumaPre: v->UrgBurstFactorLumaPre,
946 UrgentBurstFactorChromaPre: v->UrgBurstFactorChromaPre,
947 UrgentBurstFactorCursorPre: v->UrgBurstFactorCursorPre,
948 PrefetchBW: v->PrefetchBandwidth,
949 VRatio: v->VRatio,
950 MaxVRatioPre: v->MaxVRatioPre,
951
952 /* output */
953 MaxPrefetchBandwidth: &MaxTotalRDBandwidth,
954 FractionOfUrgentBandwidth: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_single[0],
955 PrefetchBandwidthSupport: &v->PrefetchModeSupported);
956 }
957
958 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
959 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector[k] = 1.0;
960
961 {
962 dml32_CalculatePrefetchBandwithSupport(NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
963 ReturnBW: mode_lib->vba.ReturnBW,
964 NotUrgentLatencyHiding: v->NoUrgentLatencyHidingPre,
965 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
966 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
967 PrefetchBandwidthLuma: v->RequiredPrefetchPixDataBWLuma,
968 PrefetchBandwidthChroma: v->RequiredPrefetchPixDataBWChroma,
969 cursor_bw: v->cursor_bw,
970 meta_row_bandwidth: v->meta_row_bw,
971 dpte_row_bandwidth: v->dpte_row_bw,
972 cursor_bw_pre: v->cursor_bw_pre,
973 prefetch_vmrow_bw: v->prefetch_vmrow_bw,
974 NumberOfDPP: mode_lib->vba.DPPPerPlane,
975 UrgentBurstFactorLuma: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
976 UrgentBurstFactorChroma: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
977 UrgentBurstFactorCursor: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
978 UrgentBurstFactorLumaPre: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
979 UrgentBurstFactorChromaPre: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
980 UrgentBurstFactorCursorPre: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
981 PrefetchBW: v->PrefetchBandwidth,
982 VRatio: v->VRatio,
983 MaxVRatioPre: v->MaxVRatioPre,
984
985 /* output */
986 MaxPrefetchBandwidth: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_single[0],
987 FractionOfUrgentBandwidth: &v->FractionOfUrgentBandwidth,
988 PrefetchBandwidthSupport: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_boolean);
989 }
990
991 if (VRatioPrefetchMoreThanMax != false || DestinationLineTimesForPrefetchLessThan2 != false) {
992 v->PrefetchModeSupported = false;
993 }
994
995 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
996 if (v->ErrorResult[k] == true || v->NotEnoughTimeForDynamicMetadata[k]) {
997 v->PrefetchModeSupported = false;
998 }
999 }
1000
1001 if (v->PrefetchModeSupported == true && mode_lib->vba.ImmediateFlipSupport == true) {
1002 mode_lib->vba.BandwidthAvailableForImmediateFlip = dml32_CalculateBandwidthAvailableForImmediateFlip(
1003 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1004 ReturnBW: mode_lib->vba.ReturnBW,
1005 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
1006 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
1007 PrefetchBandwidthLuma: v->RequiredPrefetchPixDataBWLuma,
1008 PrefetchBandwidthChroma: v->RequiredPrefetchPixDataBWChroma,
1009 cursor_bw: v->cursor_bw,
1010 cursor_bw_pre: v->cursor_bw_pre,
1011 NumberOfDPP: mode_lib->vba.DPPPerPlane,
1012 UrgentBurstFactorLuma: v->UrgBurstFactorLuma,
1013 UrgentBurstFactorChroma: v->UrgBurstFactorChroma,
1014 UrgentBurstFactorCursor: v->UrgBurstFactorCursor,
1015 UrgentBurstFactorLumaPre: v->UrgBurstFactorLumaPre,
1016 UrgentBurstFactorChromaPre: v->UrgBurstFactorChromaPre,
1017 UrgentBurstFactorCursorPre: v->UrgBurstFactorCursorPre);
1018
1019 mode_lib->vba.TotImmediateFlipBytes = 0;
1020 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1021 if (mode_lib->vba.ImmediateFlipRequirement[k] != dm_immediate_flip_not_required) {
1022 mode_lib->vba.TotImmediateFlipBytes = mode_lib->vba.TotImmediateFlipBytes
1023 + mode_lib->vba.DPPPerPlane[k]
1024 * (v->PDEAndMetaPTEBytesFrame[k]
1025 + v->MetaRowByte[k]);
1026 if (v->use_one_row_for_frame_flip[k][0][0]) {
1027 mode_lib->vba.TotImmediateFlipBytes =
1028 mode_lib->vba.TotImmediateFlipBytes
1029 + 2 * v->PixelPTEBytesPerRow[k];
1030 } else {
1031 mode_lib->vba.TotImmediateFlipBytes =
1032 mode_lib->vba.TotImmediateFlipBytes
1033 + v->PixelPTEBytesPerRow[k];
1034 }
1035 }
1036 }
1037 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1038 dml32_CalculateFlipSchedule(HostVMInefficiencyFactor: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor,
1039 UrgentExtraLatency: v->UrgentExtraLatency,
1040 UrgentLatency: v->UrgentLatency,
1041 GPUVMMaxPageTableLevels: mode_lib->vba.GPUVMMaxPageTableLevels,
1042 HostVMEnable: mode_lib->vba.HostVMEnable,
1043 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
1044 GPUVMEnable: mode_lib->vba.GPUVMEnable,
1045 HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
1046 PDEAndMetaPTEBytesPerFrame: v->PDEAndMetaPTEBytesFrame[k],
1047 MetaRowBytes: v->MetaRowByte[k],
1048 DPTEBytesPerRow: v->PixelPTEBytesPerRow[k],
1049 BandwidthAvailableForImmediateFlip: mode_lib->vba.BandwidthAvailableForImmediateFlip,
1050 TotImmediateFlipBytes: mode_lib->vba.TotImmediateFlipBytes,
1051 SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k],
1052 LineTime: mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k],
1053 VRatio: mode_lib->vba.VRatio[k],
1054 VRatioChroma: mode_lib->vba.VRatioChroma[k],
1055 Tno_bw: v->Tno_bw[k],
1056 DCCEnable: mode_lib->vba.DCCEnable[k],
1057 dpte_row_height: v->dpte_row_height[k],
1058 meta_row_height: v->meta_row_height[k],
1059 dpte_row_height_chroma: v->dpte_row_height_chroma[k],
1060 meta_row_height_chroma: v->meta_row_height_chroma[k],
1061 use_one_row_for_frame_flip: v->Use_One_Row_For_Frame_Flip[k],
1062
1063 /* Output */
1064 DestinationLinesToRequestVMInImmediateFlip: &v->DestinationLinesToRequestVMInImmediateFlip[k],
1065 DestinationLinesToRequestRowInImmediateFlip: &v->DestinationLinesToRequestRowInImmediateFlip[k],
1066 final_flip_bw: &v->final_flip_bw[k],
1067 ImmediateFlipSupportedForPipe: &v->ImmediateFlipSupportedForPipe[k]);
1068 }
1069
1070 {
1071 dml32_CalculateImmediateFlipBandwithSupport(NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1072 ReturnBW: mode_lib->vba.ReturnBW,
1073 ImmediateFlipRequirement: mode_lib->vba.ImmediateFlipRequirement,
1074 final_flip_bw: v->final_flip_bw,
1075 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
1076 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
1077 PrefetchBandwidthLuma: v->RequiredPrefetchPixDataBWLuma,
1078 PrefetchBandwidthChroma: v->RequiredPrefetchPixDataBWChroma,
1079 cursor_bw: v->cursor_bw,
1080 meta_row_bandwidth: v->meta_row_bw,
1081 dpte_row_bandwidth: v->dpte_row_bw,
1082 cursor_bw_pre: v->cursor_bw_pre,
1083 prefetch_vmrow_bw: v->prefetch_vmrow_bw,
1084 NumberOfDPP: mode_lib->vba.DPPPerPlane,
1085 UrgentBurstFactorLuma: v->UrgBurstFactorLuma,
1086 UrgentBurstFactorChroma: v->UrgBurstFactorChroma,
1087 UrgentBurstFactorCursor: v->UrgBurstFactorCursor,
1088 UrgentBurstFactorLumaPre: v->UrgBurstFactorLumaPre,
1089 UrgentBurstFactorChromaPre: v->UrgBurstFactorChromaPre,
1090 UrgentBurstFactorCursorPre: v->UrgBurstFactorCursorPre,
1091
1092 /* output */
1093 TotalBandwidth: &v->total_dcn_read_bw_with_flip, // Single *TotalBandwidth
1094 FractionOfUrgentBandwidth: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_single[0], // Single *FractionOfUrgentBandwidth
1095 ImmediateFlipBandwidthSupport: &v->ImmediateFlipSupported); // Boolean *ImmediateFlipBandwidthSupport
1096
1097 dml32_CalculateImmediateFlipBandwithSupport(NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1098 ReturnBW: mode_lib->vba.ReturnBW,
1099 ImmediateFlipRequirement: mode_lib->vba.ImmediateFlipRequirement,
1100 final_flip_bw: v->final_flip_bw,
1101 ReadBandwidthLuma: v->ReadBandwidthSurfaceLuma,
1102 ReadBandwidthChroma: v->ReadBandwidthSurfaceChroma,
1103 PrefetchBandwidthLuma: v->RequiredPrefetchPixDataBWLuma,
1104 PrefetchBandwidthChroma: v->RequiredPrefetchPixDataBWChroma,
1105 cursor_bw: v->cursor_bw,
1106 meta_row_bandwidth: v->meta_row_bw,
1107 dpte_row_bandwidth: v->dpte_row_bw,
1108 cursor_bw_pre: v->cursor_bw_pre,
1109 prefetch_vmrow_bw: v->prefetch_vmrow_bw,
1110 NumberOfDPP: mode_lib->vba.DPPPerPlane,
1111 UrgentBurstFactorLuma: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
1112 UrgentBurstFactorChroma: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
1113 UrgentBurstFactorCursor: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
1114 UrgentBurstFactorLumaPre: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
1115 UrgentBurstFactorChromaPre: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
1116 UrgentBurstFactorCursorPre: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_unit_vector,
1117
1118 /* output */
1119 TotalBandwidth: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_single[1], // Single *TotalBandwidth
1120 FractionOfUrgentBandwidth: &v->FractionOfUrgentBandwidthImmediateFlip, // Single *FractionOfUrgentBandwidth
1121 ImmediateFlipBandwidthSupport: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_boolean); // Boolean *ImmediateFlipBandwidthSupport
1122 }
1123
1124 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1125 if (mode_lib->vba.ImmediateFlipRequirement[k] != dm_immediate_flip_not_required && v->ImmediateFlipSupportedForPipe[k] == false) {
1126 v->ImmediateFlipSupported = false;
1127#ifdef __DML_VBA_DEBUG__
1128 dml_print("DML::%s: Pipe %0d not supporting iflip\n", __func__, k);
1129#endif
1130 }
1131 }
1132 } else {
1133 v->ImmediateFlipSupported = false;
1134 }
1135
1136 /* consider flip support is okay if the flip bw is ok or (when user does't require a iflip and there is no host vm) */
1137 v->PrefetchAndImmediateFlipSupported = (v->PrefetchModeSupported == true &&
1138 ((!mode_lib->vba.ImmediateFlipSupport && !mode_lib->vba.HostVMEnable && !ImmediateFlipRequirementFinal) ||
1139 v->ImmediateFlipSupported)) ? true : false;
1140
1141#ifdef __DML_VBA_DEBUG__
1142 dml_print("DML::%s: PrefetchModeSupported = %d\n", __func__, locals->PrefetchModeSupported);
1143 for (uint k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
1144 dml_print("DML::%s: ImmediateFlipRequirement[%d] = %d\n", __func__, k, mode_lib->vba.ImmediateFlipRequirement[k] == dm_immediate_flip_required);
1145 dml_print("DML::%s: ImmediateFlipSupported = %d\n", __func__, locals->ImmediateFlipSupported);
1146 dml_print("DML::%s: ImmediateFlipSupport = %d\n", __func__, mode_lib->vba.ImmediateFlipSupport);
1147 dml_print("DML::%s: HostVMEnable = %d\n", __func__, mode_lib->vba.HostVMEnable);
1148 dml_print("DML::%s: PrefetchAndImmediateFlipSupported = %d\n", __func__, locals->PrefetchAndImmediateFlipSupported);
1149 dml_print("DML::%s: Done loop: Vstartup=%d, Max Vstartup=%d\n", __func__, locals->VStartupLines, locals->MaximumMaxVStartupLines);
1150#endif
1151
1152 v->VStartupLines = v->VStartupLines + 1;
1153
1154 if (v->VStartupLines > v->MaximumMaxVStartupLines) {
1155#ifdef __DML_VBA_DEBUG__
1156 dml_print("DML::%s: Vstartup exceeds max vstartup, exiting loop\n", __func__);
1157#endif
1158 break; // VBA_DELTA: Implementation divergence! Gabe is *still* iterating across prefetch modes which we don't care to do
1159 }
1160 iteration++;
1161 if (iteration > 2500) {
1162#ifdef __DML_VBA_DEBUG__
1163 dml_print("DML::%s: too many errors, exit now\n", __func__);
1164 assert(0);
1165#endif
1166 }
1167 } while (!(v->PrefetchAndImmediateFlipSupported || NextPrefetchMode > mode_lib->vba.MaxPrefetchMode));
1168
1169
1170 if (v->VStartupLines <= v->MaximumMaxVStartupLines) {
1171#ifdef __DML_VBA_DEBUG__
1172 dml_print("DML::%s: Good, Prefetch and flip scheduling found solution at VStartupLines=%d\n", __func__, locals->VStartupLines-1);
1173#endif
1174 }
1175
1176
1177 //Watermarks and NB P-State/DRAM Clock Change Support
1178 {
1179 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.UrgentLatency = v->UrgentLatency;
1180 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.ExtraLatency = v->UrgentExtraLatency;
1181 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.WritebackLatency = mode_lib->vba.WritebackLatency;
1182 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.DRAMClockChangeLatency = mode_lib->vba.DRAMClockChangeLatency;
1183 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.FCLKChangeLatency = mode_lib->vba.FCLKChangeLatency;
1184 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SRExitTime = mode_lib->vba.SRExitTime;
1185 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SREnterPlusExitTime = mode_lib->vba.SREnterPlusExitTime;
1186 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SRExitZ8Time = mode_lib->vba.SRExitZ8Time;
1187 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SREnterPlusExitZ8Time = mode_lib->vba.SREnterPlusExitZ8Time;
1188 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.USRRetrainingLatency = mode_lib->vba.USRRetrainingLatency;
1189 v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SMNLatency = mode_lib->vba.SMNLatency;
1190
1191 dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
1192 v,
1193 PrefetchMode: v->PrefetchModePerState[v->VoltageLevel][v->maxMpcComb],
1194 DCFCLK: v->DCFCLK,
1195 ReturnBW: v->ReturnBW,
1196 mmSOCParameters: v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters,
1197 SOCCLK: v->SOCCLK,
1198 DCFClkDeepSleep: v->DCFCLKDeepSleep,
1199 DETBufferSizeY: v->DETBufferSizeY,
1200 DETBufferSizeC: v->DETBufferSizeC,
1201 SwathHeightY: v->SwathHeightY,
1202 SwathHeightC: v->SwathHeightC,
1203 SwathWidthY: v->SwathWidthY,
1204 SwathWidthC: v->SwathWidthC,
1205 DPPPerSurface: v->DPPPerPlane,
1206 BytePerPixelDETY: v->BytePerPixelDETY,
1207 BytePerPixelDETC: v->BytePerPixelDETC,
1208 DSTXAfterScaler: v->DSTXAfterScaler,
1209 DSTYAfterScaler: v->DSTYAfterScaler,
1210 UnboundedRequestEnabled: v->UnboundedRequestEnabled,
1211 CompressedBufferSizeInkByte: v->CompressedBufferSizeInkByte,
1212
1213 /* Output */
1214 DRAMClockChangeSupport: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_dramchange_support,
1215 MaxActiveDRAMClockChangeLatencySupported: v->MaxActiveDRAMClockChangeLatencySupported,
1216 SubViewportLinesNeededInMALL: v->SubViewportLinesNeededInMALL,
1217 FCLKChangeSupport: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_fclkchange_support,
1218 MinActiveFCLKChangeLatencySupported: &v->MinActiveFCLKChangeLatencySupported,
1219 USRRetrainingSupport: &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_USRRetrainingSupport,
1220 ActiveDRAMClockChangeLatencyMargin: mode_lib->vba.ActiveDRAMClockChangeLatencyMargin);
1221
1222 /* DCN32 has a new struct Watermarks (typedef) which is used to store
1223 * calculated WM values. Copy over values from struct to vba varaibles
1224 * to ensure that the DCN32 getters return the correct value.
1225 */
1226 v->UrgentWatermark = v->Watermark.UrgentWatermark;
1227 v->WritebackUrgentWatermark = v->Watermark.WritebackUrgentWatermark;
1228 v->DRAMClockChangeWatermark = v->Watermark.DRAMClockChangeWatermark;
1229 v->WritebackDRAMClockChangeWatermark = v->Watermark.WritebackDRAMClockChangeWatermark;
1230 v->StutterExitWatermark = v->Watermark.StutterExitWatermark;
1231 v->StutterEnterPlusExitWatermark = v->Watermark.StutterEnterPlusExitWatermark;
1232 v->Z8StutterExitWatermark = v->Watermark.Z8StutterExitWatermark;
1233 v->Z8StutterEnterPlusExitWatermark = v->Watermark.Z8StutterEnterPlusExitWatermark;
1234
1235 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1236 if (mode_lib->vba.WritebackEnable[k] == true) {
1237 v->WritebackAllowDRAMClockChangeEndPosition[k] = dml_max(a: 0,
1238 b: v->VStartup[k] * mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]
1239 - v->Watermark.WritebackDRAMClockChangeWatermark);
1240 v->WritebackAllowFCLKChangeEndPosition[k] = dml_max(a: 0,
1241 b: v->VStartup[k] * mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]
1242 - v->Watermark.WritebackFCLKChangeWatermark);
1243 } else {
1244 v->WritebackAllowDRAMClockChangeEndPosition[k] = 0;
1245 v->WritebackAllowFCLKChangeEndPosition[k] = 0;
1246 }
1247 }
1248 }
1249
1250 //Display Pipeline Delivery Time in Prefetch, Groups
1251 dml32_CalculatePixelDeliveryTimes(
1252 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1253 VRatio: mode_lib->vba.VRatio,
1254 VRatioChroma: mode_lib->vba.VRatioChroma,
1255 VRatioPrefetchY: v->VRatioPrefetchY,
1256 VRatioPrefetchC: v->VRatioPrefetchC,
1257 swath_width_luma_ub: v->swath_width_luma_ub,
1258 swath_width_chroma_ub: v->swath_width_chroma_ub,
1259 DPPPerSurface: mode_lib->vba.DPPPerPlane,
1260 HRatio: mode_lib->vba.HRatio,
1261 HRatioChroma: mode_lib->vba.HRatioChroma,
1262 PixelClock: mode_lib->vba.PixelClock,
1263 PSCL_THROUGHPUT: v->PSCL_THROUGHPUT_LUMA,
1264 PSCL_THROUGHPUT_CHROMA: v->PSCL_THROUGHPUT_CHROMA,
1265 Dppclk: mode_lib->vba.DPPCLK,
1266 BytePerPixelC: v->BytePerPixelC,
1267 SourceRotation: mode_lib->vba.SourceRotation,
1268 NumberOfCursors: mode_lib->vba.NumberOfCursors,
1269 CursorWidth: mode_lib->vba.CursorWidth,
1270 CursorBPP: mode_lib->vba.CursorBPP,
1271 BlockWidth256BytesY: v->BlockWidth256BytesY,
1272 BlockHeight256BytesY: v->BlockHeight256BytesY,
1273 BlockWidth256BytesC: v->BlockWidth256BytesC,
1274 BlockHeight256BytesC: v->BlockHeight256BytesC,
1275
1276 /* Output */
1277 DisplayPipeLineDeliveryTimeLuma: v->DisplayPipeLineDeliveryTimeLuma,
1278 DisplayPipeLineDeliveryTimeChroma: v->DisplayPipeLineDeliveryTimeChroma,
1279 DisplayPipeLineDeliveryTimeLumaPrefetch: v->DisplayPipeLineDeliveryTimeLumaPrefetch,
1280 DisplayPipeLineDeliveryTimeChromaPrefetch: v->DisplayPipeLineDeliveryTimeChromaPrefetch,
1281 DisplayPipeRequestDeliveryTimeLuma: v->DisplayPipeRequestDeliveryTimeLuma,
1282 DisplayPipeRequestDeliveryTimeChroma: v->DisplayPipeRequestDeliveryTimeChroma,
1283 DisplayPipeRequestDeliveryTimeLumaPrefetch: v->DisplayPipeRequestDeliveryTimeLumaPrefetch,
1284 DisplayPipeRequestDeliveryTimeChromaPrefetch: v->DisplayPipeRequestDeliveryTimeChromaPrefetch,
1285 CursorRequestDeliveryTime: v->CursorRequestDeliveryTime,
1286 CursorRequestDeliveryTimePrefetch: v->CursorRequestDeliveryTimePrefetch);
1287
1288 dml32_CalculateMetaAndPTETimes(use_one_row_for_frame: v->Use_One_Row_For_Frame,
1289 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1290 GPUVMEnable: mode_lib->vba.GPUVMEnable,
1291 MetaChunkSize: mode_lib->vba.MetaChunkSize,
1292 MinMetaChunkSizeBytes: mode_lib->vba.MinMetaChunkSizeBytes,
1293 HTotal: mode_lib->vba.HTotal,
1294 VRatio: mode_lib->vba.VRatio,
1295 VRatioChroma: mode_lib->vba.VRatioChroma,
1296 DestinationLinesToRequestRowInVBlank: v->DestinationLinesToRequestRowInVBlank,
1297 DestinationLinesToRequestRowInImmediateFlip: v->DestinationLinesToRequestRowInImmediateFlip,
1298 DCCEnable: mode_lib->vba.DCCEnable,
1299 PixelClock: mode_lib->vba.PixelClock,
1300 BytePerPixelY: v->BytePerPixelY,
1301 BytePerPixelC: v->BytePerPixelC,
1302 SourceRotation: mode_lib->vba.SourceRotation,
1303 dpte_row_height: v->dpte_row_height,
1304 dpte_row_height_chroma: v->dpte_row_height_chroma,
1305 meta_row_width: v->meta_row_width,
1306 meta_row_width_chroma: v->meta_row_width_chroma,
1307 meta_row_height: v->meta_row_height,
1308 meta_row_height_chroma: v->meta_row_height_chroma,
1309 meta_req_width: v->meta_req_width,
1310 meta_req_width_chroma: v->meta_req_width_chroma,
1311 meta_req_height: v->meta_req_height,
1312 meta_req_height_chroma: v->meta_req_height_chroma,
1313 dpte_group_bytes: v->dpte_group_bytes,
1314 PTERequestSizeY: v->PTERequestSizeY,
1315 PTERequestSizeC: v->PTERequestSizeC,
1316 PixelPTEReqWidthY: v->PixelPTEReqWidthY,
1317 PixelPTEReqHeightY: v->PixelPTEReqHeightY,
1318 PixelPTEReqWidthC: v->PixelPTEReqWidthC,
1319 PixelPTEReqHeightC: v->PixelPTEReqHeightC,
1320 dpte_row_width_luma_ub: v->dpte_row_width_luma_ub,
1321 dpte_row_width_chroma_ub: v->dpte_row_width_chroma_ub,
1322
1323 /* Output */
1324 DST_Y_PER_PTE_ROW_NOM_L: v->DST_Y_PER_PTE_ROW_NOM_L,
1325 DST_Y_PER_PTE_ROW_NOM_C: v->DST_Y_PER_PTE_ROW_NOM_C,
1326 DST_Y_PER_META_ROW_NOM_L: v->DST_Y_PER_META_ROW_NOM_L,
1327 DST_Y_PER_META_ROW_NOM_C: v->DST_Y_PER_META_ROW_NOM_C,
1328 TimePerMetaChunkNominal: v->TimePerMetaChunkNominal,
1329 TimePerChromaMetaChunkNominal: v->TimePerChromaMetaChunkNominal,
1330 TimePerMetaChunkVBlank: v->TimePerMetaChunkVBlank,
1331 TimePerChromaMetaChunkVBlank: v->TimePerChromaMetaChunkVBlank,
1332 TimePerMetaChunkFlip: v->TimePerMetaChunkFlip,
1333 TimePerChromaMetaChunkFlip: v->TimePerChromaMetaChunkFlip,
1334 time_per_pte_group_nom_luma: v->time_per_pte_group_nom_luma,
1335 time_per_pte_group_vblank_luma: v->time_per_pte_group_vblank_luma,
1336 time_per_pte_group_flip_luma: v->time_per_pte_group_flip_luma,
1337 time_per_pte_group_nom_chroma: v->time_per_pte_group_nom_chroma,
1338 time_per_pte_group_vblank_chroma: v->time_per_pte_group_vblank_chroma,
1339 time_per_pte_group_flip_chroma: v->time_per_pte_group_flip_chroma);
1340
1341 dml32_CalculateVMGroupAndRequestTimes(
1342 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1343 GPUVMEnable: mode_lib->vba.GPUVMEnable,
1344 GPUVMMaxPageTableLevels: mode_lib->vba.GPUVMMaxPageTableLevels,
1345 HTotal: mode_lib->vba.HTotal,
1346 BytePerPixelC: v->BytePerPixelC,
1347 DestinationLinesToRequestVMInVBlank: v->DestinationLinesToRequestVMInVBlank,
1348 DestinationLinesToRequestVMInImmediateFlip: v->DestinationLinesToRequestVMInImmediateFlip,
1349 DCCEnable: mode_lib->vba.DCCEnable,
1350 PixelClock: mode_lib->vba.PixelClock,
1351 dpte_row_width_luma_ub: v->dpte_row_width_luma_ub,
1352 dpte_row_width_chroma_ub: v->dpte_row_width_chroma_ub,
1353 vm_group_bytes: v->vm_group_bytes,
1354 dpde0_bytes_per_frame_ub_l: v->dpde0_bytes_per_frame_ub_l,
1355 dpde0_bytes_per_frame_ub_c: v->dpde0_bytes_per_frame_ub_c,
1356 meta_pte_bytes_per_frame_ub_l: v->meta_pte_bytes_per_frame_ub_l,
1357 meta_pte_bytes_per_frame_ub_c: v->meta_pte_bytes_per_frame_ub_c,
1358
1359 /* Output */
1360 TimePerVMGroupVBlank: v->TimePerVMGroupVBlank,
1361 TimePerVMGroupFlip: v->TimePerVMGroupFlip,
1362 TimePerVMRequestVBlank: v->TimePerVMRequestVBlank,
1363 TimePerVMRequestFlip: v->TimePerVMRequestFlip);
1364
1365 // Min TTUVBlank
1366 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1367 if (mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb] == 0) {
1368 v->MinTTUVBlank[k] = dml_max4(a: v->Watermark.DRAMClockChangeWatermark,
1369 b: v->Watermark.FCLKChangeWatermark, c: v->Watermark.StutterEnterPlusExitWatermark,
1370 d: v->Watermark.UrgentWatermark);
1371 } else if (mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb]
1372 == 1) {
1373 v->MinTTUVBlank[k] = dml_max3(a: v->Watermark.FCLKChangeWatermark,
1374 b: v->Watermark.StutterEnterPlusExitWatermark, c: v->Watermark.UrgentWatermark);
1375 } else if (mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb]
1376 == 2) {
1377 v->MinTTUVBlank[k] = dml_max(a: v->Watermark.StutterEnterPlusExitWatermark,
1378 b: v->Watermark.UrgentWatermark);
1379 } else {
1380 v->MinTTUVBlank[k] = v->Watermark.UrgentWatermark;
1381 }
1382 if (!mode_lib->vba.DynamicMetadataEnable[k])
1383 v->MinTTUVBlank[k] = mode_lib->vba.TCalc + v->MinTTUVBlank[k];
1384 }
1385
1386 // DCC Configuration
1387 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1388#ifdef __DML_VBA_DEBUG__
1389 dml_print("DML::%s: Calculate DCC configuration for surface k=%d\n", __func__, k);
1390#endif
1391 dml32_CalculateDCCConfiguration(
1392 DCCEnabled: mode_lib->vba.DCCEnable[k],
1393 DCCProgrammingAssumesScanDirectionUnknown: mode_lib->vba.DCCProgrammingAssumesScanDirectionUnknownFinal,
1394 SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k], SurfaceWidthLuma: mode_lib->vba.SurfaceWidthY[k],
1395 SurfaceWidthChroma: mode_lib->vba.SurfaceWidthC[k],
1396 SurfaceHeightLuma: mode_lib->vba.SurfaceHeightY[k],
1397 SurfaceHeightChroma: mode_lib->vba.SurfaceHeightC[k],
1398 nomDETInKByte: mode_lib->vba.nomDETInKByte,
1399 RequestHeight256ByteLuma: v->BlockHeight256BytesY[k],
1400 RequestHeight256ByteChroma: v->BlockHeight256BytesC[k],
1401 TilingFormat: mode_lib->vba.SurfaceTiling[k],
1402 BytePerPixelY: v->BytePerPixelY[k],
1403 BytePerPixelC: v->BytePerPixelC[k],
1404 BytePerPixelDETY: v->BytePerPixelDETY[k],
1405 BytePerPixelDETC: v->BytePerPixelDETC[k],
1406 SourceRotation: (enum dm_rotation_angle) mode_lib->vba.SourceScan[k],
1407 /* Output */
1408 MaxUncompressedBlockLuma: &v->DCCYMaxUncompressedBlock[k],
1409 MaxUncompressedBlockChroma: &v->DCCCMaxUncompressedBlock[k],
1410 MaxCompressedBlockLuma: &v->DCCYMaxCompressedBlock[k],
1411 MaxCompressedBlockChroma: &v->DCCCMaxCompressedBlock[k],
1412 IndependentBlockLuma: &v->DCCYIndependentBlock[k],
1413 IndependentBlockChroma: &v->DCCCIndependentBlock[k]);
1414 }
1415
1416 // VStartup Adjustment
1417 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1418 bool isInterlaceTiming;
1419 double Tvstartup_margin = (v->MaxVStartupLines[k] - v->VStartup[k]) * mode_lib->vba.HTotal[k]
1420 / mode_lib->vba.PixelClock[k];
1421#ifdef __DML_VBA_DEBUG__
1422 dml_print("DML::%s: k=%d, MinTTUVBlank = %f (before vstartup margin)\n", __func__, k,
1423 v->MinTTUVBlank[k]);
1424#endif
1425
1426 v->MinTTUVBlank[k] = v->MinTTUVBlank[k] + Tvstartup_margin;
1427
1428#ifdef __DML_VBA_DEBUG__
1429 dml_print("DML::%s: k=%d, Tvstartup_margin = %f\n", __func__, k, Tvstartup_margin);
1430 dml_print("DML::%s: k=%d, MaxVStartupLines = %d\n", __func__, k, v->MaxVStartupLines[k]);
1431 dml_print("DML::%s: k=%d, VStartup = %d\n", __func__, k, v->VStartup[k]);
1432 dml_print("DML::%s: k=%d, MinTTUVBlank = %f\n", __func__, k, v->MinTTUVBlank[k]);
1433#endif
1434
1435 v->Tdmdl[k] = v->Tdmdl[k] + Tvstartup_margin;
1436 if (mode_lib->vba.DynamicMetadataEnable[k] && mode_lib->vba.DynamicMetadataVMEnabled)
1437 v->Tdmdl_vm[k] = v->Tdmdl_vm[k] + Tvstartup_margin;
1438
1439 isInterlaceTiming = (mode_lib->vba.Interlace[k] &&
1440 !mode_lib->vba.ProgressiveToInterlaceUnitInOPP);
1441
1442 v->MIN_DST_Y_NEXT_START[k] = ((isInterlaceTiming ? dml_floor(a: (mode_lib->vba.VTotal[k] -
1443 mode_lib->vba.VFrontPorch[k]) / 2.0, granularity: 1.0) :
1444 mode_lib->vba.VTotal[k]) - mode_lib->vba.VFrontPorch[k])
1445 + dml_max(a: 1.0,
1446 b: dml_ceil(a: v->WritebackDelay[mode_lib->vba.VoltageLevel][k]
1447 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]), granularity: 1.0))
1448 + dml_floor(a: 4.0 * v->TSetup[k] / (mode_lib->vba.HTotal[k]
1449 / mode_lib->vba.PixelClock[k]), granularity: 1.0) / 4.0;
1450
1451 v->VStartup[k] = (isInterlaceTiming ? (2 * v->MaxVStartupLines[k]) : v->MaxVStartupLines[k]);
1452
1453 if (((v->VUpdateOffsetPix[k] + v->VUpdateWidthPix[k] + v->VReadyOffsetPix[k])
1454 / mode_lib->vba.HTotal[k]) <= (isInterlaceTiming ? dml_floor(a: (mode_lib->vba.VTotal[k]
1455 - mode_lib->vba.VActive[k] - mode_lib->vba.VFrontPorch[k] - v->VStartup[k]) / 2.0, granularity: 1.0) :
1456 (int) (mode_lib->vba.VTotal[k] - mode_lib->vba.VActive[k]
1457 - mode_lib->vba.VFrontPorch[k] - v->VStartup[k]))) {
1458 v->VREADY_AT_OR_AFTER_VSYNC[k] = true;
1459 } else {
1460 v->VREADY_AT_OR_AFTER_VSYNC[k] = false;
1461 }
1462#ifdef __DML_VBA_DEBUG__
1463 dml_print("DML::%s: k=%d, VStartup = %d (max)\n", __func__, k, v->VStartup[k]);
1464 dml_print("DML::%s: k=%d, VUpdateOffsetPix = %d\n", __func__, k, v->VUpdateOffsetPix[k]);
1465 dml_print("DML::%s: k=%d, VUpdateWidthPix = %d\n", __func__, k, v->VUpdateWidthPix[k]);
1466 dml_print("DML::%s: k=%d, VReadyOffsetPix = %d\n", __func__, k, v->VReadyOffsetPix[k]);
1467 dml_print("DML::%s: k=%d, HTotal = %d\n", __func__, k, mode_lib->vba.HTotal[k]);
1468 dml_print("DML::%s: k=%d, VTotal = %d\n", __func__, k, mode_lib->vba.VTotal[k]);
1469 dml_print("DML::%s: k=%d, VActive = %d\n", __func__, k, mode_lib->vba.VActive[k]);
1470 dml_print("DML::%s: k=%d, VFrontPorch = %d\n", __func__, k, mode_lib->vba.VFrontPorch[k]);
1471 dml_print("DML::%s: k=%d, VStartup = %d\n", __func__, k, v->VStartup[k]);
1472 dml_print("DML::%s: k=%d, TSetup = %f\n", __func__, k, v->TSetup[k]);
1473 dml_print("DML::%s: k=%d, MIN_DST_Y_NEXT_START = %f\n", __func__, k, v->MIN_DST_Y_NEXT_START[k]);
1474 dml_print("DML::%s: k=%d, VREADY_AT_OR_AFTER_VSYNC = %d\n", __func__, k,
1475 v->VREADY_AT_OR_AFTER_VSYNC[k]);
1476#endif
1477 }
1478
1479 {
1480 //Maximum Bandwidth Used
1481 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1482 if (mode_lib->vba.WritebackEnable[k] == true
1483 && mode_lib->vba.WritebackPixelFormat[k] == dm_444_32) {
1484 WRBandwidth = mode_lib->vba.WritebackDestinationWidth[k]
1485 * mode_lib->vba.WritebackDestinationHeight[k]
1486 / (mode_lib->vba.HTotal[k] * mode_lib->vba.WritebackSourceHeight[k]
1487 / mode_lib->vba.PixelClock[k]) * 4;
1488 } else if (mode_lib->vba.WritebackEnable[k] == true) {
1489 WRBandwidth = mode_lib->vba.WritebackDestinationWidth[k]
1490 * mode_lib->vba.WritebackDestinationHeight[k]
1491 / (mode_lib->vba.HTotal[k] * mode_lib->vba.WritebackSourceHeight[k]
1492 / mode_lib->vba.PixelClock[k]) * 8;
1493 }
1494 TotalWRBandwidth = TotalWRBandwidth + WRBandwidth;
1495 }
1496
1497 v->TotalDataReadBandwidth = 0;
1498 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
1499 v->TotalDataReadBandwidth = v->TotalDataReadBandwidth + v->ReadBandwidthSurfaceLuma[k]
1500 + v->ReadBandwidthSurfaceChroma[k];
1501#ifdef __DML_VBA_DEBUG__
1502 dml_print("DML::%s: k=%d, TotalDataReadBandwidth = %f\n",
1503 __func__, k, v->TotalDataReadBandwidth);
1504 dml_print("DML::%s: k=%d, ReadBandwidthSurfaceLuma = %f\n",
1505 __func__, k, v->ReadBandwidthSurfaceLuma[k]);
1506 dml_print("DML::%s: k=%d, ReadBandwidthSurfaceChroma = %f\n",
1507 __func__, k, v->ReadBandwidthSurfaceChroma[k]);
1508#endif
1509 }
1510 }
1511
1512 // Stutter Efficiency
1513 dml32_CalculateStutterEfficiency(CompressedBufferSizeInkByte: v->CompressedBufferSizeInkByte,
1514 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
1515 UnboundedRequestEnabled: v->UnboundedRequestEnabled,
1516 MetaFIFOSizeInKEntries: mode_lib->vba.MetaFIFOSizeInKEntries,
1517 ZeroSizeBufferEntries: mode_lib->vba.ZeroSizeBufferEntries,
1518 PixelChunkSizeInKByte: mode_lib->vba.PixelChunkSizeInKByte,
1519 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1520 ROBBufferSizeInKByte: mode_lib->vba.ROBBufferSizeInKByte,
1521 TotalDataReadBandwidth: v->TotalDataReadBandwidth,
1522 DCFCLK: mode_lib->vba.DCFCLK,
1523 ReturnBW: mode_lib->vba.ReturnBW,
1524 CompbufReservedSpace64B: v->CompbufReservedSpace64B,
1525 CompbufReservedSpaceZs: v->CompbufReservedSpaceZs,
1526 SRExitTime: mode_lib->vba.SRExitTime,
1527 SRExitZ8Time: mode_lib->vba.SRExitZ8Time,
1528 SynchronizeTimingsFinal: mode_lib->vba.SynchronizeTimingsFinal,
1529 BlendingAndTiming: mode_lib->vba.BlendingAndTiming,
1530 StutterEnterPlusExitWatermark: v->Watermark.StutterEnterPlusExitWatermark,
1531 Z8StutterEnterPlusExitWatermark: v->Watermark.Z8StutterEnterPlusExitWatermark,
1532 ProgressiveToInterlaceUnitInOPP: mode_lib->vba.ProgressiveToInterlaceUnitInOPP,
1533 Interlace: mode_lib->vba.Interlace,
1534 MinTTUVBlank: v->MinTTUVBlank, DPPPerSurface: mode_lib->vba.DPPPerPlane,
1535 DETBufferSizeY: mode_lib->vba.DETBufferSizeY,
1536 BytePerPixelY: v->BytePerPixelY,
1537 BytePerPixelDETY: v->BytePerPixelDETY,
1538 SwathWidthY: v->SwathWidthY,
1539 SwathHeightY: mode_lib->vba.SwathHeightY,
1540 SwathHeightC: mode_lib->vba.SwathHeightC,
1541 NetDCCRateLuma: mode_lib->vba.DCCRateLuma,
1542 NetDCCRateChroma: mode_lib->vba.DCCRateChroma,
1543 DCCFractionOfZeroSizeRequestsLuma: mode_lib->vba.DCCFractionOfZeroSizeRequestsLuma,
1544 DCCFractionOfZeroSizeRequestsChroma: mode_lib->vba.DCCFractionOfZeroSizeRequestsChroma,
1545 HTotal: mode_lib->vba.HTotal, VTotal: mode_lib->vba.VTotal,
1546 PixelClock: mode_lib->vba.PixelClock,
1547 VRatio: mode_lib->vba.VRatio,
1548 SourceRotation: mode_lib->vba.SourceRotation,
1549 BlockHeight256BytesY: v->BlockHeight256BytesY,
1550 BlockWidth256BytesY: v->BlockWidth256BytesY,
1551 BlockHeight256BytesC: v->BlockHeight256BytesC,
1552 BlockWidth256BytesC: v->BlockWidth256BytesC,
1553 DCCYMaxUncompressedBlock: v->DCCYMaxUncompressedBlock,
1554 DCCCMaxUncompressedBlock: v->DCCCMaxUncompressedBlock,
1555 VActive: mode_lib->vba.VActive,
1556 DCCEnable: mode_lib->vba.DCCEnable,
1557 WritebackEnable: mode_lib->vba.WritebackEnable,
1558 ReadBandwidthSurfaceLuma: v->ReadBandwidthSurfaceLuma,
1559 ReadBandwidthSurfaceChroma: v->ReadBandwidthSurfaceChroma,
1560 meta_row_bw: v->meta_row_bw,
1561 dpte_row_bw: v->dpte_row_bw,
1562 /* Output */
1563 StutterEfficiencyNotIncludingVBlank: &v->StutterEfficiencyNotIncludingVBlank,
1564 StutterEfficiency: &v->StutterEfficiency,
1565 NumberOfStutterBurstsPerFrame: &v->NumberOfStutterBurstsPerFrame,
1566 Z8StutterEfficiencyNotIncludingVBlank: &v->Z8StutterEfficiencyNotIncludingVBlank,
1567 Z8StutterEfficiency: &v->Z8StutterEfficiency,
1568 Z8NumberOfStutterBurstsPerFrame: &v->Z8NumberOfStutterBurstsPerFrame,
1569 StutterPeriod: &v->StutterPeriod,
1570 DCHUBBUB_ARB_CSTATE_MAX_CAP_MODE: &v->DCHUBBUB_ARB_CSTATE_MAX_CAP_MODE);
1571
1572#ifdef __DML_VBA_ALLOW_DELTA__
1573 {
1574 unsigned int dummy_integer[1];
1575
1576 // Calculate z8 stutter eff assuming 0 reserved space
1577 dml32_CalculateStutterEfficiency(v->CompressedBufferSizeInkByte,
1578 mode_lib->vba.UsesMALLForPStateChange,
1579 v->UnboundedRequestEnabled,
1580 mode_lib->vba.MetaFIFOSizeInKEntries,
1581 mode_lib->vba.ZeroSizeBufferEntries,
1582 mode_lib->vba.PixelChunkSizeInKByte,
1583 mode_lib->vba.NumberOfActiveSurfaces,
1584 mode_lib->vba.ROBBufferSizeInKByte,
1585 v->TotalDataReadBandwidth,
1586 mode_lib->vba.DCFCLK,
1587 mode_lib->vba.ReturnBW,
1588 0, //CompbufReservedSpace64B,
1589 0, //CompbufReservedSpaceZs,
1590 mode_lib->vba.SRExitTime,
1591 mode_lib->vba.SRExitZ8Time,
1592 mode_lib->vba.SynchronizeTimingsFinal,
1593 mode_lib->vba.BlendingAndTiming,
1594 v->Watermark.StutterEnterPlusExitWatermark,
1595 v->Watermark.Z8StutterEnterPlusExitWatermark,
1596 mode_lib->vba.ProgressiveToInterlaceUnitInOPP,
1597 mode_lib->vba.Interlace,
1598 v->MinTTUVBlank,
1599 mode_lib->vba.DPPPerPlane,
1600 mode_lib->vba.DETBufferSizeY,
1601 v->BytePerPixelY, v->BytePerPixelDETY,
1602 v->SwathWidthY, mode_lib->vba.SwathHeightY,
1603 mode_lib->vba.SwathHeightC,
1604 mode_lib->vba.DCCRateLuma,
1605 mode_lib->vba.DCCRateChroma,
1606 mode_lib->vba.DCCFractionOfZeroSizeRequestsLuma,
1607 mode_lib->vba.DCCFractionOfZeroSizeRequestsChroma,
1608 mode_lib->vba.HTotal,
1609 mode_lib->vba.VTotal,
1610 mode_lib->vba.PixelClock,
1611 mode_lib->vba.VRatio,
1612 mode_lib->vba.SourceRotation,
1613 v->BlockHeight256BytesY,
1614 v->BlockWidth256BytesY,
1615 v->BlockHeight256BytesC,
1616 v->BlockWidth256BytesC,
1617 v->DCCYMaxUncompressedBlock,
1618 v->DCCCMaxUncompressedBlock,
1619 mode_lib->vba.VActive,
1620 mode_lib->vba.DCCEnable,
1621 mode_lib->vba.WritebackEnable,
1622 v->ReadBandwidthSurfaceLuma,
1623 v->ReadBandwidthSurfaceChroma,
1624 v->meta_row_bw, v->dpte_row_bw,
1625
1626 /* Output */
1627 &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_single[0],
1628 &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_single[1],
1629 &dummy_integer[0],
1630 &v->Z8StutterEfficiencyNotIncludingVBlankBestCase,
1631 &v->Z8StutterEfficiencyBestCase,
1632 &v->Z8NumberOfStutterBurstsPerFrameBestCase,
1633 &v->StutterPeriodBestCase,
1634 &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_boolean);
1635 }
1636#else
1637 v->Z8StutterEfficiencyNotIncludingVBlankBestCase = v->Z8StutterEfficiencyNotIncludingVBlank;
1638 v->Z8StutterEfficiencyBestCase = v->Z8StutterEfficiency;
1639 v->Z8NumberOfStutterBurstsPerFrameBestCase = v->Z8NumberOfStutterBurstsPerFrame;
1640 v->StutterPeriodBestCase = v->StutterPeriod;
1641#endif
1642
1643#ifdef __DML_VBA_DEBUG__
1644 dml_print("DML::%s: --- END ---\n", __func__);
1645#endif
1646}
1647
1648static void mode_support_configuration(struct vba_vars_st *v,
1649 struct display_mode_lib *mode_lib)
1650{
1651 int i, j, start_state;
1652
1653 if (mode_lib->validate_max_state)
1654 start_state = v->soc.num_states - 1;
1655 else
1656 start_state = 0;
1657
1658 for (i = v->soc.num_states - 1; i >= start_state; i--) {
1659 for (j = 0; j < 2; j++) {
1660 if (mode_lib->vba.ScaleRatioAndTapsSupport == true
1661 && mode_lib->vba.SourceFormatPixelAndScanSupport == true
1662 && mode_lib->vba.ViewportSizeSupport[i][j] == true
1663 && !mode_lib->vba.LinkRateDoesNotMatchDPVersion
1664 && !mode_lib->vba.LinkRateForMultistreamNotIndicated
1665 && !mode_lib->vba.BPPForMultistreamNotIndicated
1666 && !mode_lib->vba.MultistreamWithHDMIOreDP
1667 && !mode_lib->vba.ExceededMultistreamSlots[i]
1668 && !mode_lib->vba.MSOOrODMSplitWithNonDPLink
1669 && !mode_lib->vba.NotEnoughLanesForMSO
1670 && mode_lib->vba.LinkCapacitySupport[i] == true && !mode_lib->vba.P2IWith420
1671 //&& !mode_lib->vba.DSCOnlyIfNecessaryWithBPP
1672 && !mode_lib->vba.DSC422NativeNotSupported
1673 && !mode_lib->vba.MPCCombineMethodIncompatible
1674 && mode_lib->vba.ODMCombine2To1SupportCheckOK[i] == true
1675 && mode_lib->vba.ODMCombine4To1SupportCheckOK[i] == true
1676 && mode_lib->vba.NotEnoughDSCUnits[i] == false
1677 && !mode_lib->vba.NotEnoughDSCSlices[i]
1678 && !mode_lib->vba.ImmediateFlipOrHostVMAndPStateWithMALLFullFrameOrPhantomPipe
1679 && !mode_lib->vba.InvalidCombinationOfMALLUseForPStateAndStaticScreen
1680 && mode_lib->vba.DSCCLKRequiredMoreThanSupported[i] == false
1681 && mode_lib->vba.PixelsPerLinePerDSCUnitSupport[i]
1682 && mode_lib->vba.DTBCLKRequiredMoreThanSupported[i] == false
1683 && !mode_lib->vba.InvalidCombinationOfMALLUseForPState
1684 && !mode_lib->vba.ImmediateFlipRequiredButTheRequirementForEachSurfaceIsNotSpecified
1685 && mode_lib->vba.ROBSupport[i][j] == true
1686 && mode_lib->vba.DISPCLK_DPPCLK_Support[i][j] == true
1687 && mode_lib->vba.TotalAvailablePipesSupport[i][j] == true
1688 && mode_lib->vba.NumberOfOTGSupport == true
1689 && mode_lib->vba.NumberOfHDMIFRLSupport == true
1690 && mode_lib->vba.EnoughWritebackUnits == true
1691 && mode_lib->vba.WritebackLatencySupport == true
1692 && mode_lib->vba.WritebackScaleRatioAndTapsSupport == true
1693 && mode_lib->vba.CursorSupport == true && mode_lib->vba.PitchSupport == true
1694 && mode_lib->vba.ViewportExceedsSurface == false
1695 && mode_lib->vba.PrefetchSupported[i][j] == true
1696 && mode_lib->vba.VActiveBandwithSupport[i][j] == true
1697 && mode_lib->vba.DynamicMetadataSupported[i][j] == true
1698 && mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][j] == true
1699 && mode_lib->vba.VRatioInPrefetchSupported[i][j] == true
1700 && mode_lib->vba.PTEBufferSizeNotExceeded[i][j] == true
1701 && mode_lib->vba.DCCMetaBufferSizeNotExceeded[i][j] == true
1702 && mode_lib->vba.NonsupportedDSCInputBPC == false
1703 && !mode_lib->vba.ExceededMALLSize
1704 && (mode_lib->vba.NotEnoughDETSwathFillLatencyHidingPerState[i][j] == false
1705 || i == v->soc.num_states - 1)
1706 && ((mode_lib->vba.HostVMEnable == false
1707 && !mode_lib->vba.ImmediateFlipRequiredFinal)
1708 || mode_lib->vba.ImmediateFlipSupportedForState[i][j])
1709 && (!mode_lib->vba.DRAMClockChangeRequirementFinal
1710 || i == v->soc.num_states - 1
1711 || mode_lib->vba.DRAMClockChangeSupport[i][j] != dm_dram_clock_change_unsupported)
1712 && (!mode_lib->vba.FCLKChangeRequirementFinal || i == v->soc.num_states - 1
1713 || mode_lib->vba.FCLKChangeSupport[i][j] != dm_fclock_change_unsupported)
1714 && (!mode_lib->vba.USRRetrainingRequiredFinal
1715 || mode_lib->vba.USRRetrainingSupport[i][j])) {
1716 mode_lib->vba.ModeSupport[i][j] = true;
1717 } else {
1718 mode_lib->vba.ModeSupport[i][j] = false;
1719 }
1720 }
1721 }
1722}
1723
1724void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
1725{
1726 struct vba_vars_st *v = &mode_lib->vba;
1727 int i, j, start_state;
1728 unsigned int k, m;
1729 unsigned int MaximumMPCCombine;
1730 unsigned int NumberOfNonCombinedSurfaceOfMaximumBandwidth;
1731 unsigned int TotalSlots;
1732 bool CompBufReservedSpaceNeedAdjustment;
1733 bool CompBufReservedSpaceNeedAdjustmentSingleDPP;
1734
1735#ifdef __DML_VBA_DEBUG__
1736 dml_print("DML::%s: called\n", __func__);
1737#endif
1738
1739 /*MODE SUPPORT, VOLTAGE STATE AND SOC CONFIGURATION*/
1740 if (mode_lib->validate_max_state)
1741 start_state = v->soc.num_states - 1;
1742 else
1743 start_state = 0;
1744
1745 /*Scale Ratio, taps Support Check*/
1746
1747 mode_lib->vba.ScaleRatioAndTapsSupport = true;
1748 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1749 if (mode_lib->vba.ScalerEnabled[k] == false
1750 && ((mode_lib->vba.SourcePixelFormat[k] != dm_444_64
1751 && mode_lib->vba.SourcePixelFormat[k] != dm_444_32
1752 && mode_lib->vba.SourcePixelFormat[k] != dm_444_16
1753 && mode_lib->vba.SourcePixelFormat[k] != dm_mono_16
1754 && mode_lib->vba.SourcePixelFormat[k] != dm_mono_8
1755 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe
1756 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe_alpha)
1757 || mode_lib->vba.HRatio[k] != 1.0 || mode_lib->vba.htaps[k] != 1.0
1758 || mode_lib->vba.VRatio[k] != 1.0 || mode_lib->vba.vtaps[k] != 1.0)) {
1759 mode_lib->vba.ScaleRatioAndTapsSupport = false;
1760 } else if (mode_lib->vba.vtaps[k] < 1.0 || mode_lib->vba.vtaps[k] > 8.0 || mode_lib->vba.htaps[k] < 1.0
1761 || mode_lib->vba.htaps[k] > 8.0
1762 || (mode_lib->vba.htaps[k] > 1.0 && (mode_lib->vba.htaps[k] % 2) == 1)
1763 || mode_lib->vba.HRatio[k] > mode_lib->vba.MaxHSCLRatio
1764 || mode_lib->vba.VRatio[k] > mode_lib->vba.MaxVSCLRatio
1765 || mode_lib->vba.HRatio[k] > mode_lib->vba.htaps[k]
1766 || mode_lib->vba.VRatio[k] > mode_lib->vba.vtaps[k]
1767 || (mode_lib->vba.SourcePixelFormat[k] != dm_444_64
1768 && mode_lib->vba.SourcePixelFormat[k] != dm_444_32
1769 && mode_lib->vba.SourcePixelFormat[k] != dm_444_16
1770 && mode_lib->vba.SourcePixelFormat[k] != dm_mono_16
1771 && mode_lib->vba.SourcePixelFormat[k] != dm_mono_8
1772 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe
1773 && (mode_lib->vba.VTAPsChroma[k] < 1
1774 || mode_lib->vba.VTAPsChroma[k] > 8
1775 || mode_lib->vba.HTAPsChroma[k] < 1
1776 || mode_lib->vba.HTAPsChroma[k] > 8
1777 || (mode_lib->vba.HTAPsChroma[k] > 1
1778 && mode_lib->vba.HTAPsChroma[k] % 2
1779 == 1)
1780 || mode_lib->vba.HRatioChroma[k]
1781 > mode_lib->vba.MaxHSCLRatio
1782 || mode_lib->vba.VRatioChroma[k]
1783 > mode_lib->vba.MaxVSCLRatio
1784 || mode_lib->vba.HRatioChroma[k]
1785 > mode_lib->vba.HTAPsChroma[k]
1786 || mode_lib->vba.VRatioChroma[k]
1787 > mode_lib->vba.VTAPsChroma[k]))) {
1788 mode_lib->vba.ScaleRatioAndTapsSupport = false;
1789 }
1790 }
1791
1792 /*Source Format, Pixel Format and Scan Support Check*/
1793 mode_lib->vba.SourceFormatPixelAndScanSupport = true;
1794 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1795 if (mode_lib->vba.SurfaceTiling[k] == dm_sw_linear
1796 && (!(!IsVertical(Scan: (enum dm_rotation_angle) mode_lib->vba.SourceScan[k]))
1797 || mode_lib->vba.DCCEnable[k] == true)) {
1798 mode_lib->vba.SourceFormatPixelAndScanSupport = false;
1799 }
1800 }
1801
1802 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1803 dml32_CalculateBytePerPixelAndBlockSizes(
1804 SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k],
1805 SurfaceTiling: mode_lib->vba.SurfaceTiling[k],
1806
1807 /* Output */
1808 BytePerPixelY: &mode_lib->vba.BytePerPixelY[k],
1809 BytePerPixelC: &mode_lib->vba.BytePerPixelC[k],
1810 BytePerPixelDETY: &mode_lib->vba.BytePerPixelInDETY[k],
1811 BytePerPixelDETC: &mode_lib->vba.BytePerPixelInDETC[k],
1812 BlockHeight256BytesY: &mode_lib->vba.Read256BlockHeightY[k],
1813 BlockHeight256BytesC: &mode_lib->vba.Read256BlockHeightC[k],
1814 BlockWidth256BytesY: &mode_lib->vba.Read256BlockWidthY[k],
1815 BlockWidth256BytesC: &mode_lib->vba.Read256BlockWidthC[k],
1816 MacroTileHeightY: &mode_lib->vba.MacroTileHeightY[k],
1817 MacroTileHeightC: &mode_lib->vba.MacroTileHeightC[k],
1818 MacroTileWidthY: &mode_lib->vba.MacroTileWidthY[k],
1819 MacroTileWidthC: &mode_lib->vba.MacroTileWidthC[k]);
1820 }
1821
1822 /*Bandwidth Support Check*/
1823 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1824 if (!IsVertical(Scan: mode_lib->vba.SourceRotation[k])) {
1825 v->SwathWidthYSingleDPP[k] = mode_lib->vba.ViewportWidth[k];
1826 v->SwathWidthCSingleDPP[k] = mode_lib->vba.ViewportWidthChroma[k];
1827 } else {
1828 v->SwathWidthYSingleDPP[k] = mode_lib->vba.ViewportHeight[k];
1829 v->SwathWidthCSingleDPP[k] = mode_lib->vba.ViewportHeightChroma[k];
1830 }
1831 }
1832 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1833 v->ReadBandwidthLuma[k] = v->SwathWidthYSingleDPP[k] * dml_ceil(a: v->BytePerPixelInDETY[k], granularity: 1.0)
1834 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * mode_lib->vba.VRatio[k];
1835 v->ReadBandwidthChroma[k] = v->SwathWidthYSingleDPP[k] / 2 * dml_ceil(a: v->BytePerPixelInDETC[k], granularity: 2.0)
1836 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * mode_lib->vba.VRatio[k]
1837 / 2.0;
1838 }
1839 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1840 if (mode_lib->vba.WritebackEnable[k] == true && mode_lib->vba.WritebackPixelFormat[k] == dm_444_64) {
1841 v->WriteBandwidth[k] = mode_lib->vba.WritebackDestinationWidth[k]
1842 * mode_lib->vba.WritebackDestinationHeight[k]
1843 / (mode_lib->vba.WritebackSourceHeight[k] * mode_lib->vba.HTotal[k]
1844 / mode_lib->vba.PixelClock[k]) * 8.0;
1845 } else if (mode_lib->vba.WritebackEnable[k] == true) {
1846 v->WriteBandwidth[k] = mode_lib->vba.WritebackDestinationWidth[k]
1847 * mode_lib->vba.WritebackDestinationHeight[k]
1848 / (mode_lib->vba.WritebackSourceHeight[k] * mode_lib->vba.HTotal[k]
1849 / mode_lib->vba.PixelClock[k]) * 4.0;
1850 } else {
1851 v->WriteBandwidth[k] = 0.0;
1852 }
1853 }
1854
1855 /*Writeback Latency support check*/
1856
1857 mode_lib->vba.WritebackLatencySupport = true;
1858 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1859 if (mode_lib->vba.WritebackEnable[k] == true
1860 && (v->WriteBandwidth[k]
1861 > mode_lib->vba.WritebackInterfaceBufferSize * 1024
1862 / mode_lib->vba.WritebackLatency)) {
1863 mode_lib->vba.WritebackLatencySupport = false;
1864 }
1865 }
1866
1867 /*Writeback Mode Support Check*/
1868 mode_lib->vba.EnoughWritebackUnits = true;
1869 mode_lib->vba.TotalNumberOfActiveWriteback = 0;
1870 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1871 if (mode_lib->vba.WritebackEnable[k] == true)
1872 mode_lib->vba.TotalNumberOfActiveWriteback = mode_lib->vba.TotalNumberOfActiveWriteback + 1;
1873 }
1874
1875 if (mode_lib->vba.TotalNumberOfActiveWriteback > mode_lib->vba.MaxNumWriteback)
1876 mode_lib->vba.EnoughWritebackUnits = false;
1877
1878 /*Writeback Scale Ratio and Taps Support Check*/
1879 mode_lib->vba.WritebackScaleRatioAndTapsSupport = true;
1880 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1881 if (mode_lib->vba.WritebackEnable[k] == true) {
1882 if (mode_lib->vba.WritebackHRatio[k] > mode_lib->vba.WritebackMaxHSCLRatio
1883 || mode_lib->vba.WritebackVRatio[k] > mode_lib->vba.WritebackMaxVSCLRatio
1884 || mode_lib->vba.WritebackHRatio[k] < mode_lib->vba.WritebackMinHSCLRatio
1885 || mode_lib->vba.WritebackVRatio[k] < mode_lib->vba.WritebackMinVSCLRatio
1886 || mode_lib->vba.WritebackHTaps[k] > mode_lib->vba.WritebackMaxHSCLTaps
1887 || mode_lib->vba.WritebackVTaps[k] > mode_lib->vba.WritebackMaxVSCLTaps
1888 || mode_lib->vba.WritebackHRatio[k] > mode_lib->vba.WritebackHTaps[k]
1889 || mode_lib->vba.WritebackVRatio[k] > mode_lib->vba.WritebackVTaps[k]
1890 || (mode_lib->vba.WritebackHTaps[k] > 2.0
1891 && ((mode_lib->vba.WritebackHTaps[k] % 2) == 1))) {
1892 mode_lib->vba.WritebackScaleRatioAndTapsSupport = false;
1893 }
1894 if (2.0 * mode_lib->vba.WritebackDestinationWidth[k] * (mode_lib->vba.WritebackVTaps[k] - 1)
1895 * 57 > mode_lib->vba.WritebackLineBufferSize) {
1896 mode_lib->vba.WritebackScaleRatioAndTapsSupport = false;
1897 }
1898 }
1899 }
1900
1901 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1902 dml32_CalculateSinglePipeDPPCLKAndSCLThroughput(HRatio: mode_lib->vba.HRatio[k], HRatioChroma: mode_lib->vba.HRatioChroma[k],
1903 VRatio: mode_lib->vba.VRatio[k], VRatioChroma: mode_lib->vba.VRatioChroma[k],
1904 MaxDCHUBToPSCLThroughput: mode_lib->vba.MaxDCHUBToPSCLThroughput, MaxPSCLToLBThroughput: mode_lib->vba.MaxPSCLToLBThroughput,
1905 PixelClock: mode_lib->vba.PixelClock[k], SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k],
1906 HTaps: mode_lib->vba.htaps[k], HTapsChroma: mode_lib->vba.HTAPsChroma[k], VTaps: mode_lib->vba.vtaps[k],
1907 VTapsChroma: mode_lib->vba.VTAPsChroma[k],
1908 /* Output */
1909 PSCL_THROUGHPUT: &mode_lib->vba.PSCL_FACTOR[k], PSCL_THROUGHPUT_CHROMA: &mode_lib->vba.PSCL_FACTOR_CHROMA[k],
1910 DPPCLKUsingSingleDPP: &mode_lib->vba.MinDPPCLKUsingSingleDPP[k]);
1911 }
1912
1913 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
1914
1915 if (mode_lib->vba.SurfaceTiling[k] == dm_sw_linear) {
1916 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma = 8192;
1917 } else if (!IsVertical(Scan: mode_lib->vba.SourceRotation[k]) && v->BytePerPixelC[k] > 0
1918 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe_alpha) {
1919 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma = 7680;
1920 } else if (IsVertical(Scan: mode_lib->vba.SourceRotation[k]) && v->BytePerPixelC[k] > 0
1921 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe_alpha) {
1922 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma = 4320;
1923 } else if (mode_lib->vba.SourcePixelFormat[k] == dm_rgbe_alpha) {
1924 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma = 3840;
1925 } else if (IsVertical(Scan: mode_lib->vba.SourceRotation[k]) && v->BytePerPixelY[k] == 8 &&
1926 mode_lib->vba.DCCEnable[k] == true) {
1927 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma = 3072;
1928 } else {
1929 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma = 6144;
1930 }
1931
1932 if (mode_lib->vba.SourcePixelFormat[k] == dm_420_8 || mode_lib->vba.SourcePixelFormat[k] == dm_420_10
1933 || mode_lib->vba.SourcePixelFormat[k] == dm_420_12) {
1934 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportChroma = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma / 2.0;
1935 } else {
1936 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportChroma = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma;
1937 }
1938 v->MaximumSwathWidthInLineBufferLuma = mode_lib->vba.LineBufferSizeFinal
1939 * dml_max(a: mode_lib->vba.HRatio[k], b: 1.0) / mode_lib->vba.LBBitPerPixel[k]
1940 / (mode_lib->vba.vtaps[k] + dml_max(a: dml_ceil(a: mode_lib->vba.VRatio[k], granularity: 1.0) - 2, b: 0.0));
1941 if (v->BytePerPixelC[k] == 0.0) {
1942 v->MaximumSwathWidthInLineBufferChroma = 0;
1943 } else {
1944 v->MaximumSwathWidthInLineBufferChroma = mode_lib->vba.LineBufferSizeFinal
1945 * dml_max(a: mode_lib->vba.HRatioChroma[k], b: 1.0) / mode_lib->vba.LBBitPerPixel[k]
1946 / (mode_lib->vba.VTAPsChroma[k]
1947 + dml_max(a: dml_ceil(a: mode_lib->vba.VRatioChroma[k], granularity: 1.0) - 2,
1948 b: 0.0));
1949 }
1950 v->MaximumSwathWidthLuma[k] = dml_min(a: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportLuma,
1951 b: v->MaximumSwathWidthInLineBufferLuma);
1952 v->MaximumSwathWidthChroma[k] = dml_min(a: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaximumSwathWidthSupportChroma,
1953 b: v->MaximumSwathWidthInLineBufferChroma);
1954 }
1955
1956 dml32_CalculateSwathAndDETConfiguration(
1957 DETSizeOverride: mode_lib->vba.DETSizeOverride,
1958 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
1959 ConfigReturnBufferSizeInKByte: mode_lib->vba.ConfigReturnBufferSizeInKByte,
1960 MaxTotalDETInKByte: mode_lib->vba.MaxTotalDETInKByte,
1961 MinCompressedBufferSizeInKByte: mode_lib->vba.MinCompressedBufferSizeInKByte,
1962 ForceSingleDPP: 1, /* ForceSingleDPP */
1963 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
1964 nomDETInKByte: mode_lib->vba.nomDETInKByte,
1965 UseUnboundedRequestingFinal: mode_lib->vba.UseUnboundedRequesting,
1966 DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment: mode_lib->vba.DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment,
1967 PixelChunkSizeKBytes: mode_lib->vba.ip.pixel_chunk_size_kbytes,
1968 ROBSizeKBytes: mode_lib->vba.ip.rob_buffer_size_kbytes,
1969 CompressedBufferSegmentSizeInkByteFinal: mode_lib->vba.CompressedBufferSegmentSizeInkByteFinal,
1970 Output: mode_lib->vba.Output,
1971 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
1972 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
1973 MaximumSwathWidthLuma: mode_lib->vba.MaximumSwathWidthLuma,
1974 MaximumSwathWidthChroma: mode_lib->vba.MaximumSwathWidthChroma,
1975 SourceRotation: mode_lib->vba.SourceRotation,
1976 ViewportStationary: mode_lib->vba.ViewportStationary,
1977 SourcePixelFormat: mode_lib->vba.SourcePixelFormat,
1978 SurfaceTiling: mode_lib->vba.SurfaceTiling,
1979 ViewportWidth: mode_lib->vba.ViewportWidth,
1980 ViewportHeight: mode_lib->vba.ViewportHeight,
1981 ViewportXStart: mode_lib->vba.ViewportXStartY,
1982 ViewportYStart: mode_lib->vba.ViewportYStartY,
1983 ViewportXStartC: mode_lib->vba.ViewportXStartC,
1984 ViewportYStartC: mode_lib->vba.ViewportYStartC,
1985 SurfaceWidthY: mode_lib->vba.SurfaceWidthY,
1986 SurfaceWidthC: mode_lib->vba.SurfaceWidthC,
1987 SurfaceHeightY: mode_lib->vba.SurfaceHeightY,
1988 SurfaceHeightC: mode_lib->vba.SurfaceHeightC,
1989 Read256BytesBlockHeightY: mode_lib->vba.Read256BlockHeightY,
1990 Read256BytesBlockHeightC: mode_lib->vba.Read256BlockHeightC,
1991 Read256BytesBlockWidthY: mode_lib->vba.Read256BlockWidthY,
1992 Read256BytesBlockWidthC: mode_lib->vba.Read256BlockWidthC,
1993 ODMMode: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_odm_mode,
1994 BlendingAndTiming: mode_lib->vba.BlendingAndTiming,
1995 BytePerPixY: mode_lib->vba.BytePerPixelY,
1996 BytePerPixC: mode_lib->vba.BytePerPixelC,
1997 BytePerPixDETY: mode_lib->vba.BytePerPixelInDETY,
1998 BytePerPixDETC: mode_lib->vba.BytePerPixelInDETC,
1999 HActive: mode_lib->vba.HActive,
2000 HRatio: mode_lib->vba.HRatio,
2001 HRatioChroma: mode_lib->vba.HRatioChroma,
2002 DPPPerSurface: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[0], /* Integer DPPPerSurface[] */
2003
2004 /* Output */
2005 swath_width_luma_ub: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[1], /* Long swath_width_luma_ub[] */
2006 swath_width_chroma_ub: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[2], /* Long swath_width_chroma_ub[] */
2007 SwathWidth: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_double_array[0], /* Long SwathWidth[] */
2008 SwathWidthChroma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_double_array[1], /* Long SwathWidthChroma[] */
2009 SwathHeightY: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[3], /* Integer SwathHeightY[] */
2010 SwathHeightC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[4], /* Integer SwathHeightC[] */
2011 DETBufferSizeInKByte: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[5], /* Long DETBufferSizeInKByte[] */
2012 DETBufferSizeY: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[6], /* Long DETBufferSizeY[] */
2013 DETBufferSizeC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[7], /* Long DETBufferSizeC[] */
2014 UnboundedRequestEnabled: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_boolean_array[0][0], /* bool *UnboundedRequestEnabled */
2015 CompressedBufferSizeInkByte: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[0][0], /* Long *CompressedBufferSizeInkByte */
2016 CompBufReservedSpaceKBytes: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[1][0], /* Long *CompBufReservedSpaceKBytes */
2017 CompBufReservedSpaceNeedAdjustment: &CompBufReservedSpaceNeedAdjustmentSingleDPP,
2018 ViewportSizeSupportPerSurface: mode_lib->vba.SingleDPPViewportSizeSupportPerSurface,/* bool ViewportSizeSupportPerSurface[] */
2019 ViewportSizeSupport: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_boolean_array[1][0]); /* bool *ViewportSizeSupport */
2020
2021 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MPCCombineMethodAsNeededForPStateChangeAndVoltage = false;
2022 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MPCCombineMethodAsPossible = false;
2023
2024 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2025 if (mode_lib->vba.MPCCombineUse[k] == dm_mpc_reduce_voltage_and_clocks)
2026 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MPCCombineMethodAsNeededForPStateChangeAndVoltage = true;
2027 if (mode_lib->vba.MPCCombineUse[k] == dm_mpc_always_when_possible)
2028 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MPCCombineMethodAsPossible = true;
2029 }
2030 mode_lib->vba.MPCCombineMethodIncompatible = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MPCCombineMethodAsNeededForPStateChangeAndVoltage
2031 && v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MPCCombineMethodAsPossible;
2032
2033 for (i = start_state; i < v->soc.num_states; i++) {
2034 for (j = 0; j < 2; j++) {
2035 mode_lib->vba.TotalNumberOfActiveDPP[i][j] = 0;
2036 mode_lib->vba.TotalAvailablePipesSupport[i][j] = true;
2037 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeNoDSC = dm_odm_combine_mode_disabled;
2038 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeDSC = dm_odm_combine_mode_disabled;
2039
2040 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2041 dml32_CalculateODMMode(
2042 MaximumPixelsPerLinePerDSCUnit: mode_lib->vba.MaximumPixelsPerLinePerDSCUnit,
2043 HActive: mode_lib->vba.HActive[k],
2044 OutFormat: mode_lib->vba.OutputFormat[k],
2045 Output: mode_lib->vba.Output[k],
2046 ODMUse: mode_lib->vba.ODMUse[k],
2047 StateDispclk: mode_lib->vba.MaxDispclk[i],
2048 MaxDispclk: mode_lib->vba.MaxDispclk[v->soc.num_states - 1],
2049 DSCEnable: false,
2050 TotalNumberOfActiveDPP: mode_lib->vba.TotalNumberOfActiveDPP[i][j],
2051 MaxNumDPP: mode_lib->vba.MaxNumDPP,
2052 PixelClock: mode_lib->vba.PixelClock[k],
2053 DISPCLKDPPCLKDSCCLKDownSpreading: mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading,
2054 DISPCLKRampingMargin: mode_lib->vba.DISPCLKRampingMargin,
2055 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed,
2056 NumberOfDSCSlices: mode_lib->vba.NumberOfDSCSlices[k],
2057
2058 /* Output */
2059 TotalAvailablePipesSupport: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalAvailablePipesSupportNoDSC,
2060 NumberOfDPP: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NumberOfDPPNoDSC,
2061 ODMMode: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeNoDSC,
2062 RequiredDISPCLKPerSurface: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.RequiredDISPCLKPerSurfaceNoDSC);
2063
2064 dml32_CalculateODMMode(
2065 MaximumPixelsPerLinePerDSCUnit: mode_lib->vba.MaximumPixelsPerLinePerDSCUnit,
2066 HActive: mode_lib->vba.HActive[k],
2067 OutFormat: mode_lib->vba.OutputFormat[k],
2068 Output: mode_lib->vba.Output[k],
2069 ODMUse: mode_lib->vba.ODMUse[k],
2070 StateDispclk: mode_lib->vba.MaxDispclk[i],
2071 MaxDispclk: mode_lib->vba.MaxDispclk[v->soc.num_states - 1],
2072 DSCEnable: true,
2073 TotalNumberOfActiveDPP: mode_lib->vba.TotalNumberOfActiveDPP[i][j],
2074 MaxNumDPP: mode_lib->vba.MaxNumDPP,
2075 PixelClock: mode_lib->vba.PixelClock[k],
2076 DISPCLKDPPCLKDSCCLKDownSpreading: mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading,
2077 DISPCLKRampingMargin: mode_lib->vba.DISPCLKRampingMargin,
2078 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed,
2079 NumberOfDSCSlices: mode_lib->vba.NumberOfDSCSlices[k],
2080
2081 /* Output */
2082 TotalAvailablePipesSupport: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalAvailablePipesSupportDSC,
2083 NumberOfDPP: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NumberOfDPPDSC,
2084 ODMMode: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeDSC,
2085 RequiredDISPCLKPerSurface: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.RequiredDISPCLKPerSurfaceDSC);
2086
2087 dml32_CalculateOutputLink(
2088 PHYCLKPerState: mode_lib->vba.PHYCLKPerState[i],
2089 PHYCLKD18PerState: mode_lib->vba.PHYCLKD18PerState[i],
2090 PHYCLKD32PerState: mode_lib->vba.PHYCLKD32PerState[i],
2091 Downspreading: mode_lib->vba.Downspreading,
2092 IsMainSurfaceUsingTheIndicatedTiming: (mode_lib->vba.BlendingAndTiming[k] == k),
2093 Output: mode_lib->vba.Output[k],
2094 OutputFormat: mode_lib->vba.OutputFormat[k],
2095 HTotal: mode_lib->vba.HTotal[k],
2096 HActive: mode_lib->vba.HActive[k],
2097 PixelClockBackEnd: mode_lib->vba.PixelClockBackEnd[k],
2098 ForcedOutputLinkBPP: mode_lib->vba.ForcedOutputLinkBPP[k],
2099 DSCInputBitPerComponent: mode_lib->vba.DSCInputBitPerComponent[k],
2100 NumberOfDSCSlices: mode_lib->vba.NumberOfDSCSlices[k],
2101 AudioSampleRate: mode_lib->vba.AudioSampleRate[k],
2102 AudioSampleLayout: mode_lib->vba.AudioSampleLayout[k],
2103 ODMModeNoDSC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeNoDSC,
2104 ODMModeDSC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeDSC,
2105 DSCEnable: mode_lib->vba.DSCEnable[k],
2106 OutputLinkDPLanes: mode_lib->vba.OutputLinkDPLanes[k],
2107 OutputLinkDPRate: mode_lib->vba.OutputLinkDPRate[k],
2108
2109 /* Output */
2110 RequiresDSC: &mode_lib->vba.RequiresDSC[i][k],
2111 RequiresFEC: &mode_lib->vba.RequiresFEC[i][k],
2112 OutBpp: &mode_lib->vba.OutputBppPerState[i][k],
2113 OutputType: &mode_lib->vba.OutputTypePerState[i][k],
2114 OutputRate: &mode_lib->vba.OutputRatePerState[i][k],
2115 RequiredSlots: &mode_lib->vba.RequiredSlots[i][k]);
2116
2117 if (mode_lib->vba.RequiresDSC[i][k] == false) {
2118 mode_lib->vba.ODMCombineEnablePerState[i][k] = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeNoDSC;
2119 mode_lib->vba.RequiredDISPCLKPerSurface[i][j][k] =
2120 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.RequiredDISPCLKPerSurfaceNoDSC;
2121 if (!v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalAvailablePipesSupportNoDSC)
2122 mode_lib->vba.TotalAvailablePipesSupport[i][j] = false;
2123 mode_lib->vba.TotalNumberOfActiveDPP[i][j] =
2124 mode_lib->vba.TotalNumberOfActiveDPP[i][j] + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NumberOfDPPNoDSC;
2125 } else {
2126 mode_lib->vba.ODMCombineEnablePerState[i][k] = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ODMModeDSC;
2127 mode_lib->vba.RequiredDISPCLKPerSurface[i][j][k] =
2128 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.RequiredDISPCLKPerSurfaceDSC;
2129 if (!v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalAvailablePipesSupportDSC)
2130 mode_lib->vba.TotalAvailablePipesSupport[i][j] = false;
2131 mode_lib->vba.TotalNumberOfActiveDPP[i][j] =
2132 mode_lib->vba.TotalNumberOfActiveDPP[i][j] + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NumberOfDPPDSC;
2133 }
2134 }
2135
2136 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2137 if (mode_lib->vba.ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1) {
2138 mode_lib->vba.MPCCombine[i][j][k] = false;
2139 mode_lib->vba.NoOfDPP[i][j][k] = 4;
2140 } else if (mode_lib->vba.ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1) {
2141 mode_lib->vba.MPCCombine[i][j][k] = false;
2142 mode_lib->vba.NoOfDPP[i][j][k] = 2;
2143 } else if (mode_lib->vba.MPCCombineUse[k] == dm_mpc_never) {
2144 mode_lib->vba.MPCCombine[i][j][k] = false;
2145 mode_lib->vba.NoOfDPP[i][j][k] = 1;
2146 } else if (dml32_RoundToDFSGranularity(
2147 Clock: mode_lib->vba.MinDPPCLKUsingSingleDPP[k]
2148 * (1 + mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading
2149 / 100), round_up: 1,
2150 VCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed) <= mode_lib->vba.MaxDppclk[i] &&
2151 mode_lib->vba.SingleDPPViewportSizeSupportPerSurface[k] == true) {
2152 mode_lib->vba.MPCCombine[i][j][k] = false;
2153 mode_lib->vba.NoOfDPP[i][j][k] = 1;
2154 } else if (mode_lib->vba.TotalNumberOfActiveDPP[i][j] < mode_lib->vba.MaxNumDPP) {
2155 mode_lib->vba.MPCCombine[i][j][k] = true;
2156 mode_lib->vba.NoOfDPP[i][j][k] = 2;
2157 mode_lib->vba.TotalNumberOfActiveDPP[i][j] =
2158 mode_lib->vba.TotalNumberOfActiveDPP[i][j] + 1;
2159 } else {
2160 mode_lib->vba.MPCCombine[i][j][k] = false;
2161 mode_lib->vba.NoOfDPP[i][j][k] = 1;
2162 mode_lib->vba.TotalAvailablePipesSupport[i][j] = false;
2163 }
2164 }
2165
2166 mode_lib->vba.TotalNumberOfSingleDPPSurfaces[i][j] = 0;
2167 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NoChroma = true;
2168
2169 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2170 if (mode_lib->vba.NoOfDPP[i][j][k] == 1)
2171 mode_lib->vba.TotalNumberOfSingleDPPSurfaces[i][j] =
2172 mode_lib->vba.TotalNumberOfSingleDPPSurfaces[i][j] + 1;
2173 if (mode_lib->vba.SourcePixelFormat[k] == dm_420_8
2174 || mode_lib->vba.SourcePixelFormat[k] == dm_420_10
2175 || mode_lib->vba.SourcePixelFormat[k] == dm_420_12
2176 || mode_lib->vba.SourcePixelFormat[k] == dm_rgbe_alpha) {
2177 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NoChroma = false;
2178 }
2179 }
2180
2181 // if TotalNumberOfActiveDPP is > 1, then there should be no unbounded req mode (hw limitation), the comp buf reserved adjustment is not needed regardless
2182 // if TotalNumberOfActiveDPP is == 1, then will use the SingleDPP version of unbounded_req for the decision
2183 CompBufReservedSpaceNeedAdjustment = (mode_lib->vba.TotalNumberOfActiveDPP[i][j] > 1) ? 0 : CompBufReservedSpaceNeedAdjustmentSingleDPP;
2184
2185
2186
2187 if (j == 1 && !dml32_UnboundedRequest(UseUnboundedRequestingFinal: mode_lib->vba.UseUnboundedRequesting,
2188 TotalNumberOfActiveDPP: mode_lib->vba.TotalNumberOfActiveDPP[i][j], NoChroma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NoChroma,
2189 Output: mode_lib->vba.Output[0],
2190 SurfaceTiling: mode_lib->vba.SurfaceTiling[0],
2191 CompBufReservedSpaceNeedAdjustment,
2192 DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment: mode_lib->vba.DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment)) {
2193 while (!(mode_lib->vba.TotalNumberOfActiveDPP[i][j] >= mode_lib->vba.MaxNumDPP
2194 || mode_lib->vba.TotalNumberOfSingleDPPSurfaces[i][j] == 0)) {
2195 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.BWOfNonCombinedSurfaceOfMaximumBandwidth = 0;
2196 NumberOfNonCombinedSurfaceOfMaximumBandwidth = 0;
2197
2198 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2199 if (mode_lib->vba.MPCCombineUse[k]
2200 != dm_mpc_never &&
2201 mode_lib->vba.MPCCombineUse[k] != dm_mpc_reduce_voltage &&
2202 mode_lib->vba.ReadBandwidthLuma[k] +
2203 mode_lib->vba.ReadBandwidthChroma[k] >
2204 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.BWOfNonCombinedSurfaceOfMaximumBandwidth &&
2205 (mode_lib->vba.ODMCombineEnablePerState[i][k] !=
2206 dm_odm_combine_mode_2to1 &&
2207 mode_lib->vba.ODMCombineEnablePerState[i][k] !=
2208 dm_odm_combine_mode_4to1) &&
2209 mode_lib->vba.MPCCombine[i][j][k] == false) {
2210 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.BWOfNonCombinedSurfaceOfMaximumBandwidth =
2211 mode_lib->vba.ReadBandwidthLuma[k]
2212 + mode_lib->vba.ReadBandwidthChroma[k];
2213 NumberOfNonCombinedSurfaceOfMaximumBandwidth = k;
2214 }
2215 }
2216 mode_lib->vba.MPCCombine[i][j][NumberOfNonCombinedSurfaceOfMaximumBandwidth] =
2217 true;
2218 mode_lib->vba.NoOfDPP[i][j][NumberOfNonCombinedSurfaceOfMaximumBandwidth] = 2;
2219 mode_lib->vba.TotalNumberOfActiveDPP[i][j] =
2220 mode_lib->vba.TotalNumberOfActiveDPP[i][j] + 1;
2221 mode_lib->vba.TotalNumberOfSingleDPPSurfaces[i][j] =
2222 mode_lib->vba.TotalNumberOfSingleDPPSurfaces[i][j] - 1;
2223 }
2224 }
2225
2226 //DISPCLK/DPPCLK
2227 mode_lib->vba.WritebackRequiredDISPCLK = 0;
2228 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2229 if (mode_lib->vba.WritebackEnable[k]) {
2230 mode_lib->vba.WritebackRequiredDISPCLK = dml_max(
2231 a: mode_lib->vba.WritebackRequiredDISPCLK,
2232 b: dml32_CalculateWriteBackDISPCLK(
2233 WritebackPixelFormat: mode_lib->vba.WritebackPixelFormat[k],
2234 PixelClock: mode_lib->vba.PixelClock[k],
2235 WritebackHRatio: mode_lib->vba.WritebackHRatio[k],
2236 WritebackVRatio: mode_lib->vba.WritebackVRatio[k],
2237 WritebackHTaps: mode_lib->vba.WritebackHTaps[k],
2238 WritebackVTaps: mode_lib->vba.WritebackVTaps[k],
2239 WritebackSourceWidth: mode_lib->vba.WritebackSourceWidth[k],
2240 WritebackDestinationWidth: mode_lib->vba.WritebackDestinationWidth[k],
2241 HTotal: mode_lib->vba.HTotal[k],
2242 WritebackLineBufferSize: mode_lib->vba.WritebackLineBufferSize,
2243 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed));
2244 }
2245 }
2246
2247 mode_lib->vba.RequiredDISPCLK[i][j] = mode_lib->vba.WritebackRequiredDISPCLK;
2248 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2249 mode_lib->vba.RequiredDISPCLK[i][j] = dml_max(a: mode_lib->vba.RequiredDISPCLK[i][j],
2250 b: mode_lib->vba.RequiredDISPCLKPerSurface[i][j][k]);
2251 }
2252
2253 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
2254 mode_lib->vba.NoOfDPPThisState[k] = mode_lib->vba.NoOfDPP[i][j][k];
2255
2256 dml32_CalculateDPPCLK(NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
2257 DISPCLKDPPCLKDSCCLKDownSpreading: mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading,
2258 DISPCLKDPPCLKVCOSpeed: mode_lib->vba.DISPCLKDPPCLKVCOSpeed, DPPCLKUsingSingleDPP: mode_lib->vba.MinDPPCLKUsingSingleDPP,
2259 DPPPerSurface: mode_lib->vba.NoOfDPPThisState,
2260 /* Output */
2261 GlobalDPPCLK: &mode_lib->vba.GlobalDPPCLK, Dppclk: mode_lib->vba.RequiredDPPCLKThisState);
2262
2263 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k)
2264 mode_lib->vba.RequiredDPPCLK[i][j][k] = mode_lib->vba.RequiredDPPCLKThisState[k];
2265
2266 mode_lib->vba.DISPCLK_DPPCLK_Support[i][j] = !((mode_lib->vba.RequiredDISPCLK[i][j]
2267 > mode_lib->vba.MaxDispclk[i])
2268 || (mode_lib->vba.GlobalDPPCLK > mode_lib->vba.MaxDppclk[i]));
2269
2270 if (mode_lib->vba.TotalNumberOfActiveDPP[i][j] > mode_lib->vba.MaxNumDPP)
2271 mode_lib->vba.TotalAvailablePipesSupport[i][j] = false;
2272 } // j
2273 } // i (VOLTAGE_STATE)
2274
2275 /* Total Available OTG, HDMIFRL, DP Support Check */
2276 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveOTG = 0;
2277 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveHDMIFRL = 0;
2278 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0 = 0;
2279 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0Outputs = 0;
2280
2281 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2282 if (mode_lib->vba.BlendingAndTiming[k] == k) {
2283 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveOTG = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveOTG + 1;
2284 if (mode_lib->vba.Output[k] == dm_dp2p0) {
2285 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0 = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0 + 1;
2286 if (mode_lib->vba.OutputMultistreamId[k]
2287 == k || mode_lib->vba.OutputMultistreamEn[k] == false) {
2288 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0Outputs = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0Outputs + 1;
2289 }
2290 }
2291 }
2292 }
2293
2294 mode_lib->vba.NumberOfOTGSupport = (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveOTG <= mode_lib->vba.MaxNumOTG);
2295 mode_lib->vba.NumberOfHDMIFRLSupport = (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveHDMIFRL <= mode_lib->vba.MaxNumHDMIFRLOutputs);
2296 mode_lib->vba.NumberOfDP2p0Support = (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0 <= mode_lib->vba.MaxNumDP2p0Streams
2297 && v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalNumberOfActiveDP2p0Outputs <= mode_lib->vba.MaxNumDP2p0Outputs);
2298
2299 /* Display IO and DSC Support Check */
2300 mode_lib->vba.NonsupportedDSCInputBPC = false;
2301 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2302 if (!(mode_lib->vba.DSCInputBitPerComponent[k] == 12.0
2303 || mode_lib->vba.DSCInputBitPerComponent[k] == 10.0
2304 || mode_lib->vba.DSCInputBitPerComponent[k] == 8.0)
2305 || mode_lib->vba.DSCInputBitPerComponent[k] > mode_lib->vba.MaximumDSCBitsPerComponent) {
2306 mode_lib->vba.NonsupportedDSCInputBPC = true;
2307 }
2308 }
2309
2310 for (i = start_state; i < v->soc.num_states; ++i) {
2311 mode_lib->vba.ExceededMultistreamSlots[i] = false;
2312 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2313 if (mode_lib->vba.OutputMultistreamEn[k] == true && mode_lib->vba.OutputMultistreamId[k] == k) {
2314 TotalSlots = mode_lib->vba.RequiredSlots[i][k];
2315 for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j) {
2316 if (mode_lib->vba.OutputMultistreamId[j] == k)
2317 TotalSlots = TotalSlots + mode_lib->vba.RequiredSlots[i][j];
2318 }
2319 if (mode_lib->vba.Output[k] == dm_dp && TotalSlots > 63)
2320 mode_lib->vba.ExceededMultistreamSlots[i] = true;
2321 if (mode_lib->vba.Output[k] == dm_dp2p0 && TotalSlots > 64)
2322 mode_lib->vba.ExceededMultistreamSlots[i] = true;
2323 }
2324 }
2325 mode_lib->vba.LinkCapacitySupport[i] = true;
2326 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2327 if (mode_lib->vba.BlendingAndTiming[k] == k
2328 && (mode_lib->vba.Output[k] == dm_dp || mode_lib->vba.Output[k] == dm_dp2p0
2329 || mode_lib->vba.Output[k] == dm_edp
2330 || mode_lib->vba.Output[k] == dm_hdmi)
2331 && mode_lib->vba.OutputBppPerState[i][k] == 0 &&
2332 (mode_lib->vba.UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe)) {
2333 /* Phantom pipes don't consider DSC in DML, so it could fail link check.
2334 * However, we don't care about the link for phantom pipes.
2335 */
2336 mode_lib->vba.LinkCapacitySupport[i] = false;
2337 }
2338 }
2339 }
2340
2341 mode_lib->vba.P2IWith420 = false;
2342 mode_lib->vba.DSCOnlyIfNecessaryWithBPP = false;
2343 mode_lib->vba.DSC422NativeNotSupported = false;
2344 mode_lib->vba.LinkRateDoesNotMatchDPVersion = false;
2345 mode_lib->vba.LinkRateForMultistreamNotIndicated = false;
2346 mode_lib->vba.BPPForMultistreamNotIndicated = false;
2347 mode_lib->vba.MultistreamWithHDMIOreDP = false;
2348 mode_lib->vba.MSOOrODMSplitWithNonDPLink = false;
2349 mode_lib->vba.NotEnoughLanesForMSO = false;
2350
2351 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2352 if (mode_lib->vba.BlendingAndTiming[k] == k
2353 && (mode_lib->vba.Output[k] == dm_dp || mode_lib->vba.Output[k] == dm_dp2p0
2354 || mode_lib->vba.Output[k] == dm_edp
2355 || mode_lib->vba.Output[k] == dm_hdmi)) {
2356 if (mode_lib->vba.OutputFormat[k]
2357 == dm_420 && mode_lib->vba.Interlace[k] == 1 &&
2358 mode_lib->vba.ProgressiveToInterlaceUnitInOPP == true)
2359 mode_lib->vba.P2IWith420 = true;
2360
2361 if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.ForcedOutputLinkBPP[k] != 0)
2362 mode_lib->vba.DSCOnlyIfNecessaryWithBPP = true;
2363 if (mode_lib->vba.DSCEnable[k] && mode_lib->vba.OutputFormat[k] == dm_n422
2364 && !mode_lib->vba.DSC422NativeSupport)
2365 mode_lib->vba.DSC422NativeNotSupported = true;
2366
2367 if (((mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_hbr
2368 || mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_hbr2
2369 || mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_hbr3)
2370 && mode_lib->vba.Output[k] != dm_dp && mode_lib->vba.Output[k] != dm_edp)
2371 || ((mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_uhbr10
2372 || mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_uhbr13p5
2373 || mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_uhbr20)
2374 && mode_lib->vba.Output[k] != dm_dp2p0))
2375 mode_lib->vba.LinkRateDoesNotMatchDPVersion = true;
2376
2377 if (mode_lib->vba.OutputMultistreamEn[k] == true) {
2378 if (mode_lib->vba.OutputMultistreamId[k] == k
2379 && mode_lib->vba.OutputLinkDPRate[k] == dm_dp_rate_na)
2380 mode_lib->vba.LinkRateForMultistreamNotIndicated = true;
2381 if (mode_lib->vba.OutputMultistreamId[k] == k && mode_lib->vba.ForcedOutputLinkBPP[k] == 0)
2382 mode_lib->vba.BPPForMultistreamNotIndicated = true;
2383 for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j) {
2384 if (mode_lib->vba.OutputMultistreamId[k] == j
2385 && mode_lib->vba.ForcedOutputLinkBPP[k] == 0)
2386 mode_lib->vba.BPPForMultistreamNotIndicated = true;
2387 }
2388 }
2389
2390 if ((mode_lib->vba.Output[k] == dm_edp || mode_lib->vba.Output[k] == dm_hdmi)) {
2391 if (mode_lib->vba.OutputMultistreamEn[k] == true && mode_lib->vba.OutputMultistreamId[k] == k)
2392 mode_lib->vba.MultistreamWithHDMIOreDP = true;
2393 for (j = 0; j < mode_lib->vba.NumberOfActiveSurfaces; ++j) {
2394 if (mode_lib->vba.OutputMultistreamEn[k] == true && mode_lib->vba.OutputMultistreamId[k] == j)
2395 mode_lib->vba.MultistreamWithHDMIOreDP = true;
2396 }
2397 }
2398
2399 if (mode_lib->vba.Output[k] != dm_dp
2400 && (mode_lib->vba.ODMUse[k] == dm_odm_split_policy_1to2
2401 || mode_lib->vba.ODMUse[k] == dm_odm_mso_policy_1to2
2402 || mode_lib->vba.ODMUse[k] == dm_odm_mso_policy_1to4))
2403 mode_lib->vba.MSOOrODMSplitWithNonDPLink = true;
2404
2405 if ((mode_lib->vba.ODMUse[k] == dm_odm_mso_policy_1to2
2406 && mode_lib->vba.OutputLinkDPLanes[k] < 2)
2407 || (mode_lib->vba.ODMUse[k] == dm_odm_mso_policy_1to4
2408 && mode_lib->vba.OutputLinkDPLanes[k] < 4))
2409 mode_lib->vba.NotEnoughLanesForMSO = true;
2410 }
2411 }
2412
2413 for (i = start_state; i < v->soc.num_states; ++i) {
2414 mode_lib->vba.DTBCLKRequiredMoreThanSupported[i] = false;
2415 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2416 if (mode_lib->vba.BlendingAndTiming[k] == k
2417 && dml32_RequiredDTBCLK(DSCEnable: mode_lib->vba.RequiresDSC[i][k],
2418 PixelClock: mode_lib->vba.PixelClockBackEnd[k],
2419 OutputFormat: mode_lib->vba.OutputFormat[k],
2420 OutputBpp: mode_lib->vba.OutputBppPerState[i][k],
2421 DSCSlices: mode_lib->vba.NumberOfDSCSlices[k], HTotal: mode_lib->vba.HTotal[k],
2422 HActive: mode_lib->vba.HActive[k], AudioRate: mode_lib->vba.AudioSampleRate[k],
2423 AudioLayout: mode_lib->vba.AudioSampleLayout[k])
2424 > mode_lib->vba.DTBCLKPerState[i]) {
2425 mode_lib->vba.DTBCLKRequiredMoreThanSupported[i] = true;
2426 }
2427 }
2428 }
2429
2430 for (i = start_state; i < v->soc.num_states; ++i) {
2431 mode_lib->vba.ODMCombine2To1SupportCheckOK[i] = true;
2432 mode_lib->vba.ODMCombine4To1SupportCheckOK[i] = true;
2433 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2434 if (mode_lib->vba.BlendingAndTiming[k] == k
2435 && mode_lib->vba.ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1
2436 && mode_lib->vba.Output[k] == dm_hdmi) {
2437 mode_lib->vba.ODMCombine2To1SupportCheckOK[i] = false;
2438 }
2439 if (mode_lib->vba.BlendingAndTiming[k] == k
2440 && mode_lib->vba.ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1
2441 && (mode_lib->vba.Output[k] == dm_dp || mode_lib->vba.Output[k] == dm_edp
2442 || mode_lib->vba.Output[k] == dm_hdmi)) {
2443 mode_lib->vba.ODMCombine4To1SupportCheckOK[i] = false;
2444 }
2445 }
2446 }
2447
2448 for (i = start_state; i < v->soc.num_states; i++) {
2449 mode_lib->vba.DSCCLKRequiredMoreThanSupported[i] = false;
2450 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2451 if (mode_lib->vba.BlendingAndTiming[k] == k) {
2452 if (mode_lib->vba.Output[k] == dm_dp || mode_lib->vba.Output[k] == dm_dp2p0
2453 || mode_lib->vba.Output[k] == dm_edp) {
2454 if (mode_lib->vba.OutputFormat[k] == dm_420) {
2455 mode_lib->vba.DSCFormatFactor = 2;
2456 } else if (mode_lib->vba.OutputFormat[k] == dm_444) {
2457 mode_lib->vba.DSCFormatFactor = 1;
2458 } else if (mode_lib->vba.OutputFormat[k] == dm_n422) {
2459 mode_lib->vba.DSCFormatFactor = 2;
2460 } else {
2461 mode_lib->vba.DSCFormatFactor = 1;
2462 }
2463 if (mode_lib->vba.RequiresDSC[i][k] == true) {
2464 if (mode_lib->vba.ODMCombineEnablePerState[i][k]
2465 == dm_odm_combine_mode_4to1) {
2466 if (mode_lib->vba.PixelClockBackEnd[k] / 12.0 / mode_lib->vba.DSCFormatFactor > (1.0 - mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * mode_lib->vba.MaxDSCCLK[i])
2467 mode_lib->vba.DSCCLKRequiredMoreThanSupported[i] = true;
2468 } else if (mode_lib->vba.ODMCombineEnablePerState[i][k]
2469 == dm_odm_combine_mode_2to1) {
2470 if (mode_lib->vba.PixelClockBackEnd[k] / 6.0 / mode_lib->vba.DSCFormatFactor > (1.0 - mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * mode_lib->vba.MaxDSCCLK[i])
2471 mode_lib->vba.DSCCLKRequiredMoreThanSupported[i] = true;
2472 } else {
2473 if (mode_lib->vba.PixelClockBackEnd[k] / 3.0 / mode_lib->vba.DSCFormatFactor > (1.0 - mode_lib->vba.DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * mode_lib->vba.MaxDSCCLK[i])
2474 mode_lib->vba.DSCCLKRequiredMoreThanSupported[i] = true;
2475 }
2476 }
2477 }
2478 }
2479 }
2480 }
2481
2482 /* Check DSC Unit and Slices Support */
2483 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired = 0;
2484
2485 for (i = start_state; i < v->soc.num_states; ++i) {
2486 mode_lib->vba.NotEnoughDSCUnits[i] = false;
2487 mode_lib->vba.NotEnoughDSCSlices[i] = false;
2488 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired = 0;
2489 mode_lib->vba.PixelsPerLinePerDSCUnitSupport[i] = true;
2490 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2491 if (mode_lib->vba.RequiresDSC[i][k] == true) {
2492 if (mode_lib->vba.ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1) {
2493 if (mode_lib->vba.HActive[k]
2494 > 4 * mode_lib->vba.MaximumPixelsPerLinePerDSCUnit)
2495 mode_lib->vba.PixelsPerLinePerDSCUnitSupport[i] = false;
2496 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired + 4;
2497 if (mode_lib->vba.NumberOfDSCSlices[k] > 16)
2498 mode_lib->vba.NotEnoughDSCSlices[i] = true;
2499 } else if (mode_lib->vba.ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1) {
2500 if (mode_lib->vba.HActive[k]
2501 > 2 * mode_lib->vba.MaximumPixelsPerLinePerDSCUnit)
2502 mode_lib->vba.PixelsPerLinePerDSCUnitSupport[i] = false;
2503 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired + 2;
2504 if (mode_lib->vba.NumberOfDSCSlices[k] > 8)
2505 mode_lib->vba.NotEnoughDSCSlices[i] = true;
2506 } else {
2507 if (mode_lib->vba.HActive[k] > mode_lib->vba.MaximumPixelsPerLinePerDSCUnit)
2508 mode_lib->vba.PixelsPerLinePerDSCUnitSupport[i] = false;
2509 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired + 1;
2510 if (mode_lib->vba.NumberOfDSCSlices[k] > 4)
2511 mode_lib->vba.NotEnoughDSCSlices[i] = true;
2512 }
2513 }
2514 }
2515 if (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.TotalDSCUnitsRequired > mode_lib->vba.NumberOfDSC)
2516 mode_lib->vba.NotEnoughDSCUnits[i] = true;
2517 }
2518
2519 /*DSC Delay per state*/
2520 for (i = start_state; i < v->soc.num_states; ++i) {
2521 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2522 mode_lib->vba.DSCDelayPerState[i][k] = dml32_DSCDelayRequirement(
2523 DSCEnabled: mode_lib->vba.RequiresDSC[i][k], ODMMode: mode_lib->vba.ODMCombineEnablePerState[i][k],
2524 DSCInputBitPerComponent: mode_lib->vba.DSCInputBitPerComponent[k],
2525 OutputBpp: mode_lib->vba.OutputBppPerState[i][k], HActive: mode_lib->vba.HActive[k],
2526 HTotal: mode_lib->vba.HTotal[k], NumberOfDSCSlices: mode_lib->vba.NumberOfDSCSlices[k],
2527 OutputFormat: mode_lib->vba.OutputFormat[k], Output: mode_lib->vba.Output[k],
2528 PixelClock: mode_lib->vba.PixelClock[k], PixelClockBackEnd: mode_lib->vba.PixelClockBackEnd[k],
2529 dsc_delay_factor_wa: mode_lib->vba.ip.dsc_delay_factor_wa);
2530 }
2531
2532 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2533 for (m = 0; m <= mode_lib->vba.NumberOfActiveSurfaces - 1; m++) {
2534 for (j = 0; j <= mode_lib->vba.NumberOfActiveSurfaces - 1; j++) {
2535 if (mode_lib->vba.BlendingAndTiming[k] == m &&
2536 mode_lib->vba.RequiresDSC[i][m] == true) {
2537 mode_lib->vba.DSCDelayPerState[i][k] =
2538 mode_lib->vba.DSCDelayPerState[i][m];
2539 }
2540 }
2541 }
2542 }
2543 }
2544
2545 //Calculate Swath, DET Configuration, DCFCLKDeepSleep
2546 //
2547 for (i = start_state; i < (int) v->soc.num_states; ++i) {
2548 for (j = 0; j <= 1; ++j) {
2549 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2550 mode_lib->vba.RequiredDPPCLKThisState[k] = mode_lib->vba.RequiredDPPCLK[i][j][k];
2551 mode_lib->vba.NoOfDPPThisState[k] = mode_lib->vba.NoOfDPP[i][j][k];
2552 mode_lib->vba.ODMCombineEnableThisState[k] =
2553 mode_lib->vba.ODMCombineEnablePerState[i][k];
2554 }
2555
2556 dml32_CalculateSwathAndDETConfiguration(
2557 DETSizeOverride: mode_lib->vba.DETSizeOverride,
2558 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
2559 ConfigReturnBufferSizeInKByte: mode_lib->vba.ConfigReturnBufferSizeInKByte,
2560 MaxTotalDETInKByte: mode_lib->vba.MaxTotalDETInKByte,
2561 MinCompressedBufferSizeInKByte: mode_lib->vba.MinCompressedBufferSizeInKByte,
2562 ForceSingleDPP: false, /* ForceSingleDPP */
2563 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
2564 nomDETInKByte: mode_lib->vba.nomDETInKByte,
2565 UseUnboundedRequestingFinal: mode_lib->vba.UseUnboundedRequesting,
2566 DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment: mode_lib->vba.DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment,
2567 PixelChunkSizeKBytes: mode_lib->vba.ip.pixel_chunk_size_kbytes,
2568 ROBSizeKBytes: mode_lib->vba.ip.rob_buffer_size_kbytes,
2569 CompressedBufferSegmentSizeInkByteFinal: mode_lib->vba.CompressedBufferSegmentSizeInkByteFinal,
2570 Output: mode_lib->vba.Output,
2571 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
2572 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
2573 MaximumSwathWidthLuma: mode_lib->vba.MaximumSwathWidthLuma,
2574 MaximumSwathWidthChroma: mode_lib->vba.MaximumSwathWidthChroma,
2575 SourceRotation: mode_lib->vba.SourceRotation,
2576 ViewportStationary: mode_lib->vba.ViewportStationary,
2577 SourcePixelFormat: mode_lib->vba.SourcePixelFormat,
2578 SurfaceTiling: mode_lib->vba.SurfaceTiling,
2579 ViewportWidth: mode_lib->vba.ViewportWidth,
2580 ViewportHeight: mode_lib->vba.ViewportHeight,
2581 ViewportXStart: mode_lib->vba.ViewportXStartY,
2582 ViewportYStart: mode_lib->vba.ViewportYStartY,
2583 ViewportXStartC: mode_lib->vba.ViewportXStartC,
2584 ViewportYStartC: mode_lib->vba.ViewportYStartC,
2585 SurfaceWidthY: mode_lib->vba.SurfaceWidthY,
2586 SurfaceWidthC: mode_lib->vba.SurfaceWidthC,
2587 SurfaceHeightY: mode_lib->vba.SurfaceHeightY,
2588 SurfaceHeightC: mode_lib->vba.SurfaceHeightC,
2589 Read256BytesBlockHeightY: mode_lib->vba.Read256BlockHeightY,
2590 Read256BytesBlockHeightC: mode_lib->vba.Read256BlockHeightC,
2591 Read256BytesBlockWidthY: mode_lib->vba.Read256BlockWidthY,
2592 Read256BytesBlockWidthC: mode_lib->vba.Read256BlockWidthC,
2593 ODMMode: mode_lib->vba.ODMCombineEnableThisState,
2594 BlendingAndTiming: mode_lib->vba.BlendingAndTiming,
2595 BytePerPixY: mode_lib->vba.BytePerPixelY,
2596 BytePerPixC: mode_lib->vba.BytePerPixelC,
2597 BytePerPixDETY: mode_lib->vba.BytePerPixelInDETY,
2598 BytePerPixDETC: mode_lib->vba.BytePerPixelInDETC,
2599 HActive: mode_lib->vba.HActive,
2600 HRatio: mode_lib->vba.HRatio,
2601 HRatioChroma: mode_lib->vba.HRatioChroma,
2602 DPPPerSurface: mode_lib->vba.NoOfDPPThisState,
2603 /* Output */
2604 swath_width_luma_ub: mode_lib->vba.swath_width_luma_ub_this_state,
2605 swath_width_chroma_ub: mode_lib->vba.swath_width_chroma_ub_this_state,
2606 SwathWidth: mode_lib->vba.SwathWidthYThisState,
2607 SwathWidthChroma: mode_lib->vba.SwathWidthCThisState,
2608 SwathHeightY: mode_lib->vba.SwathHeightYThisState,
2609 SwathHeightC: mode_lib->vba.SwathHeightCThisState,
2610 DETBufferSizeInKByte: mode_lib->vba.DETBufferSizeInKByteThisState,
2611 DETBufferSizeY: mode_lib->vba.DETBufferSizeYThisState,
2612 DETBufferSizeC: mode_lib->vba.DETBufferSizeCThisState,
2613 UnboundedRequestEnabled: &mode_lib->vba.UnboundedRequestEnabledThisState,
2614 CompressedBufferSizeInkByte: &mode_lib->vba.CompressedBufferSizeInkByteThisState,
2615 CompBufReservedSpaceKBytes: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer[0], /* Long CompBufReservedSpaceKBytes */
2616 CompBufReservedSpaceNeedAdjustment: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_boolean[0], /* bool CompBufReservedSpaceNeedAdjustment */
2617 ViewportSizeSupportPerSurface: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_boolean_array[0],
2618 ViewportSizeSupport: &mode_lib->vba.ViewportSizeSupport[i][j]);
2619
2620 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2621 mode_lib->vba.swath_width_luma_ub_all_states[i][j][k] =
2622 mode_lib->vba.swath_width_luma_ub_this_state[k];
2623 mode_lib->vba.swath_width_chroma_ub_all_states[i][j][k] =
2624 mode_lib->vba.swath_width_chroma_ub_this_state[k];
2625 mode_lib->vba.SwathWidthYAllStates[i][j][k] = mode_lib->vba.SwathWidthYThisState[k];
2626 mode_lib->vba.SwathWidthCAllStates[i][j][k] = mode_lib->vba.SwathWidthCThisState[k];
2627 mode_lib->vba.SwathHeightYAllStates[i][j][k] = mode_lib->vba.SwathHeightYThisState[k];
2628 mode_lib->vba.SwathHeightCAllStates[i][j][k] = mode_lib->vba.SwathHeightCThisState[k];
2629 mode_lib->vba.UnboundedRequestEnabledAllStates[i][j] =
2630 mode_lib->vba.UnboundedRequestEnabledThisState;
2631 mode_lib->vba.CompressedBufferSizeInkByteAllStates[i][j] =
2632 mode_lib->vba.CompressedBufferSizeInkByteThisState;
2633 mode_lib->vba.DETBufferSizeInKByteAllStates[i][j][k] =
2634 mode_lib->vba.DETBufferSizeInKByteThisState[k];
2635 mode_lib->vba.DETBufferSizeYAllStates[i][j][k] =
2636 mode_lib->vba.DETBufferSizeYThisState[k];
2637 mode_lib->vba.DETBufferSizeCAllStates[i][j][k] =
2638 mode_lib->vba.DETBufferSizeCThisState[k];
2639 }
2640 }
2641 }
2642
2643 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2644 mode_lib->vba.cursor_bw[k] = mode_lib->vba.NumberOfCursors[k] * mode_lib->vba.CursorWidth[k][0]
2645 * mode_lib->vba.CursorBPP[k][0] / 8.0
2646 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * mode_lib->vba.VRatio[k];
2647 }
2648
2649 dml32_CalculateSurfaceSizeInMall(
2650 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
2651 MALLAllocatedForDCN: mode_lib->vba.MALLAllocatedForDCNFinal,
2652 UseMALLForStaticScreen: mode_lib->vba.UseMALLForStaticScreen,
2653 UsesMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
2654 DCCEnable: mode_lib->vba.DCCEnable,
2655 ViewportStationary: mode_lib->vba.ViewportStationary,
2656 ViewportXStartY: mode_lib->vba.ViewportXStartY,
2657 ViewportYStartY: mode_lib->vba.ViewportYStartY,
2658 ViewportXStartC: mode_lib->vba.ViewportXStartC,
2659 ViewportYStartC: mode_lib->vba.ViewportYStartC,
2660 ViewportWidthY: mode_lib->vba.ViewportWidth,
2661 ViewportHeightY: mode_lib->vba.ViewportHeight,
2662 BytesPerPixelY: mode_lib->vba.BytePerPixelY,
2663 ViewportWidthC: mode_lib->vba.ViewportWidthChroma,
2664 ViewportHeightC: mode_lib->vba.ViewportHeightChroma,
2665 BytesPerPixelC: mode_lib->vba.BytePerPixelC,
2666 SurfaceWidthY: mode_lib->vba.SurfaceWidthY,
2667 SurfaceWidthC: mode_lib->vba.SurfaceWidthC,
2668 SurfaceHeightY: mode_lib->vba.SurfaceHeightY,
2669 SurfaceHeightC: mode_lib->vba.SurfaceHeightC,
2670 Read256BytesBlockWidthY: mode_lib->vba.Read256BlockWidthY,
2671 Read256BytesBlockWidthC: mode_lib->vba.Read256BlockWidthC,
2672 Read256BytesBlockHeightY: mode_lib->vba.Read256BlockHeightY,
2673 Read256BytesBlockHeightC: mode_lib->vba.Read256BlockHeightC,
2674 ReadBlockWidthY: mode_lib->vba.MacroTileWidthY,
2675 ReadBlockWidthC: mode_lib->vba.MacroTileWidthC,
2676 ReadBlockHeightY: mode_lib->vba.MacroTileHeightY,
2677 ReadBlockHeightC: mode_lib->vba.MacroTileHeightC,
2678 DCCMetaPitchY: mode_lib->vba.DCCMetaPitchY,
2679 DCCMetaPitchC: mode_lib->vba.DCCMetaPitchC,
2680
2681 /* Output */
2682 SurfaceSizeInMALL: mode_lib->vba.SurfaceSizeInMALL,
2683 ExceededMALLSize: &mode_lib->vba.ExceededMALLSize);
2684
2685 for (i = start_state; i < v->soc.num_states; i++) {
2686 for (j = 0; j < 2; j++) {
2687 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2688 mode_lib->vba.swath_width_luma_ub_this_state[k] =
2689 mode_lib->vba.swath_width_luma_ub_all_states[i][j][k];
2690 mode_lib->vba.swath_width_chroma_ub_this_state[k] =
2691 mode_lib->vba.swath_width_chroma_ub_all_states[i][j][k];
2692 mode_lib->vba.SwathWidthYThisState[k] = mode_lib->vba.SwathWidthYAllStates[i][j][k];
2693 mode_lib->vba.SwathWidthCThisState[k] = mode_lib->vba.SwathWidthCAllStates[i][j][k];
2694 mode_lib->vba.SwathHeightYThisState[k] = mode_lib->vba.SwathHeightYAllStates[i][j][k];
2695 mode_lib->vba.SwathHeightCThisState[k] = mode_lib->vba.SwathHeightCAllStates[i][j][k];
2696 mode_lib->vba.DETBufferSizeInKByteThisState[k] =
2697 mode_lib->vba.DETBufferSizeInKByteAllStates[i][j][k];
2698 mode_lib->vba.DETBufferSizeYThisState[k] =
2699 mode_lib->vba.DETBufferSizeYAllStates[i][j][k];
2700 mode_lib->vba.DETBufferSizeCThisState[k] =
2701 mode_lib->vba.DETBufferSizeCAllStates[i][j][k];
2702 mode_lib->vba.RequiredDPPCLKThisState[k] = mode_lib->vba.RequiredDPPCLK[i][j][k];
2703 mode_lib->vba.NoOfDPPThisState[k] = mode_lib->vba.NoOfDPP[i][j][k];
2704 }
2705
2706 mode_lib->vba.TotalNumberOfDCCActiveDPP[i][j] = 0;
2707 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2708 if (mode_lib->vba.DCCEnable[k] == true) {
2709 mode_lib->vba.TotalNumberOfDCCActiveDPP[i][j] =
2710 mode_lib->vba.TotalNumberOfDCCActiveDPP[i][j]
2711 + mode_lib->vba.NoOfDPP[i][j][k];
2712 }
2713 }
2714
2715
2716 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2717 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].PixelClock = mode_lib->vba.PixelClock[k];
2718 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DPPPerSurface = mode_lib->vba.NoOfDPP[i][j][k];
2719 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].SourceRotation = mode_lib->vba.SourceRotation[k];
2720 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportHeight = mode_lib->vba.ViewportHeight[k];
2721 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportHeightChroma = mode_lib->vba.ViewportHeightChroma[k];
2722 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidth256BytesY = mode_lib->vba.Read256BlockWidthY[k];
2723 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesY = mode_lib->vba.Read256BlockHeightY[k];
2724 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidth256BytesC = mode_lib->vba.Read256BlockWidthC[k];
2725 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesC = mode_lib->vba.Read256BlockHeightC[k];
2726 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MacroTileWidthY[k];
2727 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MacroTileHeightY[k];
2728 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MacroTileWidthC[k];
2729 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MacroTileHeightC[k];
2730 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].InterlaceEnable = mode_lib->vba.Interlace[k];
2731 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].HTotal = mode_lib->vba.HTotal[k];
2732 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DCCEnable = mode_lib->vba.DCCEnable[k];
2733 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].SourcePixelFormat = mode_lib->vba.SourcePixelFormat[k];
2734 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].SurfaceTiling = mode_lib->vba.SurfaceTiling[k];
2735 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BytePerPixelY = mode_lib->vba.BytePerPixelY[k];
2736 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BytePerPixelC = mode_lib->vba.BytePerPixelC[k];
2737 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ProgressiveToInterlaceUnitInOPP =
2738 mode_lib->vba.ProgressiveToInterlaceUnitInOPP;
2739 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].VRatio = mode_lib->vba.VRatio[k];
2740 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].VRatioChroma = mode_lib->vba.VRatioChroma[k];
2741 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].VTaps = mode_lib->vba.vtaps[k];
2742 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].VTapsChroma = mode_lib->vba.VTAPsChroma[k];
2743 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].PitchY = mode_lib->vba.PitchY[k];
2744 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DCCMetaPitchY = mode_lib->vba.DCCMetaPitchY[k];
2745 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].PitchC = mode_lib->vba.PitchC[k];
2746 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DCCMetaPitchC = mode_lib->vba.DCCMetaPitchC[k];
2747 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportStationary = mode_lib->vba.ViewportStationary[k];
2748 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportXStart = mode_lib->vba.ViewportXStartY[k];
2749 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportYStart = mode_lib->vba.ViewportYStartY[k];
2750 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportXStartC = mode_lib->vba.ViewportXStartC[k];
2751 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].ViewportYStartC = mode_lib->vba.ViewportYStartC[k];
2752 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].FORCE_ONE_ROW_FOR_FRAME = mode_lib->vba.ForceOneRowForFrame[k];
2753 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].SwathHeightY = mode_lib->vba.SwathHeightYThisState[k];
2754 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].SwathHeightC = mode_lib->vba.SwathHeightCThisState[k];
2755 }
2756
2757 {
2758 dml32_CalculateVMRowAndSwath(
2759 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
2760 myPipe: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters,
2761 SurfaceSizeInMALL: mode_lib->vba.SurfaceSizeInMALL,
2762 PTEBufferSizeInRequestsLuma: mode_lib->vba.PTEBufferSizeInRequestsLuma,
2763 PTEBufferSizeInRequestsChroma: mode_lib->vba.PTEBufferSizeInRequestsChroma,
2764 DCCMetaBufferSizeBytes: mode_lib->vba.DCCMetaBufferSizeBytes,
2765 UseMALLForStaticScreen: mode_lib->vba.UseMALLForStaticScreen,
2766 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
2767 MALLAllocatedForDCN: mode_lib->vba.MALLAllocatedForDCNFinal,
2768 SwathWidthY: mode_lib->vba.SwathWidthYThisState,
2769 SwathWidthC: mode_lib->vba.SwathWidthCThisState,
2770 GPUVMEnable: mode_lib->vba.GPUVMEnable,
2771 HostVMEnable: mode_lib->vba.HostVMEnable,
2772 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
2773 GPUVMMaxPageTableLevels: mode_lib->vba.GPUVMMaxPageTableLevels,
2774 GPUVMMinPageSizeKBytes: mode_lib->vba.GPUVMMinPageSizeKBytes,
2775 HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
2776
2777 /* Output */
2778 PTEBufferSizeNotExceeded: mode_lib->vba.PTEBufferSizeNotExceededPerState,
2779 DCCMetaBufferSizeNotExceeded: mode_lib->vba.DCCMetaBufferSizeNotExceededPerState,
2780 dpte_row_width_luma_ub: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[0],
2781 dpte_row_width_chroma_ub: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[1],
2782 dpte_row_height_luma: mode_lib->vba.dpte_row_height,
2783 dpte_row_height_chroma: mode_lib->vba.dpte_row_height_chroma,
2784 dpte_row_height_linear_luma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[2],
2785 dpte_row_height_linear_chroma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[3],
2786 meta_req_width: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[4],
2787 meta_req_width_chroma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[5],
2788 meta_req_height: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[6],
2789 meta_req_height_chroma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[7],
2790 meta_row_width: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[8],
2791 meta_row_width_chroma: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[9],
2792 meta_row_height: mode_lib->vba.meta_row_height,
2793 meta_row_height_chroma: mode_lib->vba.meta_row_height_chroma,
2794 vm_group_bytes: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[10],
2795 dpte_group_bytes: mode_lib->vba.dpte_group_bytes,
2796 PixelPTEReqWidthY: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[11],
2797 PixelPTEReqHeightY: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[12],
2798 PTERequestSizeY: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[13],
2799 PixelPTEReqWidthC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[14],
2800 PixelPTEReqHeightC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[15],
2801 PTERequestSizeC: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[16],
2802 dpde0_bytes_per_frame_ub_l: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[17],
2803 meta_pte_bytes_per_frame_ub_l: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[18],
2804 dpde0_bytes_per_frame_ub_c: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[19],
2805 meta_pte_bytes_per_frame_ub_c: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[20],
2806 PrefetchSourceLinesY: mode_lib->vba.PrefetchLinesYThisState,
2807 PrefetchSourceLinesC: mode_lib->vba.PrefetchLinesCThisState,
2808 VInitPreFillY: mode_lib->vba.PrefillY,
2809 VInitPreFillC: mode_lib->vba.PrefillC,
2810 MaxNumSwathY: mode_lib->vba.MaxNumSwY,
2811 MaxNumSwathC: mode_lib->vba.MaxNumSwC,
2812 meta_row_bw: mode_lib->vba.meta_row_bandwidth_this_state,
2813 dpte_row_bw: mode_lib->vba.dpte_row_bandwidth_this_state,
2814 PixelPTEBytesPerRow: mode_lib->vba.DPTEBytesPerRowThisState,
2815 PDEAndMetaPTEBytesFrame: mode_lib->vba.PDEAndMetaPTEBytesPerFrameThisState,
2816 MetaRowByte: mode_lib->vba.MetaRowBytesThisState,
2817 use_one_row_for_frame: mode_lib->vba.use_one_row_for_frame_this_state,
2818 use_one_row_for_frame_flip: mode_lib->vba.use_one_row_for_frame_flip_this_state,
2819 UsesMALLForStaticScreen: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_boolean_array[0], // Boolean UsesMALLForStaticScreen[]
2820 PTE_BUFFER_MODE: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_boolean_array[1], // Boolean PTE_BUFFER_MODE[]
2821 BIGK_FRAGMENT_SIZE: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer_array[21]); // Long BIGK_FRAGMENT_SIZE[]
2822 }
2823
2824 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2825 mode_lib->vba.PrefetchLinesY[i][j][k] = mode_lib->vba.PrefetchLinesYThisState[k];
2826 mode_lib->vba.PrefetchLinesC[i][j][k] = mode_lib->vba.PrefetchLinesCThisState[k];
2827 mode_lib->vba.meta_row_bandwidth[i][j][k] =
2828 mode_lib->vba.meta_row_bandwidth_this_state[k];
2829 mode_lib->vba.dpte_row_bandwidth[i][j][k] =
2830 mode_lib->vba.dpte_row_bandwidth_this_state[k];
2831 mode_lib->vba.DPTEBytesPerRow[i][j][k] = mode_lib->vba.DPTEBytesPerRowThisState[k];
2832 mode_lib->vba.PDEAndMetaPTEBytesPerFrame[i][j][k] =
2833 mode_lib->vba.PDEAndMetaPTEBytesPerFrameThisState[k];
2834 mode_lib->vba.MetaRowBytes[i][j][k] = mode_lib->vba.MetaRowBytesThisState[k];
2835 mode_lib->vba.use_one_row_for_frame[i][j][k] =
2836 mode_lib->vba.use_one_row_for_frame_this_state[k];
2837 mode_lib->vba.use_one_row_for_frame_flip[i][j][k] =
2838 mode_lib->vba.use_one_row_for_frame_flip_this_state[k];
2839 }
2840
2841 mode_lib->vba.PTEBufferSizeNotExceeded[i][j] = true;
2842 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2843 if (mode_lib->vba.PTEBufferSizeNotExceededPerState[k] == false)
2844 mode_lib->vba.PTEBufferSizeNotExceeded[i][j] = false;
2845 }
2846
2847 mode_lib->vba.DCCMetaBufferSizeNotExceeded[i][j] = true;
2848 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2849 if (mode_lib->vba.DCCMetaBufferSizeNotExceededPerState[k] == false)
2850 mode_lib->vba.DCCMetaBufferSizeNotExceeded[i][j] = false;
2851 }
2852
2853 mode_lib->vba.UrgLatency[i] = dml32_CalculateUrgentLatency(
2854 UrgentLatencyPixelDataOnly: mode_lib->vba.UrgentLatencyPixelDataOnly,
2855 UrgentLatencyPixelMixedWithVMData: mode_lib->vba.UrgentLatencyPixelMixedWithVMData,
2856 UrgentLatencyVMDataOnly: mode_lib->vba.UrgentLatencyVMDataOnly, DoUrgentLatencyAdjustment: mode_lib->vba.DoUrgentLatencyAdjustment,
2857 UrgentLatencyAdjustmentFabricClockComponent: mode_lib->vba.UrgentLatencyAdjustmentFabricClockComponent,
2858 UrgentLatencyAdjustmentFabricClockReference: mode_lib->vba.UrgentLatencyAdjustmentFabricClockReference,
2859 FabricClock: mode_lib->vba.FabricClockPerState[i]);
2860
2861 //bool NotUrgentLatencyHiding[DC__NUM_DPP__MAX];
2862 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2863 dml32_CalculateUrgentBurstFactor(
2864 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange[k],
2865 swath_width_luma_ub: mode_lib->vba.swath_width_luma_ub_this_state[k],
2866 swath_width_chroma_ub: mode_lib->vba.swath_width_chroma_ub_this_state[k],
2867 SwathHeightY: mode_lib->vba.SwathHeightYThisState[k],
2868 SwathHeightC: mode_lib->vba.SwathHeightCThisState[k],
2869 LineTime: (double) mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k],
2870 UrgentLatency: mode_lib->vba.UrgLatency[i],
2871 CursorBufferSize: mode_lib->vba.CursorBufferSize,
2872 CursorWidth: mode_lib->vba.CursorWidth[k][0],
2873 CursorBPP: mode_lib->vba.CursorBPP[k][0],
2874 VRatio: mode_lib->vba.VRatio[k],
2875 VRatioC: mode_lib->vba.VRatioChroma[k],
2876 BytePerPixelInDETY: mode_lib->vba.BytePerPixelInDETY[k],
2877 BytePerPixelInDETC: mode_lib->vba.BytePerPixelInDETC[k],
2878 DETBufferSizeY: mode_lib->vba.DETBufferSizeYThisState[k],
2879 DETBufferSizeC: mode_lib->vba.DETBufferSizeCThisState[k],
2880 /* Output */
2881 UrgentBurstFactorCursor: &mode_lib->vba.UrgentBurstFactorCursor[k],
2882 UrgentBurstFactorLuma: &mode_lib->vba.UrgentBurstFactorLuma[k],
2883 UrgentBurstFactorChroma: &mode_lib->vba.UrgentBurstFactorChroma[k],
2884 NotEnoughUrgentLatencyHiding: &mode_lib->vba.NoUrgentLatencyHiding[k]);
2885 }
2886
2887 dml32_CalculateDCFCLKDeepSleep(
2888 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
2889 BytePerPixelY: mode_lib->vba.BytePerPixelY,
2890 BytePerPixelC: mode_lib->vba.BytePerPixelC,
2891 VRatio: mode_lib->vba.VRatio,
2892 VRatioChroma: mode_lib->vba.VRatioChroma,
2893 SwathWidthY: mode_lib->vba.SwathWidthYThisState,
2894 SwathWidthC: mode_lib->vba.SwathWidthCThisState,
2895 DPPPerSurface: mode_lib->vba.NoOfDPPThisState,
2896 HRatio: mode_lib->vba.HRatio,
2897 HRatioChroma: mode_lib->vba.HRatioChroma,
2898 PixelClock: mode_lib->vba.PixelClock,
2899 PSCL_THROUGHPUT: mode_lib->vba.PSCL_FACTOR,
2900 PSCL_THROUGHPUT_CHROMA: mode_lib->vba.PSCL_FACTOR_CHROMA,
2901 Dppclk: mode_lib->vba.RequiredDPPCLKThisState,
2902 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
2903 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
2904 ReturnBusWidth: mode_lib->vba.ReturnBusWidth,
2905
2906 /* Output */
2907 DCFClkDeepSleep: &mode_lib->vba.ProjectedDCFCLKDeepSleep[i][j]);
2908 }
2909 }
2910
2911 //Calculate Return BW
2912 for (i = start_state; i < (int) v->soc.num_states; ++i) {
2913 for (j = 0; j <= 1; ++j) {
2914 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2915 if (mode_lib->vba.BlendingAndTiming[k] == k) {
2916 if (mode_lib->vba.WritebackEnable[k] == true) {
2917 mode_lib->vba.WritebackDelayTime[k] =
2918 mode_lib->vba.WritebackLatency
2919 + dml32_CalculateWriteBackDelay(
2920 WritebackPixelFormat: mode_lib->vba.WritebackPixelFormat[k],
2921 WritebackHRatio: mode_lib->vba.WritebackHRatio[k],
2922 WritebackVRatio: mode_lib->vba.WritebackVRatio[k],
2923 WritebackVTaps: mode_lib->vba.WritebackVTaps[k],
2924 WritebackDestinationWidth: mode_lib->vba.WritebackDestinationWidth[k],
2925 WritebackDestinationHeight: mode_lib->vba.WritebackDestinationHeight[k],
2926 WritebackSourceHeight: mode_lib->vba.WritebackSourceHeight[k],
2927 HTotal: mode_lib->vba.HTotal[k])
2928 / mode_lib->vba.RequiredDISPCLK[i][j];
2929 } else {
2930 mode_lib->vba.WritebackDelayTime[k] = 0.0;
2931 }
2932 for (m = 0; m <= mode_lib->vba.NumberOfActiveSurfaces - 1; m++) {
2933 if (mode_lib->vba.BlendingAndTiming[m]
2934 == k && mode_lib->vba.WritebackEnable[m] == true) {
2935 mode_lib->vba.WritebackDelayTime[k] =
2936 dml_max(a: mode_lib->vba.WritebackDelayTime[k],
2937 b: mode_lib->vba.WritebackLatency
2938 + dml32_CalculateWriteBackDelay(
2939 WritebackPixelFormat: mode_lib->vba.WritebackPixelFormat[m],
2940 WritebackHRatio: mode_lib->vba.WritebackHRatio[m],
2941 WritebackVRatio: mode_lib->vba.WritebackVRatio[m],
2942 WritebackVTaps: mode_lib->vba.WritebackVTaps[m],
2943 WritebackDestinationWidth: mode_lib->vba.WritebackDestinationWidth[m],
2944 WritebackDestinationHeight: mode_lib->vba.WritebackDestinationHeight[m],
2945 WritebackSourceHeight: mode_lib->vba.WritebackSourceHeight[m],
2946 HTotal: mode_lib->vba.HTotal[m]) /
2947 mode_lib->vba.RequiredDISPCLK[i][j]);
2948 }
2949 }
2950 }
2951 }
2952 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2953 for (m = 0; m <= mode_lib->vba.NumberOfActiveSurfaces - 1; m++) {
2954 if (mode_lib->vba.BlendingAndTiming[k] == m) {
2955 mode_lib->vba.WritebackDelayTime[k] =
2956 mode_lib->vba.WritebackDelayTime[m];
2957 }
2958 }
2959 }
2960 mode_lib->vba.MaxMaxVStartup[i][j] = 0;
2961 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
2962 mode_lib->vba.MaximumVStartup[i][j][k] = ((mode_lib->vba.Interlace[k] &&
2963 !mode_lib->vba.ProgressiveToInterlaceUnitInOPP) ?
2964 dml_floor(a: (mode_lib->vba.VTotal[k] -
2965 mode_lib->vba.VActive[k]) / 2.0, granularity: 1.0) :
2966 mode_lib->vba.VTotal[k] - mode_lib->vba.VActive[k])
2967 - dml_max(a: 1.0, b: dml_ceil(a: 1.0 *
2968 mode_lib->vba.WritebackDelayTime[k] /
2969 (mode_lib->vba.HTotal[k] /
2970 mode_lib->vba.PixelClock[k]), granularity: 1.0));
2971
2972 // Clamp to max OTG vstartup register limit
2973 if (mode_lib->vba.MaximumVStartup[i][j][k] > 1023)
2974 mode_lib->vba.MaximumVStartup[i][j][k] = 1023;
2975
2976 mode_lib->vba.MaxMaxVStartup[i][j] = dml_max(a: mode_lib->vba.MaxMaxVStartup[i][j],
2977 b: mode_lib->vba.MaximumVStartup[i][j][k]);
2978 }
2979 }
2980 }
2981
2982 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ReorderingBytes = mode_lib->vba.NumberOfChannels
2983 * dml_max3(a: mode_lib->vba.UrgentOutOfOrderReturnPerChannelPixelDataOnly,
2984 b: mode_lib->vba.UrgentOutOfOrderReturnPerChannelPixelMixedWithVMData,
2985 c: mode_lib->vba.UrgentOutOfOrderReturnPerChannelVMDataOnly);
2986
2987 dml32_CalculateMinAndMaxPrefetchMode(AllowForPStateChangeOrStutterInVBlankFinal: mode_lib->vba.AllowForPStateChangeOrStutterInVBlankFinal,
2988 MinPrefetchMode: &mode_lib->vba.MinPrefetchMode,
2989 MaxPrefetchMode: &mode_lib->vba.MaxPrefetchMode);
2990
2991 for (i = start_state; i < (int) v->soc.num_states; ++i) {
2992 for (j = 0; j <= 1; ++j)
2993 mode_lib->vba.DCFCLKState[i][j] = mode_lib->vba.DCFCLKPerState[i];
2994 }
2995
2996 /* Immediate Flip and MALL parameters */
2997 mode_lib->vba.ImmediateFlipRequiredFinal = false;
2998 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
2999 mode_lib->vba.ImmediateFlipRequiredFinal = mode_lib->vba.ImmediateFlipRequiredFinal
3000 || (mode_lib->vba.ImmediateFlipRequirement[k] == dm_immediate_flip_required);
3001 }
3002
3003 mode_lib->vba.ImmediateFlipRequiredButTheRequirementForEachSurfaceIsNotSpecified = false;
3004 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3005 mode_lib->vba.ImmediateFlipRequiredButTheRequirementForEachSurfaceIsNotSpecified =
3006 mode_lib->vba.ImmediateFlipRequiredButTheRequirementForEachSurfaceIsNotSpecified
3007 || ((mode_lib->vba.ImmediateFlipRequirement[k]
3008 != dm_immediate_flip_required)
3009 && (mode_lib->vba.ImmediateFlipRequirement[k]
3010 != dm_immediate_flip_not_required));
3011 }
3012 mode_lib->vba.ImmediateFlipRequiredButTheRequirementForEachSurfaceIsNotSpecified =
3013 mode_lib->vba.ImmediateFlipRequiredButTheRequirementForEachSurfaceIsNotSpecified
3014 && mode_lib->vba.ImmediateFlipRequiredFinal;
3015
3016 mode_lib->vba.ImmediateFlipOrHostVMAndPStateWithMALLFullFrameOrPhantomPipe = false;
3017 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3018 mode_lib->vba.ImmediateFlipOrHostVMAndPStateWithMALLFullFrameOrPhantomPipe =
3019 mode_lib->vba.ImmediateFlipOrHostVMAndPStateWithMALLFullFrameOrPhantomPipe ||
3020 ((mode_lib->vba.HostVMEnable == true || mode_lib->vba.ImmediateFlipRequirement[k] !=
3021 dm_immediate_flip_not_required) &&
3022 (mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame ||
3023 mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe));
3024 }
3025
3026 mode_lib->vba.InvalidCombinationOfMALLUseForPStateAndStaticScreen = false;
3027 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3028 mode_lib->vba.InvalidCombinationOfMALLUseForPStateAndStaticScreen =
3029 mode_lib->vba.InvalidCombinationOfMALLUseForPStateAndStaticScreen
3030 || ((mode_lib->vba.UseMALLForStaticScreen[k] == dm_use_mall_static_screen_enable
3031 || mode_lib->vba.UseMALLForStaticScreen[k] == dm_use_mall_static_screen_optimize)
3032 && (mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe))
3033 || ((mode_lib->vba.UseMALLForStaticScreen[k] == dm_use_mall_static_screen_disable
3034 || mode_lib->vba.UseMALLForStaticScreen[k] == dm_use_mall_static_screen_optimize)
3035 && (mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame));
3036 }
3037
3038 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.FullFrameMALLPStateMethod = false;
3039 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SubViewportMALLPStateMethod = false;
3040 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.PhantomPipeMALLPStateMethod = false;
3041
3042 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3043 if (mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame)
3044 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.FullFrameMALLPStateMethod = true;
3045 if (mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_sub_viewport)
3046 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SubViewportMALLPStateMethod = true;
3047 if (mode_lib->vba.UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe)
3048 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.PhantomPipeMALLPStateMethod = true;
3049 }
3050 mode_lib->vba.InvalidCombinationOfMALLUseForPState = (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SubViewportMALLPStateMethod
3051 != v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.PhantomPipeMALLPStateMethod) || (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SubViewportMALLPStateMethod && v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.FullFrameMALLPStateMethod);
3052
3053 if (mode_lib->vba.UseMinimumRequiredDCFCLK == true) {
3054 dml32_UseMinimumDCFCLK(
3055 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
3056 DRRDisplay: mode_lib->vba.DRRDisplay,
3057 SynchronizeDRRDisplaysForUCLKPStateChangeFinal: mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
3058 MaxInterDCNTileRepeaters: mode_lib->vba.MaxInterDCNTileRepeaters,
3059 MaxPrefetchMode: mode_lib->vba.MaxPrefetchMode,
3060 DRAMClockChangeLatencyFinal: mode_lib->vba.DRAMClockChangeLatency,
3061 FCLKChangeLatency: mode_lib->vba.FCLKChangeLatency,
3062 SREnterPlusExitTime: mode_lib->vba.SREnterPlusExitTime,
3063 ReturnBusWidth: mode_lib->vba.ReturnBusWidth,
3064 RoundTripPingLatencyCycles: mode_lib->vba.RoundTripPingLatencyCycles,
3065 ReorderingBytes: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ReorderingBytes,
3066 PixelChunkSizeInKByte: mode_lib->vba.PixelChunkSizeInKByte,
3067 MetaChunkSize: mode_lib->vba.MetaChunkSize,
3068 GPUVMEnable: mode_lib->vba.GPUVMEnable,
3069 GPUVMMaxPageTableLevels: mode_lib->vba.GPUVMMaxPageTableLevels,
3070 HostVMEnable: mode_lib->vba.HostVMEnable,
3071 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3072 HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
3073 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
3074 DynamicMetadataVMEnabled: mode_lib->vba.DynamicMetadataVMEnabled,
3075 ImmediateFlipRequirement: mode_lib->vba.ImmediateFlipRequiredFinal,
3076 ProgressiveToInterlaceUnitInOPP: mode_lib->vba.ProgressiveToInterlaceUnitInOPP,
3077 MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation: mode_lib->vba.MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation,
3078 PercentOfIdealSDPPortBWReceivedAfterUrgLatency: mode_lib->vba.PercentOfIdealFabricAndSDPPortBWReceivedAfterUrgLatency,
3079 VTotal: mode_lib->vba.VTotal,
3080 VActive: mode_lib->vba.VActive,
3081 DynamicMetadataTransmittedBytes: mode_lib->vba.DynamicMetadataTransmittedBytes,
3082 DynamicMetadataLinesBeforeActiveRequired: mode_lib->vba.DynamicMetadataLinesBeforeActiveRequired,
3083 Interlace: mode_lib->vba.Interlace,
3084 RequiredDPPCLKPerSurface: mode_lib->vba.RequiredDPPCLK,
3085 RequiredDISPCLK: mode_lib->vba.RequiredDISPCLK,
3086 UrgLatency: mode_lib->vba.UrgLatency,
3087 NoOfDPP: mode_lib->vba.NoOfDPP,
3088 ProjectedDCFClkDeepSleep: mode_lib->vba.ProjectedDCFCLKDeepSleep,
3089 MaximumVStartup: mode_lib->vba.MaximumVStartup,
3090 TotalNumberOfActiveDPP: mode_lib->vba.TotalNumberOfActiveDPP,
3091 TotalNumberOfDCCActiveDPP: mode_lib->vba.TotalNumberOfDCCActiveDPP,
3092 dpte_group_bytes: mode_lib->vba.dpte_group_bytes,
3093 PrefetchLinesY: mode_lib->vba.PrefetchLinesY,
3094 PrefetchLinesC: mode_lib->vba.PrefetchLinesC,
3095 swath_width_luma_ub_all_states: mode_lib->vba.swath_width_luma_ub_all_states,
3096 swath_width_chroma_ub_all_states: mode_lib->vba.swath_width_chroma_ub_all_states,
3097 BytePerPixelY: mode_lib->vba.BytePerPixelY,
3098 BytePerPixelC: mode_lib->vba.BytePerPixelC,
3099 HTotal: mode_lib->vba.HTotal,
3100 PixelClock: mode_lib->vba.PixelClock,
3101 PDEAndMetaPTEBytesPerFrame: mode_lib->vba.PDEAndMetaPTEBytesPerFrame,
3102 DPTEBytesPerRow: mode_lib->vba.DPTEBytesPerRow,
3103 MetaRowBytes: mode_lib->vba.MetaRowBytes,
3104 DynamicMetadataEnable: mode_lib->vba.DynamicMetadataEnable,
3105 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
3106 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
3107 DCFCLKPerState: mode_lib->vba.DCFCLKPerState,
3108
3109 /* Output */
3110 DCFCLKState: mode_lib->vba.DCFCLKState);
3111 } // UseMinimumRequiredDCFCLK == true
3112
3113 for (i = start_state; i < (int) v->soc.num_states; ++i) {
3114 for (j = 0; j <= 1; ++j) {
3115 mode_lib->vba.ReturnBWPerState[i][j] = dml32_get_return_bw_mbps(soc: &mode_lib->vba.soc, VoltageLevel: i,
3116 HostVMEnable: mode_lib->vba.HostVMEnable, DCFCLK: mode_lib->vba.DCFCLKState[i][j],
3117 FabricClock: mode_lib->vba.FabricClockPerState[i], DRAMSpeed: mode_lib->vba.DRAMSpeedPerState[i]);
3118 }
3119 }
3120
3121 //Re-ordering Buffer Support Check
3122 for (i = start_state; i < (int) v->soc.num_states; ++i) {
3123 for (j = 0; j <= 1; ++j) {
3124 if ((mode_lib->vba.ROBBufferSizeInKByte - mode_lib->vba.PixelChunkSizeInKByte) * 1024
3125 / mode_lib->vba.ReturnBWPerState[i][j]
3126 > (mode_lib->vba.RoundTripPingLatencyCycles + 32)
3127 / mode_lib->vba.DCFCLKState[i][j]
3128 + v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ReorderingBytes / mode_lib->vba.ReturnBWPerState[i][j]) {
3129 mode_lib->vba.ROBSupport[i][j] = true;
3130 } else {
3131 mode_lib->vba.ROBSupport[i][j] = false;
3132 }
3133 }
3134 }
3135
3136 //Vertical Active BW support check
3137 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth = 0;
3138
3139 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3140 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth += mode_lib->vba.ReadBandwidthLuma[k]
3141 + mode_lib->vba.ReadBandwidthChroma[k];
3142 }
3143
3144 for (i = start_state; i < (int) v->soc.num_states; ++i) {
3145 for (j = 0; j <= 1; ++j) {
3146 mode_lib->vba.MaxTotalVerticalActiveAvailableBandwidth[i][j] =
3147 dml_min3(a: mode_lib->vba.ReturnBusWidth * mode_lib->vba.DCFCLKState[i][j]
3148 * mode_lib->vba.MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation / 100,
3149 b: mode_lib->vba.FabricClockPerState[i]
3150 * mode_lib->vba.FabricDatapathToDCNDataReturn
3151 * mode_lib->vba.MaxAveragePercentOfIdealFabricBWDisplayCanUseInNormalSystemOperation / 100,
3152 c: mode_lib->vba.DRAMSpeedPerState[i]
3153 * mode_lib->vba.NumberOfChannels
3154 * mode_lib->vba.DRAMChannelWidth
3155 * (i < 2 ? mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperationSTROBE : mode_lib->vba.MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperation) / 100);
3156
3157 if (v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.MaxTotalVActiveRDBandwidth
3158 <= mode_lib->vba.MaxTotalVerticalActiveAvailableBandwidth[i][j]) {
3159 mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][j] = true;
3160 } else {
3161 mode_lib->vba.TotalVerticalActiveBandwidthSupport[i][j] = false;
3162 }
3163 }
3164 }
3165
3166 /* Prefetch Check */
3167
3168 for (i = start_state; i < (int) v->soc.num_states; ++i) {
3169 for (j = 0; j <= 1; ++j) {
3170
3171 mode_lib->vba.TimeCalc = 24 / mode_lib->vba.ProjectedDCFCLKDeepSleep[i][j];
3172
3173 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3174 mode_lib->vba.NoOfDPPThisState[k] = mode_lib->vba.NoOfDPP[i][j][k];
3175 mode_lib->vba.swath_width_luma_ub_this_state[k] =
3176 mode_lib->vba.swath_width_luma_ub_all_states[i][j][k];
3177 mode_lib->vba.swath_width_chroma_ub_this_state[k] =
3178 mode_lib->vba.swath_width_chroma_ub_all_states[i][j][k];
3179 mode_lib->vba.SwathWidthYThisState[k] = mode_lib->vba.SwathWidthYAllStates[i][j][k];
3180 mode_lib->vba.SwathWidthCThisState[k] = mode_lib->vba.SwathWidthCAllStates[i][j][k];
3181 mode_lib->vba.SwathHeightYThisState[k] = mode_lib->vba.SwathHeightYAllStates[i][j][k];
3182 mode_lib->vba.SwathHeightCThisState[k] = mode_lib->vba.SwathHeightCAllStates[i][j][k];
3183 mode_lib->vba.UnboundedRequestEnabledThisState =
3184 mode_lib->vba.UnboundedRequestEnabledAllStates[i][j];
3185 mode_lib->vba.CompressedBufferSizeInkByteThisState =
3186 mode_lib->vba.CompressedBufferSizeInkByteAllStates[i][j];
3187 mode_lib->vba.DETBufferSizeInKByteThisState[k] =
3188 mode_lib->vba.DETBufferSizeInKByteAllStates[i][j][k];
3189 mode_lib->vba.DETBufferSizeYThisState[k] =
3190 mode_lib->vba.DETBufferSizeYAllStates[i][j][k];
3191 mode_lib->vba.DETBufferSizeCThisState[k] =
3192 mode_lib->vba.DETBufferSizeCAllStates[i][j][k];
3193 }
3194
3195 mode_lib->vba.VActiveBandwithSupport[i][j] = dml32_CalculateVActiveBandwithSupport(
3196 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3197 ReturnBW: mode_lib->vba.ReturnBWPerState[i][j],
3198 NotUrgentLatencyHiding: mode_lib->vba.NoUrgentLatencyHiding,
3199 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
3200 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
3201 cursor_bw: mode_lib->vba.cursor_bw,
3202 meta_row_bandwidth: mode_lib->vba.meta_row_bandwidth_this_state,
3203 dpte_row_bandwidth: mode_lib->vba.dpte_row_bandwidth_this_state,
3204 NumberOfDPP: mode_lib->vba.NoOfDPPThisState,
3205 UrgentBurstFactorLuma: mode_lib->vba.UrgentBurstFactorLuma,
3206 UrgentBurstFactorChroma: mode_lib->vba.UrgentBurstFactorChroma,
3207 UrgentBurstFactorCursor: mode_lib->vba.UrgentBurstFactorCursor);
3208
3209 mode_lib->vba.NotEnoughDETSwathFillLatencyHidingPerState[i][j] = dml32_CalculateDETSwathFillLatencyHiding(
3210 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3211 ReturnBW: mode_lib->vba.ReturnBWPerState[i][j],
3212 UrgentLatency: mode_lib->vba.UrgLatency[i],
3213 SwathHeightY: mode_lib->vba.SwathHeightYThisState,
3214 SwathHeightC: mode_lib->vba.SwathHeightCThisState,
3215 SwathWidthY: mode_lib->vba.swath_width_luma_ub_this_state,
3216 SwathWidthC: mode_lib->vba.swath_width_chroma_ub_this_state,
3217 BytePerPixelInDETY: mode_lib->vba.BytePerPixelInDETY,
3218 BytePerPixelInDETC: mode_lib->vba.BytePerPixelInDETC,
3219 DETBufferSizeY: mode_lib->vba.DETBufferSizeYThisState,
3220 DETBufferSizeC: mode_lib->vba.DETBufferSizeCThisState,
3221 NumOfDPP: mode_lib->vba.NoOfDPPThisState,
3222 HTotal: mode_lib->vba.HTotal,
3223 PixelClock: mode_lib->vba.PixelClock,
3224 VRatioY: mode_lib->vba.VRatio,
3225 VRatioC: mode_lib->vba.VRatioChroma,
3226 UsesMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange,
3227 UseUnboundedRequesting: mode_lib->vba.UseUnboundedRequesting);
3228
3229 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.VMDataOnlyReturnBWPerState = dml32_get_return_bw_mbps_vm_only(soc: &mode_lib->vba.soc, VoltageLevel: i,
3230 DCFCLK: mode_lib->vba.DCFCLKState[i][j], FabricClock: mode_lib->vba.FabricClockPerState[i],
3231 DRAMSpeed: mode_lib->vba.DRAMSpeedPerState[i]);
3232 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor = 1;
3233
3234 if (mode_lib->vba.GPUVMEnable && mode_lib->vba.HostVMEnable)
3235 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor = mode_lib->vba.ReturnBWPerState[i][j]
3236 / v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.VMDataOnlyReturnBWPerState;
3237
3238 mode_lib->vba.ExtraLatency = dml32_CalculateExtraLatency(
3239 RoundTripPingLatencyCycles: mode_lib->vba.RoundTripPingLatencyCycles, ReorderingBytes: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.ReorderingBytes,
3240 DCFCLK: mode_lib->vba.DCFCLKState[i][j], TotalNumberOfActiveDPP: mode_lib->vba.TotalNumberOfActiveDPP[i][j],
3241 PixelChunkSizeInKByte: mode_lib->vba.PixelChunkSizeInKByte,
3242 TotalNumberOfDCCActiveDPP: mode_lib->vba.TotalNumberOfDCCActiveDPP[i][j], MetaChunkSize: mode_lib->vba.MetaChunkSize,
3243 ReturnBW: mode_lib->vba.ReturnBWPerState[i][j], GPUVMEnable: mode_lib->vba.GPUVMEnable,
3244 HostVMEnable: mode_lib->vba.HostVMEnable, NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3245 NumberOfDPP: mode_lib->vba.NoOfDPPThisState, dpte_group_bytes: mode_lib->vba.dpte_group_bytes,
3246 HostVMInefficiencyFactor: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor, HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
3247 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels);
3248
3249 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NextPrefetchModeState = mode_lib->vba.MinPrefetchMode;
3250
3251 mode_lib->vba.NextMaxVStartup = mode_lib->vba.MaxMaxVStartup[i][j];
3252
3253 do {
3254 mode_lib->vba.PrefetchModePerState[i][j] = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NextPrefetchModeState;
3255 mode_lib->vba.MaxVStartup = mode_lib->vba.NextMaxVStartup;
3256
3257 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3258 mode_lib->vba.TWait = dml32_CalculateTWait(
3259 PrefetchMode: mode_lib->vba.PrefetchModePerState[i][j],
3260 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange[k],
3261 SynchronizeDRRDisplaysForUCLKPStateChangeFinal: mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
3262 DRRDisplay: mode_lib->vba.DRRDisplay[k],
3263 DRAMClockChangeLatency: mode_lib->vba.DRAMClockChangeLatency,
3264 FCLKChangeLatency: mode_lib->vba.FCLKChangeLatency, UrgentLatency: mode_lib->vba.UrgLatency[i],
3265 SREnterPlusExitTime: mode_lib->vba.SREnterPlusExitTime);
3266
3267 memset(&v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull, 0, sizeof(DmlPipe));
3268 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.Dppclk = mode_lib->vba.RequiredDPPCLK[i][j][k];
3269 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.Dispclk = mode_lib->vba.RequiredDISPCLK[i][j];
3270 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.PixelClock = mode_lib->vba.PixelClock[k];
3271 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.DCFClkDeepSleep = mode_lib->vba.ProjectedDCFCLKDeepSleep[i][j];
3272 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.DPPPerSurface = mode_lib->vba.NoOfDPP[i][j][k];
3273 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.ScalerEnabled = mode_lib->vba.ScalerEnabled[k];
3274 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.SourceRotation = mode_lib->vba.SourceRotation[k];
3275 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.BlockWidth256BytesY = mode_lib->vba.Read256BlockWidthY[k];
3276 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.BlockHeight256BytesY = mode_lib->vba.Read256BlockHeightY[k];
3277 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.BlockWidth256BytesC = mode_lib->vba.Read256BlockWidthC[k];
3278 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.BlockHeight256BytesC = mode_lib->vba.Read256BlockHeightC[k];
3279 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.InterlaceEnable = mode_lib->vba.Interlace[k];
3280 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.NumberOfCursors = mode_lib->vba.NumberOfCursors[k];
3281 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.VBlank = mode_lib->vba.VTotal[k] - mode_lib->vba.VActive[k];
3282 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.HTotal = mode_lib->vba.HTotal[k];
3283 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.HActive = mode_lib->vba.HActive[k];
3284 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.DCCEnable = mode_lib->vba.DCCEnable[k];
3285 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.ODMMode = mode_lib->vba.ODMCombineEnablePerState[i][k];
3286 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.SourcePixelFormat = mode_lib->vba.SourcePixelFormat[k];
3287 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.BytePerPixelY = mode_lib->vba.BytePerPixelY[k];
3288 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.BytePerPixelC = mode_lib->vba.BytePerPixelC[k];
3289 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe.ProgressiveToInterlaceUnitInOPP =
3290 mode_lib->vba.ProgressiveToInterlaceUnitInOPP;
3291
3292 mode_lib->vba.NoTimeForPrefetch[i][j][k] =
3293 dml32_CalculatePrefetchSchedule(
3294 v,
3295 k,
3296 HostVMInefficiencyFactor: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor,
3297 myPipe: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe,
3298 DSCDelay: v->DSCDelayPerState[i][k],
3299 DPP_RECOUT_WIDTH: v->SwathWidthYThisState[k] / v->HRatio[k],
3300 VStartup: dml_min(a: v->MaxVStartup, b: v->MaximumVStartup[i][j][k]),
3301 MaxVStartup: v->MaximumVStartup[i][j][k],
3302 UrgentLatency: v->UrgLatency[i],
3303 UrgentExtraLatency: v->ExtraLatency,
3304 TCalc: v->TimeCalc,
3305 PDEAndMetaPTEBytesFrame: v->PDEAndMetaPTEBytesPerFrame[i][j][k],
3306 MetaRowByte: v->MetaRowBytes[i][j][k],
3307 PixelPTEBytesPerRow: v->DPTEBytesPerRow[i][j][k],
3308 PrefetchSourceLinesY: v->PrefetchLinesY[i][j][k],
3309 SwathWidthY: v->SwathWidthYThisState[k],
3310 VInitPreFillY: v->PrefillY[k],
3311 MaxNumSwathY: v->MaxNumSwY[k],
3312 PrefetchSourceLinesC: v->PrefetchLinesC[i][j][k],
3313 SwathWidthC: v->SwathWidthCThisState[k],
3314 VInitPreFillC: v->PrefillC[k],
3315 MaxNumSwathC: v->MaxNumSwC[k],
3316 swath_width_luma_ub: v->swath_width_luma_ub_this_state[k],
3317 swath_width_chroma_ub: v->swath_width_chroma_ub_this_state[k],
3318 SwathHeightY: v->SwathHeightYThisState[k],
3319 SwathHeightC: v->SwathHeightCThisState[k], TWait: v->TWait,
3320 TPreReq: (v->DRAMSpeedPerState[i] <= MEM_STROBE_FREQ_MHZ || v->DCFCLKState[i][j] <= DCFCLK_FREQ_EXTRA_PREFETCH_REQ_MHZ) ?
3321 mode_lib->vba.ip.min_prefetch_in_strobe_us : 0,
3322 ExtendPrefetchIfPossible: mode_lib->vba.PrefetchModePerState[i][j] > 0 || mode_lib->vba.DRAMClockChangeRequirementFinal == false,
3323
3324 /* Output */
3325 DSTXAfterScaler: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],
3326 DSTYAfterScaler: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler[k],
3327 DestinationLinesForPrefetch: &v->LineTimesForPrefetch[k],
3328 PrefetchBandwidth: &v->PrefetchBW[k],
3329 DestinationLinesToRequestVMInVBlank: &v->LinesForMetaPTE[k],
3330 DestinationLinesToRequestRowInVBlank: &v->LinesForMetaAndDPTERow[k],
3331 VRatioPrefetchY: &v->VRatioPreY[i][j][k],
3332 VRatioPrefetchC: &v->VRatioPreC[i][j][k],
3333 RequiredPrefetchPixDataBWLuma: &v->RequiredPrefetchPixelDataBWLuma[0][0][k],
3334 RequiredPrefetchPixDataBWChroma: &v->RequiredPrefetchPixelDataBWChroma[0][0][k],
3335 NotEnoughTimeForDynamicMetadata: &v->NoTimeForDynamicMetadata[i][j][k],
3336 Tno_bw: &v->Tno_bw[k],
3337 prefetch_vmrow_bw: &v->prefetch_vmrow_bw[k],
3338 Tdmdl_vm: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[0], // double *Tdmdl_vm
3339 Tdmdl: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[1], // double *Tdmdl
3340 TSetup: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[2], // double *TSetup
3341 VUpdateOffsetPix: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer[0], // unsigned int *VUpdateOffsetPix
3342 VUpdateWidthPix: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[3], // unsigned int *VUpdateWidthPix
3343 VReadyOffsetPix: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[4]); // unsigned int *VReadyOffsetPix
3344 }
3345
3346 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3347 dml32_CalculateUrgentBurstFactor(
3348 UseMALLForPStateChange: mode_lib->vba.UsesMALLForPStateChange[k],
3349 swath_width_luma_ub: mode_lib->vba.swath_width_luma_ub_this_state[k],
3350 swath_width_chroma_ub: mode_lib->vba.swath_width_chroma_ub_this_state[k],
3351 SwathHeightY: mode_lib->vba.SwathHeightYThisState[k],
3352 SwathHeightC: mode_lib->vba.SwathHeightCThisState[k],
3353 LineTime: mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k],
3354 UrgentLatency: mode_lib->vba.UrgLatency[i], CursorBufferSize: mode_lib->vba.CursorBufferSize,
3355 CursorWidth: mode_lib->vba.CursorWidth[k][0], CursorBPP: mode_lib->vba.CursorBPP[k][0],
3356 VRatio: mode_lib->vba.VRatioPreY[i][j][k],
3357 VRatioC: mode_lib->vba.VRatioPreC[i][j][k],
3358 BytePerPixelInDETY: mode_lib->vba.BytePerPixelInDETY[k],
3359 BytePerPixelInDETC: mode_lib->vba.BytePerPixelInDETC[k],
3360 DETBufferSizeY: mode_lib->vba.DETBufferSizeYThisState[k],
3361 DETBufferSizeC: mode_lib->vba.DETBufferSizeCThisState[k],
3362 /* Output */
3363 UrgentBurstFactorCursor: &mode_lib->vba.UrgentBurstFactorCursorPre[k],
3364 UrgentBurstFactorLuma: &mode_lib->vba.UrgentBurstFactorLumaPre[k],
3365 UrgentBurstFactorChroma: &mode_lib->vba.UrgentBurstFactorChromaPre[k],
3366 NotEnoughUrgentLatencyHiding: &mode_lib->vba.NotUrgentLatencyHidingPre[k]);
3367 }
3368
3369 {
3370 dml32_CalculatePrefetchBandwithSupport(
3371 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3372 ReturnBW: mode_lib->vba.ReturnBWPerState[i][j],
3373 NotUrgentLatencyHiding: mode_lib->vba.NotUrgentLatencyHidingPre,
3374 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
3375 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
3376 PrefetchBandwidthLuma: mode_lib->vba.RequiredPrefetchPixelDataBWLuma[0][0],
3377 PrefetchBandwidthChroma: mode_lib->vba.RequiredPrefetchPixelDataBWChroma[0][0],
3378 cursor_bw: mode_lib->vba.cursor_bw,
3379 meta_row_bandwidth: mode_lib->vba.meta_row_bandwidth_this_state,
3380 dpte_row_bandwidth: mode_lib->vba.dpte_row_bandwidth_this_state,
3381 cursor_bw_pre: mode_lib->vba.cursor_bw_pre,
3382 prefetch_vmrow_bw: mode_lib->vba.prefetch_vmrow_bw,
3383 NumberOfDPP: mode_lib->vba.NoOfDPPThisState,
3384 UrgentBurstFactorLuma: mode_lib->vba.UrgentBurstFactorLuma,
3385 UrgentBurstFactorChroma: mode_lib->vba.UrgentBurstFactorChroma,
3386 UrgentBurstFactorCursor: mode_lib->vba.UrgentBurstFactorCursor,
3387 UrgentBurstFactorLumaPre: mode_lib->vba.UrgentBurstFactorLumaPre,
3388 UrgentBurstFactorChromaPre: mode_lib->vba.UrgentBurstFactorChromaPre,
3389 UrgentBurstFactorCursorPre: mode_lib->vba.UrgentBurstFactorCursorPre,
3390 PrefetchBW: v->PrefetchBW,
3391 VRatio: v->VRatio,
3392 MaxVRatioPre: v->MaxVRatioPre,
3393
3394 /* output */
3395 MaxPrefetchBandwidth: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[0], // Single *PrefetchBandwidth
3396 FractionOfUrgentBandwidth: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[1], // Single *FractionOfUrgentBandwidth
3397 PrefetchBandwidthSupport: &mode_lib->vba.PrefetchSupported[i][j]);
3398 }
3399
3400 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3401 if (mode_lib->vba.LineTimesForPrefetch[k]
3402 < 2.0 || mode_lib->vba.LinesForMetaPTE[k] >= 32.0
3403 || mode_lib->vba.LinesForMetaAndDPTERow[k] >= 16.0
3404 || mode_lib->vba.NoTimeForPrefetch[i][j][k] == true) {
3405 mode_lib->vba.PrefetchSupported[i][j] = false;
3406 }
3407 }
3408
3409 mode_lib->vba.DynamicMetadataSupported[i][j] = true;
3410 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3411 if (mode_lib->vba.NoTimeForDynamicMetadata[i][j][k] == true)
3412 mode_lib->vba.DynamicMetadataSupported[i][j] = false;
3413 }
3414
3415 mode_lib->vba.VRatioInPrefetchSupported[i][j] = true;
3416 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3417 if (mode_lib->vba.VRatioPreY[i][j][k] > mode_lib->vba.MaxVRatioPre
3418 || mode_lib->vba.VRatioPreC[i][j][k] > mode_lib->vba.MaxVRatioPre
3419 || mode_lib->vba.NoTimeForPrefetch[i][j][k] == true) {
3420 mode_lib->vba.VRatioInPrefetchSupported[i][j] = false;
3421 }
3422 }
3423 mode_lib->vba.AnyLinesForVMOrRowTooLarge = false;
3424 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3425 if (mode_lib->vba.LinesForMetaAndDPTERow[k] >= 16
3426 || mode_lib->vba.LinesForMetaPTE[k] >= 32) {
3427 mode_lib->vba.AnyLinesForVMOrRowTooLarge = true;
3428 }
3429 }
3430
3431 if (mode_lib->vba.PrefetchSupported[i][j] == true
3432 && mode_lib->vba.VRatioInPrefetchSupported[i][j] == true) {
3433 mode_lib->vba.BandwidthAvailableForImmediateFlip =
3434 dml32_CalculateBandwidthAvailableForImmediateFlip(
3435 NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3436 ReturnBW: mode_lib->vba.ReturnBWPerState[i][j],
3437 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
3438 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
3439 PrefetchBandwidthLuma: mode_lib->vba.RequiredPrefetchPixelDataBWLuma[0][0],
3440 PrefetchBandwidthChroma: mode_lib->vba.RequiredPrefetchPixelDataBWChroma[0][0],
3441 cursor_bw: mode_lib->vba.cursor_bw,
3442 cursor_bw_pre: mode_lib->vba.cursor_bw_pre,
3443 NumberOfDPP: mode_lib->vba.NoOfDPPThisState,
3444 UrgentBurstFactorLuma: mode_lib->vba.UrgentBurstFactorLuma,
3445 UrgentBurstFactorChroma: mode_lib->vba.UrgentBurstFactorChroma,
3446 UrgentBurstFactorCursor: mode_lib->vba.UrgentBurstFactorCursor,
3447 UrgentBurstFactorLumaPre: mode_lib->vba.UrgentBurstFactorLumaPre,
3448 UrgentBurstFactorChromaPre: mode_lib->vba.UrgentBurstFactorChromaPre,
3449 UrgentBurstFactorCursorPre: mode_lib->vba.UrgentBurstFactorCursorPre);
3450
3451 mode_lib->vba.TotImmediateFlipBytes = 0.0;
3452 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3453 if (!(mode_lib->vba.ImmediateFlipRequirement[k] ==
3454 dm_immediate_flip_not_required)) {
3455 mode_lib->vba.TotImmediateFlipBytes =
3456 mode_lib->vba.TotImmediateFlipBytes
3457 + mode_lib->vba.NoOfDPP[i][j][k]
3458 * mode_lib->vba.PDEAndMetaPTEBytesPerFrame[i][j][k]
3459 + mode_lib->vba.MetaRowBytes[i][j][k];
3460 if (mode_lib->vba.use_one_row_for_frame_flip[i][j][k]) {
3461 mode_lib->vba.TotImmediateFlipBytes =
3462 mode_lib->vba.TotImmediateFlipBytes + 2
3463 * mode_lib->vba.DPTEBytesPerRow[i][j][k];
3464 } else {
3465 mode_lib->vba.TotImmediateFlipBytes =
3466 mode_lib->vba.TotImmediateFlipBytes
3467 + mode_lib->vba.DPTEBytesPerRow[i][j][k];
3468 }
3469 }
3470 }
3471
3472 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3473 dml32_CalculateFlipSchedule(HostVMInefficiencyFactor: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor,
3474 UrgentExtraLatency: mode_lib->vba.ExtraLatency,
3475 UrgentLatency: mode_lib->vba.UrgLatency[i],
3476 GPUVMMaxPageTableLevels: mode_lib->vba.GPUVMMaxPageTableLevels,
3477 HostVMEnable: mode_lib->vba.HostVMEnable,
3478 HostVMMaxNonCachedPageTableLevels: mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
3479 GPUVMEnable: mode_lib->vba.GPUVMEnable,
3480 HostVMMinPageSize: mode_lib->vba.HostVMMinPageSize,
3481 PDEAndMetaPTEBytesPerFrame: mode_lib->vba.PDEAndMetaPTEBytesPerFrame[i][j][k],
3482 MetaRowBytes: mode_lib->vba.MetaRowBytes[i][j][k],
3483 DPTEBytesPerRow: mode_lib->vba.DPTEBytesPerRow[i][j][k],
3484 BandwidthAvailableForImmediateFlip: mode_lib->vba.BandwidthAvailableForImmediateFlip,
3485 TotImmediateFlipBytes: mode_lib->vba.TotImmediateFlipBytes,
3486 SourcePixelFormat: mode_lib->vba.SourcePixelFormat[k],
3487 LineTime: (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]),
3488 VRatio: mode_lib->vba.VRatio[k],
3489 VRatioChroma: mode_lib->vba.VRatioChroma[k],
3490 Tno_bw: mode_lib->vba.Tno_bw[k],
3491 DCCEnable: mode_lib->vba.DCCEnable[k],
3492 dpte_row_height: mode_lib->vba.dpte_row_height[k],
3493 meta_row_height: mode_lib->vba.meta_row_height[k],
3494 dpte_row_height_chroma: mode_lib->vba.dpte_row_height_chroma[k],
3495 meta_row_height_chroma: mode_lib->vba.meta_row_height_chroma[k],
3496 use_one_row_for_frame_flip: mode_lib->vba.use_one_row_for_frame_flip[i][j][k], // 24
3497
3498 /* Output */
3499 DestinationLinesToRequestVMInImmediateFlip: &mode_lib->vba.DestinationLinesToRequestVMInImmediateFlip[k],
3500 DestinationLinesToRequestRowInImmediateFlip: &mode_lib->vba.DestinationLinesToRequestRowInImmediateFlip[k],
3501 final_flip_bw: &mode_lib->vba.final_flip_bw[k],
3502 ImmediateFlipSupportedForPipe: &mode_lib->vba.ImmediateFlipSupportedForPipe[k]);
3503 }
3504
3505 {
3506 dml32_CalculateImmediateFlipBandwithSupport(NumberOfActiveSurfaces: mode_lib->vba.NumberOfActiveSurfaces,
3507 ReturnBW: mode_lib->vba.ReturnBWPerState[i][j],
3508 ImmediateFlipRequirement: mode_lib->vba.ImmediateFlipRequirement,
3509 final_flip_bw: mode_lib->vba.final_flip_bw,
3510 ReadBandwidthLuma: mode_lib->vba.ReadBandwidthLuma,
3511 ReadBandwidthChroma: mode_lib->vba.ReadBandwidthChroma,
3512 PrefetchBandwidthLuma: mode_lib->vba.RequiredPrefetchPixelDataBWLuma[0][0],
3513 PrefetchBandwidthChroma: mode_lib->vba.RequiredPrefetchPixelDataBWChroma[0][0],
3514 cursor_bw: mode_lib->vba.cursor_bw,
3515 meta_row_bandwidth: mode_lib->vba.meta_row_bandwidth_this_state,
3516 dpte_row_bandwidth: mode_lib->vba.dpte_row_bandwidth_this_state,
3517 cursor_bw_pre: mode_lib->vba.cursor_bw_pre,
3518 prefetch_vmrow_bw: mode_lib->vba.prefetch_vmrow_bw,
3519 NumberOfDPP: mode_lib->vba.DPPPerPlane,
3520 UrgentBurstFactorLuma: mode_lib->vba.UrgentBurstFactorLuma,
3521 UrgentBurstFactorChroma: mode_lib->vba.UrgentBurstFactorChroma,
3522 UrgentBurstFactorCursor: mode_lib->vba.UrgentBurstFactorCursor,
3523 UrgentBurstFactorLumaPre: mode_lib->vba.UrgentBurstFactorLumaPre,
3524 UrgentBurstFactorChromaPre: mode_lib->vba.UrgentBurstFactorChromaPre,
3525 UrgentBurstFactorCursorPre: mode_lib->vba.UrgentBurstFactorCursorPre,
3526
3527 /* output */
3528 TotalBandwidth: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[0], // Single *TotalBandwidth
3529 FractionOfUrgentBandwidth: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[1], // Single *FractionOfUrgentBandwidth
3530 ImmediateFlipBandwidthSupport: &mode_lib->vba.ImmediateFlipSupportedForState[i][j]); // Boolean *ImmediateFlipBandwidthSupport
3531 }
3532
3533 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3534 if (!(mode_lib->vba.ImmediateFlipRequirement[k]
3535 == dm_immediate_flip_not_required)
3536 && (mode_lib->vba.ImmediateFlipSupportedForPipe[k]
3537 == false))
3538 mode_lib->vba.ImmediateFlipSupportedForState[i][j] = false;
3539 }
3540 } else { // if prefetch not support, assume iflip not supported
3541 mode_lib->vba.ImmediateFlipSupportedForState[i][j] = false;
3542 }
3543
3544 if (mode_lib->vba.MaxVStartup <= __DML_VBA_MIN_VSTARTUP__
3545 || mode_lib->vba.AnyLinesForVMOrRowTooLarge == false) {
3546 mode_lib->vba.NextMaxVStartup = mode_lib->vba.MaxMaxVStartup[i][j];
3547 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NextPrefetchModeState = v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NextPrefetchModeState + 1;
3548 } else {
3549 mode_lib->vba.NextMaxVStartup = mode_lib->vba.NextMaxVStartup - 1;
3550 }
3551 } while (!((mode_lib->vba.PrefetchSupported[i][j] == true
3552 && mode_lib->vba.DynamicMetadataSupported[i][j] == true
3553 && mode_lib->vba.VRatioInPrefetchSupported[i][j] == true &&
3554 // consider flip support is okay if when there is no hostvm and the
3555 // user does't require a iflip OR the flip bw is ok
3556 // If there is hostvm, DCN needs to support iflip for invalidation
3557 ((mode_lib->vba.HostVMEnable == false
3558 && !mode_lib->vba.ImmediateFlipRequiredFinal)
3559 || mode_lib->vba.ImmediateFlipSupportedForState[i][j] == true))
3560 || (mode_lib->vba.NextMaxVStartup == mode_lib->vba.MaxMaxVStartup[i][j]
3561 && v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.NextPrefetchModeState > mode_lib->vba.MaxPrefetchMode)));
3562
3563 for (k = 0; k < mode_lib->vba.NumberOfActiveSurfaces; ++k) {
3564 mode_lib->vba.use_one_row_for_frame_this_state[k] =
3565 mode_lib->vba.use_one_row_for_frame[i][j][k];
3566 }
3567
3568
3569 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.UrgentLatency = mode_lib->vba.UrgLatency[i];
3570 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.ExtraLatency = mode_lib->vba.ExtraLatency;
3571 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.WritebackLatency = mode_lib->vba.WritebackLatency;
3572 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.DRAMClockChangeLatency = mode_lib->vba.DRAMClockChangeLatency;
3573 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.FCLKChangeLatency = mode_lib->vba.FCLKChangeLatency;
3574 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.SRExitTime = mode_lib->vba.SRExitTime;
3575 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.SREnterPlusExitTime = mode_lib->vba.SREnterPlusExitTime;
3576 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.SRExitZ8Time = mode_lib->vba.SRExitZ8Time;
3577 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.SREnterPlusExitZ8Time = mode_lib->vba.SREnterPlusExitZ8Time;
3578 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.USRRetrainingLatency = mode_lib->vba.USRRetrainingLatency;
3579 v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters.SMNLatency = mode_lib->vba.SMNLatency;
3580
3581 {
3582 dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
3583 v,
3584 PrefetchMode: v->PrefetchModePerState[i][j],
3585 DCFCLK: v->DCFCLKState[i][j],
3586 ReturnBW: v->ReturnBWPerState[i][j],
3587 mmSOCParameters: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters,
3588 SOCCLK: v->SOCCLKPerState[i],
3589 DCFClkDeepSleep: v->ProjectedDCFCLKDeepSleep[i][j],
3590 DETBufferSizeY: v->DETBufferSizeYThisState,
3591 DETBufferSizeC: v->DETBufferSizeCThisState,
3592 SwathHeightY: v->SwathHeightYThisState,
3593 SwathHeightC: v->SwathHeightCThisState,
3594 SwathWidthY: v->SwathWidthYThisState, // 24
3595 SwathWidthC: v->SwathWidthCThisState,
3596 DPPPerSurface: v->NoOfDPPThisState,
3597 BytePerPixelDETY: v->BytePerPixelInDETY,
3598 BytePerPixelDETC: v->BytePerPixelInDETC,
3599 DSTXAfterScaler: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler,
3600 DSTYAfterScaler: v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler,
3601 UnboundedRequestEnabled: v->UnboundedRequestEnabledThisState,
3602 CompressedBufferSizeInkByte: v->CompressedBufferSizeInkByteThisState,
3603
3604 /* Output */
3605 DRAMClockChangeSupport: &v->DRAMClockChangeSupport[i][j],
3606 MaxActiveDRAMClockChangeLatencySupported: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[0], // double *MaxActiveDRAMClockChangeLatencySupported
3607 SubViewportLinesNeededInMALL: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer[0], // Long SubViewportLinesNeededInMALL[]
3608 FCLKChangeSupport: &v->FCLKChangeSupport[i][j],
3609 MinActiveFCLKChangeLatencySupported: &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[1], // double *MinActiveFCLKChangeLatencySupported
3610 USRRetrainingSupport: &mode_lib->vba.USRRetrainingSupport[i][j],
3611 ActiveDRAMClockChangeLatencyMargin: mode_lib->vba.ActiveDRAMClockChangeLatencyMarginPerState[i][j]);
3612 }
3613 }
3614 } // End of Prefetch Check
3615
3616 /*Cursor Support Check*/
3617 mode_lib->vba.CursorSupport = true;
3618 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3619 if (mode_lib->vba.CursorWidth[k][0] > 0.0) {
3620 if (mode_lib->vba.CursorBPP[k][0] == 64 && mode_lib->vba.Cursor64BppSupport == false)
3621 mode_lib->vba.CursorSupport = false;
3622 }
3623 }
3624
3625 /*Valid Pitch Check*/
3626 mode_lib->vba.PitchSupport = true;
3627 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3628 mode_lib->vba.AlignedYPitch[k] = dml_ceil(
3629 a: dml_max(a: mode_lib->vba.PitchY[k], b: mode_lib->vba.SurfaceWidthY[k]),
3630 granularity: mode_lib->vba.MacroTileWidthY[k]);
3631 if (mode_lib->vba.DCCEnable[k] == true) {
3632 mode_lib->vba.AlignedDCCMetaPitchY[k] = dml_ceil(
3633 a: dml_max(a: mode_lib->vba.DCCMetaPitchY[k], b: mode_lib->vba.SurfaceWidthY[k]),
3634 granularity: 64.0 * mode_lib->vba.Read256BlockWidthY[k]);
3635 } else {
3636 mode_lib->vba.AlignedDCCMetaPitchY[k] = mode_lib->vba.DCCMetaPitchY[k];
3637 }
3638 if (mode_lib->vba.SourcePixelFormat[k] != dm_444_64 && mode_lib->vba.SourcePixelFormat[k] != dm_444_32
3639 && mode_lib->vba.SourcePixelFormat[k] != dm_444_16
3640 && mode_lib->vba.SourcePixelFormat[k] != dm_mono_16
3641 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe
3642 && mode_lib->vba.SourcePixelFormat[k] != dm_mono_8) {
3643 mode_lib->vba.AlignedCPitch[k] = dml_ceil(
3644 a: dml_max(a: mode_lib->vba.PitchC[k], b: mode_lib->vba.SurfaceWidthC[k]),
3645 granularity: mode_lib->vba.MacroTileWidthC[k]);
3646 if (mode_lib->vba.DCCEnable[k] == true) {
3647 mode_lib->vba.AlignedDCCMetaPitchC[k] = dml_ceil(
3648 a: dml_max(a: mode_lib->vba.DCCMetaPitchC[k],
3649 b: mode_lib->vba.SurfaceWidthC[k]),
3650 granularity: 64.0 * mode_lib->vba.Read256BlockWidthC[k]);
3651 } else {
3652 mode_lib->vba.AlignedDCCMetaPitchC[k] = mode_lib->vba.DCCMetaPitchC[k];
3653 }
3654 } else {
3655 mode_lib->vba.AlignedCPitch[k] = mode_lib->vba.PitchC[k];
3656 mode_lib->vba.AlignedDCCMetaPitchC[k] = mode_lib->vba.DCCMetaPitchC[k];
3657 }
3658 if (mode_lib->vba.AlignedYPitch[k] > mode_lib->vba.PitchY[k]
3659 || mode_lib->vba.AlignedCPitch[k] > mode_lib->vba.PitchC[k]
3660 || mode_lib->vba.AlignedDCCMetaPitchY[k] > mode_lib->vba.DCCMetaPitchY[k]
3661 || mode_lib->vba.AlignedDCCMetaPitchC[k] > mode_lib->vba.DCCMetaPitchC[k]) {
3662 mode_lib->vba.PitchSupport = false;
3663 }
3664 }
3665
3666 mode_lib->vba.ViewportExceedsSurface = false;
3667 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3668 if (mode_lib->vba.ViewportWidth[k] > mode_lib->vba.SurfaceWidthY[k]
3669 || mode_lib->vba.ViewportHeight[k] > mode_lib->vba.SurfaceHeightY[k]) {
3670 mode_lib->vba.ViewportExceedsSurface = true;
3671 if (mode_lib->vba.SourcePixelFormat[k] != dm_444_64
3672 && mode_lib->vba.SourcePixelFormat[k] != dm_444_32
3673 && mode_lib->vba.SourcePixelFormat[k] != dm_444_16
3674 && mode_lib->vba.SourcePixelFormat[k] != dm_444_8
3675 && mode_lib->vba.SourcePixelFormat[k] != dm_rgbe) {
3676 if (mode_lib->vba.ViewportWidthChroma[k] > mode_lib->vba.SurfaceWidthC[k]
3677 || mode_lib->vba.ViewportHeightChroma[k]
3678 > mode_lib->vba.SurfaceHeightC[k]) {
3679 mode_lib->vba.ViewportExceedsSurface = true;
3680 }
3681 }
3682 }
3683 }
3684
3685 /*Mode Support, Voltage State and SOC Configuration*/
3686 mode_support_configuration(v, mode_lib);
3687
3688 MaximumMPCCombine = 0;
3689
3690 for (i = v->soc.num_states; i >= start_state; i--) {
3691 if (i == v->soc.num_states || mode_lib->vba.ModeSupport[i][0] == true ||
3692 mode_lib->vba.ModeSupport[i][1] == true) {
3693 mode_lib->vba.VoltageLevel = i;
3694 mode_lib->vba.ModeIsSupported = mode_lib->vba.ModeSupport[i][0] == true
3695 || mode_lib->vba.ModeSupport[i][1] == true;
3696
3697 if (mode_lib->vba.ModeSupport[i][0] == true)
3698 MaximumMPCCombine = 0;
3699 else
3700 MaximumMPCCombine = 1;
3701 }
3702 }
3703
3704 mode_lib->vba.ImmediateFlipSupport =
3705 mode_lib->vba.ImmediateFlipSupportedForState[mode_lib->vba.VoltageLevel][MaximumMPCCombine];
3706 mode_lib->vba.UnboundedRequestEnabled =
3707 mode_lib->vba.UnboundedRequestEnabledAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine];
3708 mode_lib->vba.CompressedBufferSizeInkByte =
3709 mode_lib->vba.CompressedBufferSizeInkByteAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine]; // Not used, informational
3710
3711 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3712 mode_lib->vba.MPCCombineEnable[k] =
3713 mode_lib->vba.MPCCombine[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3714 mode_lib->vba.DPPPerPlane[k] = mode_lib->vba.NoOfDPP[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3715 mode_lib->vba.SwathHeightY[k] =
3716 mode_lib->vba.SwathHeightYAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3717 mode_lib->vba.SwathHeightC[k] =
3718 mode_lib->vba.SwathHeightCAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3719 mode_lib->vba.DETBufferSizeInKByte[k] =
3720 mode_lib->vba.DETBufferSizeInKByteAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3721 mode_lib->vba.DETBufferSizeY[k] =
3722 mode_lib->vba.DETBufferSizeYAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3723 mode_lib->vba.DETBufferSizeC[k] =
3724 mode_lib->vba.DETBufferSizeCAllStates[mode_lib->vba.VoltageLevel][MaximumMPCCombine][k];
3725 mode_lib->vba.OutputType[k] = mode_lib->vba.OutputTypePerState[mode_lib->vba.VoltageLevel][k];
3726 mode_lib->vba.OutputRate[k] = mode_lib->vba.OutputRatePerState[mode_lib->vba.VoltageLevel][k];
3727 }
3728
3729 mode_lib->vba.DCFCLK = mode_lib->vba.DCFCLKState[mode_lib->vba.VoltageLevel][MaximumMPCCombine];
3730 mode_lib->vba.DRAMSpeed = mode_lib->vba.DRAMSpeedPerState[mode_lib->vba.VoltageLevel];
3731 mode_lib->vba.FabricClock = mode_lib->vba.FabricClockPerState[mode_lib->vba.VoltageLevel];
3732 mode_lib->vba.SOCCLK = mode_lib->vba.SOCCLKPerState[mode_lib->vba.VoltageLevel];
3733 mode_lib->vba.ReturnBW = mode_lib->vba.ReturnBWPerState[mode_lib->vba.VoltageLevel][MaximumMPCCombine];
3734 mode_lib->vba.DISPCLK = mode_lib->vba.RequiredDISPCLK[mode_lib->vba.VoltageLevel][MaximumMPCCombine];
3735 mode_lib->vba.maxMpcComb = MaximumMPCCombine;
3736
3737 for (k = 0; k <= mode_lib->vba.NumberOfActiveSurfaces - 1; k++) {
3738 if (mode_lib->vba.BlendingAndTiming[k] == k) {
3739 mode_lib->vba.ODMCombineEnabled[k] =
3740 mode_lib->vba.ODMCombineEnablePerState[mode_lib->vba.VoltageLevel][k];
3741 } else {
3742 mode_lib->vba.ODMCombineEnabled[k] = dm_odm_combine_mode_disabled;
3743 }
3744
3745 mode_lib->vba.DSCEnabled[k] = mode_lib->vba.RequiresDSC[mode_lib->vba.VoltageLevel][k];
3746 mode_lib->vba.FECEnable[k] = mode_lib->vba.RequiresFEC[mode_lib->vba.VoltageLevel][k];
3747 mode_lib->vba.OutputBpp[k] = mode_lib->vba.OutputBppPerState[mode_lib->vba.VoltageLevel][k];
3748 }
3749
3750 mode_lib->vba.UrgentWatermark = mode_lib->vba.Watermark.UrgentWatermark;
3751 mode_lib->vba.StutterEnterPlusExitWatermark = mode_lib->vba.Watermark.StutterEnterPlusExitWatermark;
3752 mode_lib->vba.StutterExitWatermark = mode_lib->vba.Watermark.StutterExitWatermark;
3753 mode_lib->vba.WritebackDRAMClockChangeWatermark = mode_lib->vba.Watermark.WritebackDRAMClockChangeWatermark;
3754 mode_lib->vba.DRAMClockChangeWatermark = mode_lib->vba.Watermark.DRAMClockChangeWatermark;
3755 mode_lib->vba.UrgentLatency = mode_lib->vba.UrgLatency[mode_lib->vba.VoltageLevel];
3756 mode_lib->vba.DCFCLKDeepSleep = mode_lib->vba.ProjectedDCFCLKDeepSleep[mode_lib->vba.VoltageLevel][MaximumMPCCombine];
3757
3758 /* VBA has Error type to Error Msg output here, but not necessary for DML-C */
3759} // ModeSupportAndSystemConfigurationFull
3760

source code of linux/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c