Merge tag 'pinctrl-v6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6-block.git] / drivers / gpu / drm / amd / display / dc / dml / dcn32 / display_mode_vba_util_32.h
1 /*
2  * Copyright 2022 Advanced Micro Devices, Inc.
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 #ifndef __DML_DCN32_DISPLAY_MODE_VBA_UTIL_32_H__
27 #define __DML_DCN32_DISPLAY_MODE_VBA_UTIL_32_H__
28
29 #include "../display_mode_enums.h"
30 #include "os_types.h"
31 #include "../dc_features.h"
32 #include "../display_mode_structs.h"
33 #include "dml/display_mode_vba.h"
34
35 unsigned int dml32_dscceComputeDelay(
36                 unsigned int bpc,
37                 double BPP,
38                 unsigned int sliceWidth,
39                 unsigned int numSlices,
40                 enum output_format_class pixelFormat,
41                 enum output_encoder_class Output);
42
43 unsigned int dml32_dscComputeDelay(enum output_format_class pixelFormat, enum output_encoder_class Output);
44
45 bool IsVertical(enum dm_rotation_angle Scan);
46
47 void dml32_CalculateBytePerPixelAndBlockSizes(
48                 enum source_format_class SourcePixelFormat,
49                 enum dm_swizzle_mode SurfaceTiling,
50
51                 /*Output*/
52                 unsigned int *BytePerPixelY,
53                 unsigned int *BytePerPixelC,
54                 double           *BytePerPixelDETY,
55                 double           *BytePerPixelDETC,
56                 unsigned int *BlockHeight256BytesY,
57                 unsigned int *BlockHeight256BytesC,
58                 unsigned int *BlockWidth256BytesY,
59                 unsigned int *BlockWidth256BytesC,
60                 unsigned int *MacroTileHeightY,
61                 unsigned int *MacroTileHeightC,
62                 unsigned int *MacroTileWidthY,
63                 unsigned int *MacroTileWidthC);
64
65 void dml32_CalculateSinglePipeDPPCLKAndSCLThroughput(
66                 double HRatio,
67                 double HRatioChroma,
68                 double VRatio,
69                 double VRatioChroma,
70                 double MaxDCHUBToPSCLThroughput,
71                 double MaxPSCLToLBThroughput,
72                 double PixelClock,
73                 enum source_format_class SourcePixelFormat,
74                 unsigned int HTaps,
75                 unsigned int HTapsChroma,
76                 unsigned int VTaps,
77                 unsigned int VTapsChroma,
78
79                 /* output */
80                 double *PSCL_THROUGHPUT,
81                 double *PSCL_THROUGHPUT_CHROMA,
82                 double *DPPCLKUsingSingleDPP);
83
84 void dml32_CalculateSwathAndDETConfiguration(
85                 struct dml32_CalculateSwathAndDETConfiguration *st_vars,
86                 unsigned int DETSizeOverride[],
87                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
88                 unsigned int ConfigReturnBufferSizeInKByte,
89                 unsigned int MaxTotalDETInKByte,
90                 unsigned int MinCompressedBufferSizeInKByte,
91                 double ForceSingleDPP,
92                 unsigned int NumberOfActiveSurfaces,
93                 unsigned int nomDETInKByte,
94                 enum unbounded_requesting_policy UseUnboundedRequestingFinal,
95                 bool DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment,
96                 unsigned int PixelChunkSizeKBytes,
97                 unsigned int ROBSizeKBytes,
98                 unsigned int CompressedBufferSegmentSizeInkByteFinal,
99                 enum output_encoder_class Output[],
100                 double ReadBandwidthLuma[],
101                 double ReadBandwidthChroma[],
102                 double MaximumSwathWidthLuma[],
103                 double MaximumSwathWidthChroma[],
104                 enum dm_rotation_angle SourceRotation[],
105                 bool ViewportStationary[],
106                 enum source_format_class SourcePixelFormat[],
107                 enum dm_swizzle_mode SurfaceTiling[],
108                 unsigned int ViewportWidth[],
109                 unsigned int ViewportHeight[],
110                 unsigned int ViewportXStart[],
111                 unsigned int ViewportYStart[],
112                 unsigned int ViewportXStartC[],
113                 unsigned int ViewportYStartC[],
114                 unsigned int SurfaceWidthY[],
115                 unsigned int SurfaceWidthC[],
116                 unsigned int SurfaceHeightY[],
117                 unsigned int SurfaceHeightC[],
118                 unsigned int Read256BytesBlockHeightY[],
119                 unsigned int Read256BytesBlockHeightC[],
120                 unsigned int Read256BytesBlockWidthY[],
121                 unsigned int Read256BytesBlockWidthC[],
122                 enum odm_combine_mode ODMMode[],
123                 unsigned int BlendingAndTiming[],
124                 unsigned int BytePerPixY[],
125                 unsigned int BytePerPixC[],
126                 double BytePerPixDETY[],
127                 double BytePerPixDETC[],
128                 unsigned int HActive[],
129                 double HRatio[],
130                 double HRatioChroma[],
131                 unsigned int DPPPerSurface[],
132
133                 /* Output */
134                 unsigned int swath_width_luma_ub[],
135                 unsigned int swath_width_chroma_ub[],
136                 double SwathWidth[],
137                 double SwathWidthChroma[],
138                 unsigned int SwathHeightY[],
139                 unsigned int SwathHeightC[],
140                 unsigned int DETBufferSizeInKByte[],
141                 unsigned int DETBufferSizeY[],
142                 unsigned int DETBufferSizeC[],
143                 bool *UnboundedRequestEnabled,
144                 unsigned int *CompressedBufferSizeInkByte,
145                 unsigned int *CompBufReservedSpaceKBytes,
146                 bool *CompBufReservedSpaceNeedAdjustment,
147                 bool ViewportSizeSupportPerSurface[],
148                 bool *ViewportSizeSupport);
149
150 void dml32_CalculateSwathWidth(
151                 bool ForceSingleDPP,
152                 unsigned int NumberOfActiveSurfaces,
153                 enum source_format_class SourcePixelFormat[],
154                 enum dm_rotation_angle SourceScan[],
155                 bool ViewportStationary[],
156                 unsigned int ViewportWidth[],
157                 unsigned int ViewportHeight[],
158                 unsigned int ViewportXStart[],
159                 unsigned int ViewportYStart[],
160                 unsigned int ViewportXStartC[],
161                 unsigned int ViewportYStartC[],
162                 unsigned int SurfaceWidthY[],
163                 unsigned int SurfaceWidthC[],
164                 unsigned int SurfaceHeightY[],
165                 unsigned int SurfaceHeightC[],
166                 enum odm_combine_mode ODMMode[],
167                 unsigned int BytePerPixY[],
168                 unsigned int BytePerPixC[],
169                 unsigned int Read256BytesBlockHeightY[],
170                 unsigned int Read256BytesBlockHeightC[],
171                 unsigned int Read256BytesBlockWidthY[],
172                 unsigned int Read256BytesBlockWidthC[],
173                 unsigned int BlendingAndTiming[],
174                 unsigned int HActive[],
175                 double HRatio[],
176                 unsigned int DPPPerSurface[],
177
178                 /* Output */
179                 double SwathWidthdoubleDPPY[],
180                 double SwathWidthdoubleDPPC[],
181                 double SwathWidthY[], // per-pipe
182                 double SwathWidthC[], // per-pipe
183                 unsigned int MaximumSwathHeightY[],
184                 unsigned int MaximumSwathHeightC[],
185                 unsigned int swath_width_luma_ub[], // per-pipe
186                 unsigned int swath_width_chroma_ub[]);
187
188 bool dml32_UnboundedRequest(enum unbounded_requesting_policy UseUnboundedRequestingFinal,
189                 unsigned int TotalNumberOfActiveDPP,
190                 bool NoChroma,
191                 enum output_encoder_class Output,
192                 enum dm_swizzle_mode SurfaceTiling,
193                 bool CompBufReservedSpaceNeedAdjustment,
194                 bool DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment);
195
196 void dml32_CalculateDETBufferSize(
197                 unsigned int DETSizeOverride[],
198                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
199                 bool ForceSingleDPP,
200                 unsigned int NumberOfActiveSurfaces,
201                 bool UnboundedRequestEnabled,
202                 unsigned int nomDETInKByte,
203                 unsigned int MaxTotalDETInKByte,
204                 unsigned int ConfigReturnBufferSizeInKByte,
205                 unsigned int MinCompressedBufferSizeInKByte,
206                 unsigned int CompressedBufferSegmentSizeInkByteFinal,
207                 enum source_format_class SourcePixelFormat[],
208                 double ReadBandwidthLuma[],
209                 double ReadBandwidthChroma[],
210                 unsigned int RoundedUpMaxSwathSizeBytesY[],
211                 unsigned int RoundedUpMaxSwathSizeBytesC[],
212                 unsigned int DPPPerSurface[],
213                 /* Output */
214                 unsigned int DETBufferSizeInKByte[],
215                 unsigned int *CompressedBufferSizeInkByte);
216
217 void dml32_CalculateODMMode(
218                 unsigned int MaximumPixelsPerLinePerDSCUnit,
219                 unsigned int HActive,
220                 enum output_encoder_class Output,
221                 enum odm_combine_policy ODMUse,
222                 double StateDispclk,
223                 double MaxDispclk,
224                 bool DSCEnable,
225                 unsigned int TotalNumberOfActiveDPP,
226                 unsigned int MaxNumDPP,
227                 double PixelClock,
228                 double DISPCLKDPPCLKDSCCLKDownSpreading,
229                 double DISPCLKRampingMargin,
230                 double DISPCLKDPPCLKVCOSpeed,
231
232                 /* Output */
233                 bool *TotalAvailablePipesSupport,
234                 unsigned int *NumberOfDPP,
235                 enum odm_combine_mode *ODMMode,
236                 double *RequiredDISPCLKPerSurface);
237
238 double dml32_CalculateRequiredDispclk(
239                 enum odm_combine_mode ODMMode,
240                 double PixelClock,
241                 double DISPCLKDPPCLKDSCCLKDownSpreading,
242                 double DISPCLKRampingMargin,
243                 double DISPCLKDPPCLKVCOSpeed,
244                 double MaxDispclk);
245
246 double dml32_RoundToDFSGranularity(double Clock, bool round_up, double VCOSpeed);
247
248 void dml32_CalculateOutputLink(
249                 double PHYCLKPerState,
250                 double PHYCLKD18PerState,
251                 double PHYCLKD32PerState,
252                 double Downspreading,
253                 bool IsMainSurfaceUsingTheIndicatedTiming,
254                 enum output_encoder_class Output,
255                 enum output_format_class OutputFormat,
256                 unsigned int HTotal,
257                 unsigned int HActive,
258                 double PixelClockBackEnd,
259                 double ForcedOutputLinkBPP,
260                 unsigned int DSCInputBitPerComponent,
261                 unsigned int NumberOfDSCSlices,
262                 double AudioSampleRate,
263                 unsigned int AudioSampleLayout,
264                 enum odm_combine_mode ODMModeNoDSC,
265                 enum odm_combine_mode ODMModeDSC,
266                 bool DSCEnable,
267                 unsigned int OutputLinkDPLanes,
268                 enum dm_output_link_dp_rate OutputLinkDPRate,
269
270                 /* Output */
271                 bool *RequiresDSC,
272                 double *RequiresFEC,
273                 double  *OutBpp,
274                 enum dm_output_type *OutputType,
275                 enum dm_output_rate *OutputRate,
276                 unsigned int *RequiredSlots);
277
278 void dml32_CalculateDPPCLK(
279                 unsigned int NumberOfActiveSurfaces,
280                 double DISPCLKDPPCLKDSCCLKDownSpreading,
281                 double DISPCLKDPPCLKVCOSpeed,
282                 double DPPCLKUsingSingleDPP[],
283                 unsigned int DPPPerSurface[],
284
285                 /* output */
286                 double *GlobalDPPCLK,
287                 double Dppclk[]);
288
289 double dml32_TruncToValidBPP(
290                 double LinkBitRate,
291                 unsigned int Lanes,
292                 unsigned int HTotal,
293                 unsigned int HActive,
294                 double PixelClock,
295                 double DesiredBPP,
296                 bool DSCEnable,
297                 enum output_encoder_class Output,
298                 enum output_format_class Format,
299                 unsigned int DSCInputBitPerComponent,
300                 unsigned int DSCSlices,
301                 unsigned int AudioRate,
302                 unsigned int AudioLayout,
303                 enum odm_combine_mode ODMModeNoDSC,
304                 enum odm_combine_mode ODMModeDSC,
305                 /* Output */
306                 unsigned int *RequiredSlots);
307
308 double dml32_RequiredDTBCLK(
309                 bool              DSCEnable,
310                 double               PixelClock,
311                 enum output_format_class  OutputFormat,
312                 double               OutputBpp,
313                 unsigned int              DSCSlices,
314                 unsigned int                 HTotal,
315                 unsigned int                 HActive,
316                 unsigned int              AudioRate,
317                 unsigned int              AudioLayout);
318
319 unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
320                 enum odm_combine_mode ODMMode,
321                 unsigned int DSCInputBitPerComponent,
322                 double OutputBpp,
323                 unsigned int HActive,
324                 unsigned int HTotal,
325                 unsigned int NumberOfDSCSlices,
326                 enum output_format_class  OutputFormat,
327                 enum output_encoder_class Output,
328                 double PixelClock,
329                 double PixelClockBackEnd);
330
331 void dml32_CalculateSurfaceSizeInMall(
332                 unsigned int NumberOfActiveSurfaces,
333                 unsigned int MALLAllocatedForDCN,
334                 enum dm_use_mall_for_static_screen_mode UseMALLForStaticScreen[],
335                 bool DCCEnable[],
336                 bool ViewportStationary[],
337                 unsigned int ViewportXStartY[],
338                 unsigned int ViewportYStartY[],
339                 unsigned int ViewportXStartC[],
340                 unsigned int ViewportYStartC[],
341                 unsigned int ViewportWidthY[],
342                 unsigned int ViewportHeightY[],
343                 unsigned int BytesPerPixelY[],
344                 unsigned int ViewportWidthC[],
345                 unsigned int ViewportHeightC[],
346                 unsigned int BytesPerPixelC[],
347                 unsigned int SurfaceWidthY[],
348                 unsigned int SurfaceWidthC[],
349                 unsigned int SurfaceHeightY[],
350                 unsigned int SurfaceHeightC[],
351                 unsigned int Read256BytesBlockWidthY[],
352                 unsigned int Read256BytesBlockWidthC[],
353                 unsigned int Read256BytesBlockHeightY[],
354                 unsigned int Read256BytesBlockHeightC[],
355                 unsigned int ReadBlockWidthY[],
356                 unsigned int ReadBlockWidthC[],
357                 unsigned int ReadBlockHeightY[],
358                 unsigned int ReadBlockHeightC[],
359
360                 /* Output */
361                 unsigned int    SurfaceSizeInMALL[],
362                 bool *ExceededMALLSize);
363
364 void dml32_CalculateVMRowAndSwath(
365                 struct dml32_CalculateVMRowAndSwath *st_vars,
366                 unsigned int NumberOfActiveSurfaces,
367                 DmlPipe myPipe[],
368                 unsigned int SurfaceSizeInMALL[],
369                 unsigned int PTEBufferSizeInRequestsLuma,
370                 unsigned int PTEBufferSizeInRequestsChroma,
371                 unsigned int DCCMetaBufferSizeBytes,
372                 enum dm_use_mall_for_static_screen_mode UseMALLForStaticScreen[],
373                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
374                 unsigned int MALLAllocatedForDCN,
375                 double SwathWidthY[],
376                 double SwathWidthC[],
377                 bool GPUVMEnable,
378                 bool HostVMEnable,
379                 unsigned int HostVMMaxNonCachedPageTableLevels,
380                 unsigned int GPUVMMaxPageTableLevels,
381                 unsigned int GPUVMMinPageSizeKBytes[],
382                 unsigned int HostVMMinPageSize,
383
384                 /* Output */
385                 bool PTEBufferSizeNotExceeded[],
386                 bool DCCMetaBufferSizeNotExceeded[],
387                 unsigned int dpte_row_width_luma_ub[],
388                 unsigned int dpte_row_width_chroma_ub[],
389                 unsigned int dpte_row_height_luma[],
390                 unsigned int dpte_row_height_chroma[],
391                 unsigned int dpte_row_height_linear_luma[],     // VBA_DELTA
392                 unsigned int dpte_row_height_linear_chroma[],   // VBA_DELTA
393                 unsigned int meta_req_width[],
394                 unsigned int meta_req_width_chroma[],
395                 unsigned int meta_req_height[],
396                 unsigned int meta_req_height_chroma[],
397                 unsigned int meta_row_width[],
398                 unsigned int meta_row_width_chroma[],
399                 unsigned int meta_row_height[],
400                 unsigned int meta_row_height_chroma[],
401                 unsigned int vm_group_bytes[],
402                 unsigned int dpte_group_bytes[],
403                 unsigned int PixelPTEReqWidthY[],
404                 unsigned int PixelPTEReqHeightY[],
405                 unsigned int PTERequestSizeY[],
406                 unsigned int PixelPTEReqWidthC[],
407                 unsigned int PixelPTEReqHeightC[],
408                 unsigned int PTERequestSizeC[],
409                 unsigned int dpde0_bytes_per_frame_ub_l[],
410                 unsigned int meta_pte_bytes_per_frame_ub_l[],
411                 unsigned int dpde0_bytes_per_frame_ub_c[],
412                 unsigned int meta_pte_bytes_per_frame_ub_c[],
413                 double PrefetchSourceLinesY[],
414                 double PrefetchSourceLinesC[],
415                 double VInitPreFillY[],
416                 double VInitPreFillC[],
417                 unsigned int MaxNumSwathY[],
418                 unsigned int MaxNumSwathC[],
419                 double meta_row_bw[],
420                 double dpte_row_bw[],
421                 double PixelPTEBytesPerRow[],
422                 double PDEAndMetaPTEBytesFrame[],
423                 double MetaRowByte[],
424                 bool use_one_row_for_frame[],
425                 bool use_one_row_for_frame_flip[],
426                 bool UsesMALLForStaticScreen[],
427                 bool PTE_BUFFER_MODE[],
428                 unsigned int BIGK_FRAGMENT_SIZE[]);
429
430 unsigned int dml32_CalculateVMAndRowBytes(
431                 bool ViewportStationary,
432                 bool DCCEnable,
433                 unsigned int NumberOfDPPs,
434                 unsigned int BlockHeight256Bytes,
435                 unsigned int BlockWidth256Bytes,
436                 enum source_format_class SourcePixelFormat,
437                 unsigned int SurfaceTiling,
438                 unsigned int BytePerPixel,
439                 enum dm_rotation_angle SourceScan,
440                 double SwathWidth,
441                 unsigned int ViewportHeight,
442                 unsigned int    ViewportXStart,
443                 unsigned int    ViewportYStart,
444                 bool GPUVMEnable,
445                 bool HostVMEnable,
446                 unsigned int HostVMMaxNonCachedPageTableLevels,
447                 unsigned int GPUVMMaxPageTableLevels,
448                 unsigned int GPUVMMinPageSizeKBytes,
449                 unsigned int HostVMMinPageSize,
450                 unsigned int PTEBufferSizeInRequests,
451                 unsigned int Pitch,
452                 unsigned int DCCMetaPitch,
453                 unsigned int MacroTileWidth,
454                 unsigned int MacroTileHeight,
455
456                 /* Output */
457                 unsigned int *MetaRowByte,
458                 unsigned int *PixelPTEBytesPerRow,
459                 unsigned int    *dpte_row_width_ub,
460                 unsigned int *dpte_row_height,
461                 unsigned int *dpte_row_height_linear,
462                 unsigned int    *PixelPTEBytesPerRow_one_row_per_frame,
463                 unsigned int    *dpte_row_width_ub_one_row_per_frame,
464                 unsigned int    *dpte_row_height_one_row_per_frame,
465                 unsigned int *MetaRequestWidth,
466                 unsigned int *MetaRequestHeight,
467                 unsigned int *meta_row_width,
468                 unsigned int *meta_row_height,
469                 unsigned int *PixelPTEReqWidth,
470                 unsigned int *PixelPTEReqHeight,
471                 unsigned int *PTERequestSize,
472                 unsigned int    *DPDE0BytesFrame,
473                 unsigned int    *MetaPTEBytesFrame);
474
475 double dml32_CalculatePrefetchSourceLines(
476                 double VRatio,
477                 unsigned int VTaps,
478                 bool Interlace,
479                 bool ProgressiveToInterlaceUnitInOPP,
480                 unsigned int SwathHeight,
481                 enum dm_rotation_angle SourceRotation,
482                 bool ViewportStationary,
483                 double SwathWidth,
484                 unsigned int ViewportHeight,
485                 unsigned int ViewportXStart,
486                 unsigned int ViewportYStart,
487
488                 /* Output */
489                 double *VInitPreFill,
490                 unsigned int *MaxNumSwath);
491
492 void dml32_CalculateMALLUseForStaticScreen(
493                 unsigned int NumberOfActiveSurfaces,
494                 unsigned int MALLAllocatedForDCNFinal,
495                 enum dm_use_mall_for_static_screen_mode *UseMALLForStaticScreen,
496                 unsigned int SurfaceSizeInMALL[],
497                 bool one_row_per_frame_fits_in_buffer[],
498
499                 /* output */
500                 bool UsesMALLForStaticScreen[]);
501
502 void dml32_CalculateRowBandwidth(
503                 bool GPUVMEnable,
504                 enum source_format_class SourcePixelFormat,
505                 double VRatio,
506                 double VRatioChroma,
507                 bool DCCEnable,
508                 double LineTime,
509                 unsigned int MetaRowByteLuma,
510                 unsigned int MetaRowByteChroma,
511                 unsigned int meta_row_height_luma,
512                 unsigned int meta_row_height_chroma,
513                 unsigned int PixelPTEBytesPerRowLuma,
514                 unsigned int PixelPTEBytesPerRowChroma,
515                 unsigned int dpte_row_height_luma,
516                 unsigned int dpte_row_height_chroma,
517                 /* Output */
518                 double *meta_row_bw,
519                 double *dpte_row_bw);
520
521 double dml32_CalculateUrgentLatency(
522                 double UrgentLatencyPixelDataOnly,
523                 double UrgentLatencyPixelMixedWithVMData,
524                 double UrgentLatencyVMDataOnly,
525                 bool   DoUrgentLatencyAdjustment,
526                 double UrgentLatencyAdjustmentFabricClockComponent,
527                 double UrgentLatencyAdjustmentFabricClockReference,
528                 double FabricClock);
529
530 void dml32_CalculateUrgentBurstFactor(
531                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange,
532                 unsigned int    swath_width_luma_ub,
533                 unsigned int    swath_width_chroma_ub,
534                 unsigned int SwathHeightY,
535                 unsigned int SwathHeightC,
536                 double  LineTime,
537                 double  UrgentLatency,
538                 double  CursorBufferSize,
539                 unsigned int CursorWidth,
540                 unsigned int CursorBPP,
541                 double  VRatio,
542                 double  VRatioC,
543                 double  BytePerPixelInDETY,
544                 double  BytePerPixelInDETC,
545                 unsigned int    DETBufferSizeY,
546                 unsigned int    DETBufferSizeC,
547                 /* Output */
548                 double *UrgentBurstFactorCursor,
549                 double *UrgentBurstFactorLuma,
550                 double *UrgentBurstFactorChroma,
551                 bool   *NotEnoughUrgentLatencyHiding);
552
553 void dml32_CalculateDCFCLKDeepSleep(
554                 unsigned int NumberOfActiveSurfaces,
555                 unsigned int BytePerPixelY[],
556                 unsigned int BytePerPixelC[],
557                 double VRatio[],
558                 double VRatioChroma[],
559                 double SwathWidthY[],
560                 double SwathWidthC[],
561                 unsigned int DPPPerSurface[],
562                 double HRatio[],
563                 double HRatioChroma[],
564                 double PixelClock[],
565                 double PSCL_THROUGHPUT[],
566                 double PSCL_THROUGHPUT_CHROMA[],
567                 double Dppclk[],
568                 double ReadBandwidthLuma[],
569                 double ReadBandwidthChroma[],
570                 unsigned int ReturnBusWidth,
571
572                 /* Output */
573                 double *DCFClkDeepSleep);
574
575 double dml32_CalculateWriteBackDelay(
576                 enum source_format_class WritebackPixelFormat,
577                 double WritebackHRatio,
578                 double WritebackVRatio,
579                 unsigned int WritebackVTaps,
580                 unsigned int         WritebackDestinationWidth,
581                 unsigned int         WritebackDestinationHeight,
582                 unsigned int         WritebackSourceHeight,
583                 unsigned int HTotal);
584
585 void dml32_UseMinimumDCFCLK(
586                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
587                 bool DRRDisplay[],
588                 bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
589                 unsigned int MaxInterDCNTileRepeaters,
590                 unsigned int MaxPrefetchMode,
591                 double DRAMClockChangeLatencyFinal,
592                 double FCLKChangeLatency,
593                 double SREnterPlusExitTime,
594                 unsigned int ReturnBusWidth,
595                 unsigned int RoundTripPingLatencyCycles,
596                 unsigned int ReorderingBytes,
597                 unsigned int PixelChunkSizeInKByte,
598                 unsigned int MetaChunkSize,
599                 bool GPUVMEnable,
600                 unsigned int GPUVMMaxPageTableLevels,
601                 bool HostVMEnable,
602                 unsigned int NumberOfActiveSurfaces,
603                 double HostVMMinPageSize,
604                 unsigned int HostVMMaxNonCachedPageTableLevels,
605                 bool DynamicMetadataVMEnabled,
606                 bool ImmediateFlipRequirement,
607                 bool ProgressiveToInterlaceUnitInOPP,
608                 double MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation,
609                 double PercentOfIdealSDPPortBWReceivedAfterUrgLatency,
610                 unsigned int VTotal[],
611                 unsigned int VActive[],
612                 unsigned int DynamicMetadataTransmittedBytes[],
613                 unsigned int DynamicMetadataLinesBeforeActiveRequired[],
614                 bool Interlace[],
615                 double RequiredDPPCLKPerSurface[][2][DC__NUM_DPP__MAX],
616                 double RequiredDISPCLK[][2],
617                 double UrgLatency[],
618                 unsigned int NoOfDPP[][2][DC__NUM_DPP__MAX],
619                 double ProjectedDCFClkDeepSleep[][2],
620                 double MaximumVStartup[][2][DC__NUM_DPP__MAX],
621                 unsigned int TotalNumberOfActiveDPP[][2],
622                 unsigned int TotalNumberOfDCCActiveDPP[][2],
623                 unsigned int dpte_group_bytes[],
624                 double PrefetchLinesY[][2][DC__NUM_DPP__MAX],
625                 double PrefetchLinesC[][2][DC__NUM_DPP__MAX],
626                 unsigned int swath_width_luma_ub_all_states[][2][DC__NUM_DPP__MAX],
627                 unsigned int swath_width_chroma_ub_all_states[][2][DC__NUM_DPP__MAX],
628                 unsigned int BytePerPixelY[],
629                 unsigned int BytePerPixelC[],
630                 unsigned int HTotal[],
631                 double PixelClock[],
632                 double PDEAndMetaPTEBytesPerFrame[][2][DC__NUM_DPP__MAX],
633                 double DPTEBytesPerRow[][2][DC__NUM_DPP__MAX],
634                 double MetaRowBytes[][2][DC__NUM_DPP__MAX],
635                 bool DynamicMetadataEnable[],
636                 double ReadBandwidthLuma[],
637                 double ReadBandwidthChroma[],
638                 double DCFCLKPerState[],
639                 /* Output */
640                 double DCFCLKState[][2]);
641
642 unsigned int dml32_CalculateExtraLatencyBytes(unsigned int ReorderingBytes,
643                 unsigned int TotalNumberOfActiveDPP,
644                 unsigned int PixelChunkSizeInKByte,
645                 unsigned int TotalNumberOfDCCActiveDPP,
646                 unsigned int MetaChunkSize,
647                 bool GPUVMEnable,
648                 bool HostVMEnable,
649                 unsigned int NumberOfActiveSurfaces,
650                 unsigned int NumberOfDPP[],
651                 unsigned int dpte_group_bytes[],
652                 double HostVMInefficiencyFactor,
653                 double HostVMMinPageSize,
654                 unsigned int HostVMMaxNonCachedPageTableLevels);
655
656 void dml32_CalculateVUpdateAndDynamicMetadataParameters(
657                 unsigned int MaxInterDCNTileRepeaters,
658                 double Dppclk,
659                 double Dispclk,
660                 double DCFClkDeepSleep,
661                 double PixelClock,
662                 unsigned int HTotal,
663                 unsigned int VBlank,
664                 unsigned int DynamicMetadataTransmittedBytes,
665                 unsigned int DynamicMetadataLinesBeforeActiveRequired,
666                 unsigned int InterlaceEnable,
667                 bool ProgressiveToInterlaceUnitInOPP,
668                 double *TSetup,
669                 double *Tdmbf,
670                 double *Tdmec,
671                 double *Tdmsks,
672                 unsigned int *VUpdateOffsetPix,
673                 double *VUpdateWidthPix,
674                 double *VReadyOffsetPix);
675
676 double dml32_CalculateTWait(
677                 unsigned int PrefetchMode,
678                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange,
679                 bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
680                 bool DRRDisplay,
681                 double DRAMClockChangeLatency,
682                 double FCLKChangeLatency,
683                 double UrgentLatency,
684                 double SREnterPlusExitTime);
685
686 double dml32_get_return_bw_mbps(const soc_bounding_box_st *soc,
687                 const int VoltageLevel,
688                 const bool HostVMEnable,
689                 const double DCFCLK,
690                 const double FabricClock,
691                 const double DRAMSpeed);
692
693 double dml32_get_return_bw_mbps_vm_only(const soc_bounding_box_st *soc,
694                 const int VoltageLevel,
695                 const double DCFCLK,
696                 const double FabricClock,
697                 const double DRAMSpeed);
698
699 double dml32_CalculateExtraLatency(
700                 unsigned int RoundTripPingLatencyCycles,
701                 unsigned int ReorderingBytes,
702                 double DCFCLK,
703                 unsigned int TotalNumberOfActiveDPP,
704                 unsigned int PixelChunkSizeInKByte,
705                 unsigned int TotalNumberOfDCCActiveDPP,
706                 unsigned int MetaChunkSize,
707                 double ReturnBW,
708                 bool GPUVMEnable,
709                 bool HostVMEnable,
710                 unsigned int NumberOfActiveSurfaces,
711                 unsigned int NumberOfDPP[],
712                 unsigned int dpte_group_bytes[],
713                 double HostVMInefficiencyFactor,
714                 double HostVMMinPageSize,
715                 unsigned int HostVMMaxNonCachedPageTableLevels);
716
717 bool dml32_CalculatePrefetchSchedule(
718                 struct dml32_CalculatePrefetchSchedule *st_vars,
719                 double HostVMInefficiencyFactor,
720                 DmlPipe *myPipe,
721                 unsigned int DSCDelay,
722                 double DPPCLKDelaySubtotalPlusCNVCFormater,
723                 double DPPCLKDelaySCL,
724                 double DPPCLKDelaySCLLBOnly,
725                 double DPPCLKDelayCNVCCursor,
726                 double DISPCLKDelaySubtotal,
727                 unsigned int DPP_RECOUT_WIDTH,
728                 enum output_format_class OutputFormat,
729                 unsigned int MaxInterDCNTileRepeaters,
730                 unsigned int VStartup,
731                 unsigned int MaxVStartup,
732                 unsigned int GPUVMPageTableLevels,
733                 bool GPUVMEnable,
734                 bool HostVMEnable,
735                 unsigned int HostVMMaxNonCachedPageTableLevels,
736                 double HostVMMinPageSize,
737                 bool DynamicMetadataEnable,
738                 bool DynamicMetadataVMEnabled,
739                 int DynamicMetadataLinesBeforeActiveRequired,
740                 unsigned int DynamicMetadataTransmittedBytes,
741                 double UrgentLatency,
742                 double UrgentExtraLatency,
743                 double TCalc,
744                 unsigned int PDEAndMetaPTEBytesFrame,
745                 unsigned int MetaRowByte,
746                 unsigned int PixelPTEBytesPerRow,
747                 double PrefetchSourceLinesY,
748                 unsigned int SwathWidthY,
749                 unsigned int VInitPreFillY,
750                 unsigned int MaxNumSwathY,
751                 double PrefetchSourceLinesC,
752                 unsigned int SwathWidthC,
753                 unsigned int VInitPreFillC,
754                 unsigned int MaxNumSwathC,
755                 unsigned int swath_width_luma_ub,
756                 unsigned int swath_width_chroma_ub,
757                 unsigned int SwathHeightY,
758                 unsigned int SwathHeightC,
759                 double TWait,
760                 /* Output */
761                 double   *DSTXAfterScaler,
762                 double   *DSTYAfterScaler,
763                 double *DestinationLinesForPrefetch,
764                 double *PrefetchBandwidth,
765                 double *DestinationLinesToRequestVMInVBlank,
766                 double *DestinationLinesToRequestRowInVBlank,
767                 double *VRatioPrefetchY,
768                 double *VRatioPrefetchC,
769                 double *RequiredPrefetchPixDataBWLuma,
770                 double *RequiredPrefetchPixDataBWChroma,
771                 bool   *NotEnoughTimeForDynamicMetadata,
772                 double *Tno_bw,
773                 double *prefetch_vmrow_bw,
774                 double *Tdmdl_vm,
775                 double *Tdmdl,
776                 double *TSetup,
777                 unsigned int   *VUpdateOffsetPix,
778                 double   *VUpdateWidthPix,
779                 double   *VReadyOffsetPix);
780
781 void dml32_CalculateFlipSchedule(
782                 double HostVMInefficiencyFactor,
783                 double UrgentExtraLatency,
784                 double UrgentLatency,
785                 unsigned int GPUVMMaxPageTableLevels,
786                 bool HostVMEnable,
787                 unsigned int HostVMMaxNonCachedPageTableLevels,
788                 bool GPUVMEnable,
789                 double HostVMMinPageSize,
790                 double PDEAndMetaPTEBytesPerFrame,
791                 double MetaRowBytes,
792                 double DPTEBytesPerRow,
793                 double BandwidthAvailableForImmediateFlip,
794                 unsigned int TotImmediateFlipBytes,
795                 enum source_format_class SourcePixelFormat,
796                 double LineTime,
797                 double VRatio,
798                 double VRatioChroma,
799                 double Tno_bw,
800                 bool DCCEnable,
801                 unsigned int dpte_row_height,
802                 unsigned int meta_row_height,
803                 unsigned int dpte_row_height_chroma,
804                 unsigned int meta_row_height_chroma,
805                 bool    use_one_row_for_frame_flip,
806
807                 /* Output */
808                 double *DestinationLinesToRequestVMInImmediateFlip,
809                 double *DestinationLinesToRequestRowInImmediateFlip,
810                 double *final_flip_bw,
811                 bool *ImmediateFlipSupportedForPipe);
812
813 void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
814                 struct dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport *st_vars,
815                 bool USRRetrainingRequiredFinal,
816                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
817                 unsigned int PrefetchMode,
818                 unsigned int NumberOfActiveSurfaces,
819                 unsigned int MaxLineBufferLines,
820                 unsigned int LineBufferSize,
821                 unsigned int WritebackInterfaceBufferSize,
822                 double DCFCLK,
823                 double ReturnBW,
824                 bool SynchronizeTimingsFinal,
825                 bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
826                 bool DRRDisplay[],
827                 unsigned int dpte_group_bytes[],
828                 unsigned int meta_row_height[],
829                 unsigned int meta_row_height_chroma[],
830                 SOCParametersList mmSOCParameters,
831                 unsigned int WritebackChunkSize,
832                 double SOCCLK,
833                 double DCFClkDeepSleep,
834                 unsigned int DETBufferSizeY[],
835                 unsigned int DETBufferSizeC[],
836                 unsigned int SwathHeightY[],
837                 unsigned int SwathHeightC[],
838                 unsigned int LBBitPerPixel[],
839                 double SwathWidthY[],
840                 double SwathWidthC[],
841                 double HRatio[],
842                 double HRatioChroma[],
843                 unsigned int VTaps[],
844                 unsigned int VTapsChroma[],
845                 double VRatio[],
846                 double VRatioChroma[],
847                 unsigned int HTotal[],
848                 unsigned int VTotal[],
849                 unsigned int VActive[],
850                 double PixelClock[],
851                 unsigned int BlendingAndTiming[],
852                 unsigned int DPPPerSurface[],
853                 double BytePerPixelDETY[],
854                 double BytePerPixelDETC[],
855                 double DSTXAfterScaler[],
856                 double DSTYAfterScaler[],
857                 bool WritebackEnable[],
858                 enum source_format_class WritebackPixelFormat[],
859                 double WritebackDestinationWidth[],
860                 double WritebackDestinationHeight[],
861                 double WritebackSourceHeight[],
862                 bool UnboundedRequestEnabled,
863                 unsigned int CompressedBufferSizeInkByte,
864
865                 /* Output */
866                 Watermarks *Watermark,
867                 enum clock_change_support *DRAMClockChangeSupport,
868                 double MaxActiveDRAMClockChangeLatencySupported[],
869                 unsigned int SubViewportLinesNeededInMALL[],
870                 enum dm_fclock_change_support *FCLKChangeSupport,
871                 double *MinActiveFCLKChangeLatencySupported,
872                 bool *USRRetrainingSupport,
873                 double ActiveDRAMClockChangeLatencyMargin[]);
874
875 double dml32_CalculateWriteBackDISPCLK(
876                 enum source_format_class WritebackPixelFormat,
877                 double PixelClock,
878                 double WritebackHRatio,
879                 double WritebackVRatio,
880                 unsigned int WritebackHTaps,
881                 unsigned int WritebackVTaps,
882                 unsigned int   WritebackSourceWidth,
883                 unsigned int   WritebackDestinationWidth,
884                 unsigned int HTotal,
885                 unsigned int WritebackLineBufferSize,
886                 double DISPCLKDPPCLKVCOSpeed);
887
888 void dml32_CalculateMinAndMaxPrefetchMode(
889                 enum dm_prefetch_modes   AllowForPStateChangeOrStutterInVBlankFinal,
890                 unsigned int             *MinPrefetchMode,
891                 unsigned int             *MaxPrefetchMode);
892
893 void dml32_CalculatePixelDeliveryTimes(
894                 unsigned int             NumberOfActiveSurfaces,
895                 double              VRatio[],
896                 double              VRatioChroma[],
897                 double              VRatioPrefetchY[],
898                 double              VRatioPrefetchC[],
899                 unsigned int             swath_width_luma_ub[],
900                 unsigned int             swath_width_chroma_ub[],
901                 unsigned int             DPPPerSurface[],
902                 double              HRatio[],
903                 double              HRatioChroma[],
904                 double              PixelClock[],
905                 double              PSCL_THROUGHPUT[],
906                 double              PSCL_THROUGHPUT_CHROMA[],
907                 double              Dppclk[],
908                 unsigned int             BytePerPixelC[],
909                 enum dm_rotation_angle   SourceRotation[],
910                 unsigned int             NumberOfCursors[],
911                 unsigned int             CursorWidth[][DC__NUM_CURSOR__MAX],
912                 unsigned int             CursorBPP[][DC__NUM_CURSOR__MAX],
913                 unsigned int             BlockWidth256BytesY[],
914                 unsigned int             BlockHeight256BytesY[],
915                 unsigned int             BlockWidth256BytesC[],
916                 unsigned int             BlockHeight256BytesC[],
917
918                 /* Output */
919                 double              DisplayPipeLineDeliveryTimeLuma[],
920                 double              DisplayPipeLineDeliveryTimeChroma[],
921                 double              DisplayPipeLineDeliveryTimeLumaPrefetch[],
922                 double              DisplayPipeLineDeliveryTimeChromaPrefetch[],
923                 double              DisplayPipeRequestDeliveryTimeLuma[],
924                 double              DisplayPipeRequestDeliveryTimeChroma[],
925                 double              DisplayPipeRequestDeliveryTimeLumaPrefetch[],
926                 double              DisplayPipeRequestDeliveryTimeChromaPrefetch[],
927                 double              CursorRequestDeliveryTime[],
928                 double              CursorRequestDeliveryTimePrefetch[]);
929
930 void dml32_CalculateMetaAndPTETimes(
931                 bool use_one_row_for_frame[],
932                 unsigned int NumberOfActiveSurfaces,
933                 bool GPUVMEnable,
934                 unsigned int MetaChunkSize,
935                 unsigned int MinMetaChunkSizeBytes,
936                 unsigned int    HTotal[],
937                 double  VRatio[],
938                 double  VRatioChroma[],
939                 double  DestinationLinesToRequestRowInVBlank[],
940                 double  DestinationLinesToRequestRowInImmediateFlip[],
941                 bool DCCEnable[],
942                 double  PixelClock[],
943                 unsigned int BytePerPixelY[],
944                 unsigned int BytePerPixelC[],
945                 enum dm_rotation_angle SourceRotation[],
946                 unsigned int dpte_row_height[],
947                 unsigned int dpte_row_height_chroma[],
948                 unsigned int meta_row_width[],
949                 unsigned int meta_row_width_chroma[],
950                 unsigned int meta_row_height[],
951                 unsigned int meta_row_height_chroma[],
952                 unsigned int meta_req_width[],
953                 unsigned int meta_req_width_chroma[],
954                 unsigned int meta_req_height[],
955                 unsigned int meta_req_height_chroma[],
956                 unsigned int dpte_group_bytes[],
957                 unsigned int    PTERequestSizeY[],
958                 unsigned int    PTERequestSizeC[],
959                 unsigned int    PixelPTEReqWidthY[],
960                 unsigned int    PixelPTEReqHeightY[],
961                 unsigned int    PixelPTEReqWidthC[],
962                 unsigned int    PixelPTEReqHeightC[],
963                 unsigned int    dpte_row_width_luma_ub[],
964                 unsigned int    dpte_row_width_chroma_ub[],
965
966                 /* Output */
967                 double DST_Y_PER_PTE_ROW_NOM_L[],
968                 double DST_Y_PER_PTE_ROW_NOM_C[],
969                 double DST_Y_PER_META_ROW_NOM_L[],
970                 double DST_Y_PER_META_ROW_NOM_C[],
971                 double TimePerMetaChunkNominal[],
972                 double TimePerChromaMetaChunkNominal[],
973                 double TimePerMetaChunkVBlank[],
974                 double TimePerChromaMetaChunkVBlank[],
975                 double TimePerMetaChunkFlip[],
976                 double TimePerChromaMetaChunkFlip[],
977                 double time_per_pte_group_nom_luma[],
978                 double time_per_pte_group_vblank_luma[],
979                 double time_per_pte_group_flip_luma[],
980                 double time_per_pte_group_nom_chroma[],
981                 double time_per_pte_group_vblank_chroma[],
982                 double time_per_pte_group_flip_chroma[]);
983
984 void dml32_CalculateVMGroupAndRequestTimes(
985                 unsigned int     NumberOfActiveSurfaces,
986                 bool     GPUVMEnable,
987                 unsigned int     GPUVMMaxPageTableLevels,
988                 unsigned int     HTotal[],
989                 unsigned int     BytePerPixelC[],
990                 double      DestinationLinesToRequestVMInVBlank[],
991                 double      DestinationLinesToRequestVMInImmediateFlip[],
992                 bool     DCCEnable[],
993                 double      PixelClock[],
994                 unsigned int        dpte_row_width_luma_ub[],
995                 unsigned int        dpte_row_width_chroma_ub[],
996                 unsigned int     vm_group_bytes[],
997                 unsigned int     dpde0_bytes_per_frame_ub_l[],
998                 unsigned int     dpde0_bytes_per_frame_ub_c[],
999                 unsigned int        meta_pte_bytes_per_frame_ub_l[],
1000                 unsigned int        meta_pte_bytes_per_frame_ub_c[],
1001
1002                 /* Output */
1003                 double      TimePerVMGroupVBlank[],
1004                 double      TimePerVMGroupFlip[],
1005                 double      TimePerVMRequestVBlank[],
1006                 double      TimePerVMRequestFlip[]);
1007
1008 void dml32_CalculateDCCConfiguration(
1009                 bool             DCCEnabled,
1010                 bool             DCCProgrammingAssumesScanDirectionUnknown,
1011                 enum source_format_class SourcePixelFormat,
1012                 unsigned int             SurfaceWidthLuma,
1013                 unsigned int             SurfaceWidthChroma,
1014                 unsigned int             SurfaceHeightLuma,
1015                 unsigned int             SurfaceHeightChroma,
1016                 unsigned int                nomDETInKByte,
1017                 unsigned int             RequestHeight256ByteLuma,
1018                 unsigned int             RequestHeight256ByteChroma,
1019                 enum dm_swizzle_mode     TilingFormat,
1020                 unsigned int             BytePerPixelY,
1021                 unsigned int             BytePerPixelC,
1022                 double              BytePerPixelDETY,
1023                 double              BytePerPixelDETC,
1024                 enum dm_rotation_angle   SourceRotation,
1025                 /* Output */
1026                 unsigned int        *MaxUncompressedBlockLuma,
1027                 unsigned int        *MaxUncompressedBlockChroma,
1028                 unsigned int        *MaxCompressedBlockLuma,
1029                 unsigned int        *MaxCompressedBlockChroma,
1030                 unsigned int        *IndependentBlockLuma,
1031                 unsigned int        *IndependentBlockChroma);
1032
1033 void dml32_CalculateStutterEfficiency(
1034                 unsigned int      CompressedBufferSizeInkByte,
1035                 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
1036                 bool   UnboundedRequestEnabled,
1037                 unsigned int      MetaFIFOSizeInKEntries,
1038                 unsigned int      ZeroSizeBufferEntries,
1039                 unsigned int      PixelChunkSizeInKByte,
1040                 unsigned int   NumberOfActiveSurfaces,
1041                 unsigned int      ROBBufferSizeInKByte,
1042                 double    TotalDataReadBandwidth,
1043                 double    DCFCLK,
1044                 double    ReturnBW,
1045                 unsigned int      CompbufReservedSpace64B,
1046                 unsigned int      CompbufReservedSpaceZs,
1047                 double    SRExitTime,
1048                 double    SRExitZ8Time,
1049                 bool   SynchronizeTimingsFinal,
1050                 unsigned int   BlendingAndTiming[],
1051                 double    StutterEnterPlusExitWatermark,
1052                 double    Z8StutterEnterPlusExitWatermark,
1053                 bool   ProgressiveToInterlaceUnitInOPP,
1054                 bool   Interlace[],
1055                 double    MinTTUVBlank[],
1056                 unsigned int   DPPPerSurface[],
1057                 unsigned int      DETBufferSizeY[],
1058                 unsigned int   BytePerPixelY[],
1059                 double    BytePerPixelDETY[],
1060                 double      SwathWidthY[],
1061                 unsigned int   SwathHeightY[],
1062                 unsigned int   SwathHeightC[],
1063                 double    NetDCCRateLuma[],
1064                 double    NetDCCRateChroma[],
1065                 double    DCCFractionOfZeroSizeRequestsLuma[],
1066                 double    DCCFractionOfZeroSizeRequestsChroma[],
1067                 unsigned int      HTotal[],
1068                 unsigned int      VTotal[],
1069                 double    PixelClock[],
1070                 double    VRatio[],
1071                 enum dm_rotation_angle SourceRotation[],
1072                 unsigned int   BlockHeight256BytesY[],
1073                 unsigned int   BlockWidth256BytesY[],
1074                 unsigned int   BlockHeight256BytesC[],
1075                 unsigned int   BlockWidth256BytesC[],
1076                 unsigned int   DCCYMaxUncompressedBlock[],
1077                 unsigned int   DCCCMaxUncompressedBlock[],
1078                 unsigned int      VActive[],
1079                 bool   DCCEnable[],
1080                 bool   WritebackEnable[],
1081                 double    ReadBandwidthSurfaceLuma[],
1082                 double    ReadBandwidthSurfaceChroma[],
1083                 double    meta_row_bw[],
1084                 double    dpte_row_bw[],
1085
1086                 /* Output */
1087                 double   *StutterEfficiencyNotIncludingVBlank,
1088                 double   *StutterEfficiency,
1089                 unsigned int     *NumberOfStutterBurstsPerFrame,
1090                 double   *Z8StutterEfficiencyNotIncludingVBlank,
1091                 double   *Z8StutterEfficiency,
1092                 unsigned int     *Z8NumberOfStutterBurstsPerFrame,
1093                 double   *StutterPeriod,
1094                 bool  *DCHUBBUB_ARB_CSTATE_MAX_CAP_MODE);
1095
1096 void dml32_CalculateMaxDETAndMinCompressedBufferSize(
1097                 unsigned int    ConfigReturnBufferSizeInKByte,
1098                 unsigned int    ROBBufferSizeInKByte,
1099                 unsigned int MaxNumDPP,
1100                 bool nomDETInKByteOverrideEnable, // VBA_DELTA, allow DV to override default DET size
1101                 unsigned int nomDETInKByteOverrideValue,  // VBA_DELTA
1102
1103                 /* Output */
1104                 unsigned int *MaxTotalDETInKByte,
1105                 unsigned int *nomDETInKByte,
1106                 unsigned int *MinCompressedBufferSizeInKByte);
1107
1108 bool dml32_CalculateVActiveBandwithSupport(unsigned int NumberOfActiveSurfaces,
1109                 double ReturnBW,
1110                 bool NotUrgentLatencyHiding[],
1111                 double ReadBandwidthLuma[],
1112                 double ReadBandwidthChroma[],
1113                 double cursor_bw[],
1114                 double meta_row_bandwidth[],
1115                 double dpte_row_bandwidth[],
1116                 unsigned int NumberOfDPP[],
1117                 double UrgentBurstFactorLuma[],
1118                 double UrgentBurstFactorChroma[],
1119                 double UrgentBurstFactorCursor[]);
1120
1121 void dml32_CalculatePrefetchBandwithSupport(unsigned int NumberOfActiveSurfaces,
1122                 double ReturnBW,
1123                 bool NotUrgentLatencyHiding[],
1124                 double ReadBandwidthLuma[],
1125                 double ReadBandwidthChroma[],
1126                 double PrefetchBandwidthLuma[],
1127                 double PrefetchBandwidthChroma[],
1128                 double cursor_bw[],
1129                 double meta_row_bandwidth[],
1130                 double dpte_row_bandwidth[],
1131                 double cursor_bw_pre[],
1132                 double prefetch_vmrow_bw[],
1133                 unsigned int NumberOfDPP[],
1134                 double UrgentBurstFactorLuma[],
1135                 double UrgentBurstFactorChroma[],
1136                 double UrgentBurstFactorCursor[],
1137                 double UrgentBurstFactorLumaPre[],
1138                 double UrgentBurstFactorChromaPre[],
1139                 double UrgentBurstFactorCursorPre[],
1140
1141                 /* output */
1142                 double  *PrefetchBandwidth,
1143                 double  *FractionOfUrgentBandwidth,
1144                 bool *PrefetchBandwidthSupport);
1145
1146 double dml32_CalculateBandwidthAvailableForImmediateFlip(unsigned int NumberOfActiveSurfaces,
1147                 double ReturnBW,
1148                 double ReadBandwidthLuma[],
1149                 double ReadBandwidthChroma[],
1150                 double PrefetchBandwidthLuma[],
1151                 double PrefetchBandwidthChroma[],
1152                 double cursor_bw[],
1153                 double cursor_bw_pre[],
1154                 unsigned int NumberOfDPP[],
1155                 double UrgentBurstFactorLuma[],
1156                 double UrgentBurstFactorChroma[],
1157                 double UrgentBurstFactorCursor[],
1158                 double UrgentBurstFactorLumaPre[],
1159                 double UrgentBurstFactorChromaPre[],
1160                 double UrgentBurstFactorCursorPre[]);
1161
1162 void dml32_CalculateImmediateFlipBandwithSupport(unsigned int NumberOfActiveSurfaces,
1163                 double ReturnBW,
1164                 enum immediate_flip_requirement ImmediateFlipRequirement[],
1165                 double final_flip_bw[],
1166                 double ReadBandwidthLuma[],
1167                 double ReadBandwidthChroma[],
1168                 double PrefetchBandwidthLuma[],
1169                 double PrefetchBandwidthChroma[],
1170                 double cursor_bw[],
1171                 double meta_row_bandwidth[],
1172                 double dpte_row_bandwidth[],
1173                 double cursor_bw_pre[],
1174                 double prefetch_vmrow_bw[],
1175                 unsigned int NumberOfDPP[],
1176                 double UrgentBurstFactorLuma[],
1177                 double UrgentBurstFactorChroma[],
1178                 double UrgentBurstFactorCursor[],
1179                 double UrgentBurstFactorLumaPre[],
1180                 double UrgentBurstFactorChromaPre[],
1181                 double UrgentBurstFactorCursorPre[],
1182
1183                 /* output */
1184                 double  *TotalBandwidth,
1185                 double  *FractionOfUrgentBandwidth,
1186                 bool *ImmediateFlipBandwidthSupport);
1187
1188 #endif