2 * Copyright 2022 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
26 #ifndef __DML_DCN32_DISPLAY_MODE_VBA_UTIL_32_H__
27 #define __DML_DCN32_DISPLAY_MODE_VBA_UTIL_32_H__
29 #include "../display_mode_enums.h"
31 #include "../dc_features.h"
32 #include "../display_mode_structs.h"
33 #include "dml/display_mode_vba.h"
35 unsigned int dml32_dscceComputeDelay(
38 unsigned int sliceWidth,
39 unsigned int numSlices,
40 enum output_format_class pixelFormat,
41 enum output_encoder_class Output);
43 unsigned int dml32_dscComputeDelay(enum output_format_class pixelFormat, enum output_encoder_class Output);
45 bool IsVertical(enum dm_rotation_angle Scan);
47 void dml32_CalculateBytePerPixelAndBlockSizes(
48 enum source_format_class SourcePixelFormat,
49 enum dm_swizzle_mode SurfaceTiling,
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);
65 void dml32_CalculateSinglePipeDPPCLKAndSCLThroughput(
70 double MaxDCHUBToPSCLThroughput,
71 double MaxPSCLToLBThroughput,
73 enum source_format_class SourcePixelFormat,
75 unsigned int HTapsChroma,
77 unsigned int VTapsChroma,
80 double *PSCL_THROUGHPUT,
81 double *PSCL_THROUGHPUT_CHROMA,
82 double *DPPCLKUsingSingleDPP);
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[],
130 double HRatioChroma[],
131 unsigned int DPPPerSurface[],
134 unsigned int swath_width_luma_ub[],
135 unsigned int swath_width_chroma_ub[],
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);
150 void dml32_CalculateSwathWidth(
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[],
176 unsigned int DPPPerSurface[],
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[]);
188 bool dml32_UnboundedRequest(enum unbounded_requesting_policy UseUnboundedRequestingFinal,
189 unsigned int TotalNumberOfActiveDPP,
191 enum output_encoder_class Output,
192 enum dm_swizzle_mode SurfaceTiling,
193 bool CompBufReservedSpaceNeedAdjustment,
194 bool DisableUnboundRequestIfCompBufReservedSpaceNeedAdjustment);
196 void dml32_CalculateDETBufferSize(
197 unsigned int DETSizeOverride[],
198 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
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[],
214 unsigned int DETBufferSizeInKByte[],
215 unsigned int *CompressedBufferSizeInkByte);
217 void dml32_CalculateODMMode(
218 unsigned int MaximumPixelsPerLinePerDSCUnit,
219 unsigned int HActive,
220 enum output_encoder_class Output,
221 enum odm_combine_policy ODMUse,
225 unsigned int TotalNumberOfActiveDPP,
226 unsigned int MaxNumDPP,
228 double DISPCLKDPPCLKDSCCLKDownSpreading,
229 double DISPCLKRampingMargin,
230 double DISPCLKDPPCLKVCOSpeed,
233 bool *TotalAvailablePipesSupport,
234 unsigned int *NumberOfDPP,
235 enum odm_combine_mode *ODMMode,
236 double *RequiredDISPCLKPerSurface);
238 double dml32_CalculateRequiredDispclk(
239 enum odm_combine_mode ODMMode,
241 double DISPCLKDPPCLKDSCCLKDownSpreading,
242 double DISPCLKRampingMargin,
243 double DISPCLKDPPCLKVCOSpeed,
246 double dml32_RoundToDFSGranularity(double Clock, bool round_up, double VCOSpeed);
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,
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,
267 unsigned int OutputLinkDPLanes,
268 enum dm_output_link_dp_rate OutputLinkDPRate,
274 enum dm_output_type *OutputType,
275 enum dm_output_rate *OutputRate,
276 unsigned int *RequiredSlots);
278 void dml32_CalculateDPPCLK(
279 unsigned int NumberOfActiveSurfaces,
280 double DISPCLKDPPCLKDSCCLKDownSpreading,
281 double DISPCLKDPPCLKVCOSpeed,
282 double DPPCLKUsingSingleDPP[],
283 unsigned int DPPPerSurface[],
286 double *GlobalDPPCLK,
289 double dml32_TruncToValidBPP(
293 unsigned int HActive,
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,
306 unsigned int *RequiredSlots);
308 double dml32_RequiredDTBCLK(
311 enum output_format_class OutputFormat,
313 unsigned int DSCSlices,
315 unsigned int HActive,
316 unsigned int AudioRate,
317 unsigned int AudioLayout);
319 unsigned int dml32_DSCDelayRequirement(bool DSCEnabled,
320 enum odm_combine_mode ODMMode,
321 unsigned int DSCInputBitPerComponent,
323 unsigned int HActive,
325 unsigned int NumberOfDSCSlices,
326 enum output_format_class OutputFormat,
327 enum output_encoder_class Output,
329 double PixelClockBackEnd);
331 void dml32_CalculateSurfaceSizeInMall(
332 unsigned int NumberOfActiveSurfaces,
333 unsigned int MALLAllocatedForDCN,
334 enum dm_use_mall_for_static_screen_mode UseMALLForStaticScreen[],
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[],
361 unsigned int SurfaceSizeInMALL[],
362 bool *ExceededMALLSize);
364 void dml32_CalculateVMRowAndSwath(
365 struct dml32_CalculateVMRowAndSwath *st_vars,
366 unsigned int NumberOfActiveSurfaces,
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[],
379 unsigned int HostVMMaxNonCachedPageTableLevels,
380 unsigned int GPUVMMaxPageTableLevels,
381 unsigned int GPUVMMinPageSizeKBytes[],
382 unsigned int HostVMMinPageSize,
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[]);
430 unsigned int dml32_CalculateVMAndRowBytes(
431 bool ViewportStationary,
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,
441 unsigned int ViewportHeight,
442 unsigned int ViewportXStart,
443 unsigned int ViewportYStart,
446 unsigned int HostVMMaxNonCachedPageTableLevels,
447 unsigned int GPUVMMaxPageTableLevels,
448 unsigned int GPUVMMinPageSizeKBytes,
449 unsigned int HostVMMinPageSize,
450 unsigned int PTEBufferSizeInRequests,
452 unsigned int DCCMetaPitch,
453 unsigned int MacroTileWidth,
454 unsigned int MacroTileHeight,
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);
475 double dml32_CalculatePrefetchSourceLines(
479 bool ProgressiveToInterlaceUnitInOPP,
480 unsigned int SwathHeight,
481 enum dm_rotation_angle SourceRotation,
482 bool ViewportStationary,
484 unsigned int ViewportHeight,
485 unsigned int ViewportXStart,
486 unsigned int ViewportYStart,
489 double *VInitPreFill,
490 unsigned int *MaxNumSwath);
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[],
500 bool UsesMALLForStaticScreen[]);
502 void dml32_CalculateRowBandwidth(
504 enum source_format_class SourcePixelFormat,
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,
519 double *dpte_row_bw);
521 double dml32_CalculateUrgentLatency(
522 double UrgentLatencyPixelDataOnly,
523 double UrgentLatencyPixelMixedWithVMData,
524 double UrgentLatencyVMDataOnly,
525 bool DoUrgentLatencyAdjustment,
526 double UrgentLatencyAdjustmentFabricClockComponent,
527 double UrgentLatencyAdjustmentFabricClockReference,
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,
537 double UrgentLatency,
538 double CursorBufferSize,
539 unsigned int CursorWidth,
540 unsigned int CursorBPP,
543 double BytePerPixelInDETY,
544 double BytePerPixelInDETC,
545 unsigned int DETBufferSizeY,
546 unsigned int DETBufferSizeC,
548 double *UrgentBurstFactorCursor,
549 double *UrgentBurstFactorLuma,
550 double *UrgentBurstFactorChroma,
551 bool *NotEnoughUrgentLatencyHiding);
553 void dml32_CalculateDCFCLKDeepSleep(
554 unsigned int NumberOfActiveSurfaces,
555 unsigned int BytePerPixelY[],
556 unsigned int BytePerPixelC[],
558 double VRatioChroma[],
559 double SwathWidthY[],
560 double SwathWidthC[],
561 unsigned int DPPPerSurface[],
563 double HRatioChroma[],
565 double PSCL_THROUGHPUT[],
566 double PSCL_THROUGHPUT_CHROMA[],
568 double ReadBandwidthLuma[],
569 double ReadBandwidthChroma[],
570 unsigned int ReturnBusWidth,
573 double *DCFClkDeepSleep);
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);
585 void dml32_UseMinimumDCFCLK(
586 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
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,
600 unsigned int GPUVMMaxPageTableLevels,
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[],
615 double RequiredDPPCLKPerSurface[][2][DC__NUM_DPP__MAX],
616 double RequiredDISPCLK[][2],
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[],
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[],
640 double DCFCLKState[][2]);
642 unsigned int dml32_CalculateExtraLatencyBytes(unsigned int ReorderingBytes,
643 unsigned int TotalNumberOfActiveDPP,
644 unsigned int PixelChunkSizeInKByte,
645 unsigned int TotalNumberOfDCCActiveDPP,
646 unsigned int MetaChunkSize,
649 unsigned int NumberOfActiveSurfaces,
650 unsigned int NumberOfDPP[],
651 unsigned int dpte_group_bytes[],
652 double HostVMInefficiencyFactor,
653 double HostVMMinPageSize,
654 unsigned int HostVMMaxNonCachedPageTableLevels);
656 void dml32_CalculateVUpdateAndDynamicMetadataParameters(
657 unsigned int MaxInterDCNTileRepeaters,
660 double DCFClkDeepSleep,
664 unsigned int DynamicMetadataTransmittedBytes,
665 unsigned int DynamicMetadataLinesBeforeActiveRequired,
666 unsigned int InterlaceEnable,
667 bool ProgressiveToInterlaceUnitInOPP,
672 unsigned int *VUpdateOffsetPix,
673 double *VUpdateWidthPix,
674 double *VReadyOffsetPix);
676 double dml32_CalculateTWait(
677 unsigned int PrefetchMode,
678 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange,
679 bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
681 double DRAMClockChangeLatency,
682 double FCLKChangeLatency,
683 double UrgentLatency,
684 double SREnterPlusExitTime);
686 double dml32_get_return_bw_mbps(const soc_bounding_box_st *soc,
687 const int VoltageLevel,
688 const bool HostVMEnable,
690 const double FabricClock,
691 const double DRAMSpeed);
693 double dml32_get_return_bw_mbps_vm_only(const soc_bounding_box_st *soc,
694 const int VoltageLevel,
696 const double FabricClock,
697 const double DRAMSpeed);
699 double dml32_CalculateExtraLatency(
700 unsigned int RoundTripPingLatencyCycles,
701 unsigned int ReorderingBytes,
703 unsigned int TotalNumberOfActiveDPP,
704 unsigned int PixelChunkSizeInKByte,
705 unsigned int TotalNumberOfDCCActiveDPP,
706 unsigned int MetaChunkSize,
710 unsigned int NumberOfActiveSurfaces,
711 unsigned int NumberOfDPP[],
712 unsigned int dpte_group_bytes[],
713 double HostVMInefficiencyFactor,
714 double HostVMMinPageSize,
715 unsigned int HostVMMaxNonCachedPageTableLevels);
717 bool dml32_CalculatePrefetchSchedule(
718 struct dml32_CalculatePrefetchSchedule *st_vars,
719 double HostVMInefficiencyFactor,
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,
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,
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,
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,
773 double *prefetch_vmrow_bw,
777 unsigned int *VUpdateOffsetPix,
778 double *VUpdateWidthPix,
779 double *VReadyOffsetPix);
781 void dml32_CalculateFlipSchedule(
782 double HostVMInefficiencyFactor,
783 double UrgentExtraLatency,
784 double UrgentLatency,
785 unsigned int GPUVMMaxPageTableLevels,
787 unsigned int HostVMMaxNonCachedPageTableLevels,
789 double HostVMMinPageSize,
790 double PDEAndMetaPTEBytesPerFrame,
792 double DPTEBytesPerRow,
793 double BandwidthAvailableForImmediateFlip,
794 unsigned int TotImmediateFlipBytes,
795 enum source_format_class SourcePixelFormat,
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,
808 double *DestinationLinesToRequestVMInImmediateFlip,
809 double *DestinationLinesToRequestRowInImmediateFlip,
810 double *final_flip_bw,
811 bool *ImmediateFlipSupportedForPipe);
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,
824 bool SynchronizeTimingsFinal,
825 bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
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,
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[],
842 double HRatioChroma[],
843 unsigned int VTaps[],
844 unsigned int VTapsChroma[],
846 double VRatioChroma[],
847 unsigned int HTotal[],
848 unsigned int VTotal[],
849 unsigned int VActive[],
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,
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[]);
875 double dml32_CalculateWriteBackDISPCLK(
876 enum source_format_class WritebackPixelFormat,
878 double WritebackHRatio,
879 double WritebackVRatio,
880 unsigned int WritebackHTaps,
881 unsigned int WritebackVTaps,
882 unsigned int WritebackSourceWidth,
883 unsigned int WritebackDestinationWidth,
885 unsigned int WritebackLineBufferSize,
886 double DISPCLKDPPCLKVCOSpeed);
888 void dml32_CalculateMinAndMaxPrefetchMode(
889 enum dm_prefetch_modes AllowForPStateChangeOrStutterInVBlankFinal,
890 unsigned int *MinPrefetchMode,
891 unsigned int *MaxPrefetchMode);
893 void dml32_CalculatePixelDeliveryTimes(
894 unsigned int NumberOfActiveSurfaces,
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[],
903 double HRatioChroma[],
905 double PSCL_THROUGHPUT[],
906 double PSCL_THROUGHPUT_CHROMA[],
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[],
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[]);
930 void dml32_CalculateMetaAndPTETimes(
931 bool use_one_row_for_frame[],
932 unsigned int NumberOfActiveSurfaces,
934 unsigned int MetaChunkSize,
935 unsigned int MinMetaChunkSizeBytes,
936 unsigned int HTotal[],
938 double VRatioChroma[],
939 double DestinationLinesToRequestRowInVBlank[],
940 double DestinationLinesToRequestRowInImmediateFlip[],
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[],
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[]);
984 void dml32_CalculateVMGroupAndRequestTimes(
985 unsigned int NumberOfActiveSurfaces,
987 unsigned int GPUVMMaxPageTableLevels,
988 unsigned int HTotal[],
989 unsigned int BytePerPixelC[],
990 double DestinationLinesToRequestVMInVBlank[],
991 double DestinationLinesToRequestVMInImmediateFlip[],
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[],
1003 double TimePerVMGroupVBlank[],
1004 double TimePerVMGroupFlip[],
1005 double TimePerVMRequestVBlank[],
1006 double TimePerVMRequestFlip[]);
1008 void dml32_CalculateDCCConfiguration(
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,
1026 unsigned int *MaxUncompressedBlockLuma,
1027 unsigned int *MaxUncompressedBlockChroma,
1028 unsigned int *MaxCompressedBlockLuma,
1029 unsigned int *MaxCompressedBlockChroma,
1030 unsigned int *IndependentBlockLuma,
1031 unsigned int *IndependentBlockChroma);
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,
1045 unsigned int CompbufReservedSpace64B,
1046 unsigned int CompbufReservedSpaceZs,
1048 double SRExitZ8Time,
1049 bool SynchronizeTimingsFinal,
1050 unsigned int BlendingAndTiming[],
1051 double StutterEnterPlusExitWatermark,
1052 double Z8StutterEnterPlusExitWatermark,
1053 bool ProgressiveToInterlaceUnitInOPP,
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[],
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[],
1080 bool WritebackEnable[],
1081 double ReadBandwidthSurfaceLuma[],
1082 double ReadBandwidthSurfaceChroma[],
1083 double meta_row_bw[],
1084 double dpte_row_bw[],
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);
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
1104 unsigned int *MaxTotalDETInKByte,
1105 unsigned int *nomDETInKByte,
1106 unsigned int *MinCompressedBufferSizeInKByte);
1108 bool dml32_CalculateVActiveBandwithSupport(unsigned int NumberOfActiveSurfaces,
1110 bool NotUrgentLatencyHiding[],
1111 double ReadBandwidthLuma[],
1112 double ReadBandwidthChroma[],
1114 double meta_row_bandwidth[],
1115 double dpte_row_bandwidth[],
1116 unsigned int NumberOfDPP[],
1117 double UrgentBurstFactorLuma[],
1118 double UrgentBurstFactorChroma[],
1119 double UrgentBurstFactorCursor[]);
1121 void dml32_CalculatePrefetchBandwithSupport(unsigned int NumberOfActiveSurfaces,
1123 bool NotUrgentLatencyHiding[],
1124 double ReadBandwidthLuma[],
1125 double ReadBandwidthChroma[],
1126 double PrefetchBandwidthLuma[],
1127 double PrefetchBandwidthChroma[],
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[],
1142 double *PrefetchBandwidth,
1143 double *FractionOfUrgentBandwidth,
1144 bool *PrefetchBandwidthSupport);
1146 double dml32_CalculateBandwidthAvailableForImmediateFlip(unsigned int NumberOfActiveSurfaces,
1148 double ReadBandwidthLuma[],
1149 double ReadBandwidthChroma[],
1150 double PrefetchBandwidthLuma[],
1151 double PrefetchBandwidthChroma[],
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[]);
1162 void dml32_CalculateImmediateFlipBandwithSupport(unsigned int NumberOfActiveSurfaces,
1164 enum immediate_flip_requirement ImmediateFlipRequirement[],
1165 double final_flip_bw[],
1166 double ReadBandwidthLuma[],
1167 double ReadBandwidthChroma[],
1168 double PrefetchBandwidthLuma[],
1169 double PrefetchBandwidthChroma[],
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[],
1184 double *TotalBandwidth,
1185 double *FractionOfUrgentBandwidth,
1186 bool *ImmediateFlipBandwidthSupport);