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 double HostVMInefficiencyFactor,
720 unsigned int DSCDelay,
721 double DPPCLKDelaySubtotalPlusCNVCFormater,
722 double DPPCLKDelaySCL,
723 double DPPCLKDelaySCLLBOnly,
724 double DPPCLKDelayCNVCCursor,
725 double DISPCLKDelaySubtotal,
726 unsigned int DPP_RECOUT_WIDTH,
727 enum output_format_class OutputFormat,
728 unsigned int MaxInterDCNTileRepeaters,
729 unsigned int VStartup,
730 unsigned int MaxVStartup,
731 unsigned int GPUVMPageTableLevels,
734 unsigned int HostVMMaxNonCachedPageTableLevels,
735 double HostVMMinPageSize,
736 bool DynamicMetadataEnable,
737 bool DynamicMetadataVMEnabled,
738 int DynamicMetadataLinesBeforeActiveRequired,
739 unsigned int DynamicMetadataTransmittedBytes,
740 double UrgentLatency,
741 double UrgentExtraLatency,
743 unsigned int PDEAndMetaPTEBytesFrame,
744 unsigned int MetaRowByte,
745 unsigned int PixelPTEBytesPerRow,
746 double PrefetchSourceLinesY,
747 unsigned int SwathWidthY,
748 unsigned int VInitPreFillY,
749 unsigned int MaxNumSwathY,
750 double PrefetchSourceLinesC,
751 unsigned int SwathWidthC,
752 unsigned int VInitPreFillC,
753 unsigned int MaxNumSwathC,
754 unsigned int swath_width_luma_ub,
755 unsigned int swath_width_chroma_ub,
756 unsigned int SwathHeightY,
757 unsigned int SwathHeightC,
760 double *DSTXAfterScaler,
761 double *DSTYAfterScaler,
762 double *DestinationLinesForPrefetch,
763 double *PrefetchBandwidth,
764 double *DestinationLinesToRequestVMInVBlank,
765 double *DestinationLinesToRequestRowInVBlank,
766 double *VRatioPrefetchY,
767 double *VRatioPrefetchC,
768 double *RequiredPrefetchPixDataBWLuma,
769 double *RequiredPrefetchPixDataBWChroma,
770 bool *NotEnoughTimeForDynamicMetadata,
772 double *prefetch_vmrow_bw,
776 unsigned int *VUpdateOffsetPix,
777 double *VUpdateWidthPix,
778 double *VReadyOffsetPix);
780 void dml32_CalculateFlipSchedule(
781 double HostVMInefficiencyFactor,
782 double UrgentExtraLatency,
783 double UrgentLatency,
784 unsigned int GPUVMMaxPageTableLevels,
786 unsigned int HostVMMaxNonCachedPageTableLevels,
788 double HostVMMinPageSize,
789 double PDEAndMetaPTEBytesPerFrame,
791 double DPTEBytesPerRow,
792 double BandwidthAvailableForImmediateFlip,
793 unsigned int TotImmediateFlipBytes,
794 enum source_format_class SourcePixelFormat,
800 unsigned int dpte_row_height,
801 unsigned int meta_row_height,
802 unsigned int dpte_row_height_chroma,
803 unsigned int meta_row_height_chroma,
804 bool use_one_row_for_frame_flip,
807 double *DestinationLinesToRequestVMInImmediateFlip,
808 double *DestinationLinesToRequestRowInImmediateFlip,
809 double *final_flip_bw,
810 bool *ImmediateFlipSupportedForPipe);
812 void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
813 bool USRRetrainingRequiredFinal,
814 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
815 unsigned int PrefetchMode,
816 unsigned int NumberOfActiveSurfaces,
817 unsigned int MaxLineBufferLines,
818 unsigned int LineBufferSize,
819 unsigned int WritebackInterfaceBufferSize,
822 bool SynchronizeTimingsFinal,
823 bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
825 unsigned int dpte_group_bytes[],
826 unsigned int meta_row_height[],
827 unsigned int meta_row_height_chroma[],
828 SOCParametersList mmSOCParameters,
829 unsigned int WritebackChunkSize,
831 double DCFClkDeepSleep,
832 unsigned int DETBufferSizeY[],
833 unsigned int DETBufferSizeC[],
834 unsigned int SwathHeightY[],
835 unsigned int SwathHeightC[],
836 unsigned int LBBitPerPixel[],
837 double SwathWidthY[],
838 double SwathWidthC[],
840 double HRatioChroma[],
841 unsigned int VTaps[],
842 unsigned int VTapsChroma[],
844 double VRatioChroma[],
845 unsigned int HTotal[],
846 unsigned int VTotal[],
847 unsigned int VActive[],
849 unsigned int BlendingAndTiming[],
850 unsigned int DPPPerSurface[],
851 double BytePerPixelDETY[],
852 double BytePerPixelDETC[],
853 double DSTXAfterScaler[],
854 double DSTYAfterScaler[],
855 bool WritebackEnable[],
856 enum source_format_class WritebackPixelFormat[],
857 double WritebackDestinationWidth[],
858 double WritebackDestinationHeight[],
859 double WritebackSourceHeight[],
860 bool UnboundedRequestEnabled,
861 unsigned int CompressedBufferSizeInkByte,
864 Watermarks *Watermark,
865 enum clock_change_support *DRAMClockChangeSupport,
866 double MaxActiveDRAMClockChangeLatencySupported[],
867 unsigned int SubViewportLinesNeededInMALL[],
868 enum dm_fclock_change_support *FCLKChangeSupport,
869 double *MinActiveFCLKChangeLatencySupported,
870 bool *USRRetrainingSupport,
871 double ActiveDRAMClockChangeLatencyMargin[]);
873 double dml32_CalculateWriteBackDISPCLK(
874 enum source_format_class WritebackPixelFormat,
876 double WritebackHRatio,
877 double WritebackVRatio,
878 unsigned int WritebackHTaps,
879 unsigned int WritebackVTaps,
880 unsigned int WritebackSourceWidth,
881 unsigned int WritebackDestinationWidth,
883 unsigned int WritebackLineBufferSize,
884 double DISPCLKDPPCLKVCOSpeed);
886 void dml32_CalculateMinAndMaxPrefetchMode(
887 enum dm_prefetch_modes AllowForPStateChangeOrStutterInVBlankFinal,
888 unsigned int *MinPrefetchMode,
889 unsigned int *MaxPrefetchMode);
891 void dml32_CalculatePixelDeliveryTimes(
892 unsigned int NumberOfActiveSurfaces,
894 double VRatioChroma[],
895 double VRatioPrefetchY[],
896 double VRatioPrefetchC[],
897 unsigned int swath_width_luma_ub[],
898 unsigned int swath_width_chroma_ub[],
899 unsigned int DPPPerSurface[],
901 double HRatioChroma[],
903 double PSCL_THROUGHPUT[],
904 double PSCL_THROUGHPUT_CHROMA[],
906 unsigned int BytePerPixelC[],
907 enum dm_rotation_angle SourceRotation[],
908 unsigned int NumberOfCursors[],
909 unsigned int CursorWidth[][DC__NUM_CURSOR__MAX],
910 unsigned int CursorBPP[][DC__NUM_CURSOR__MAX],
911 unsigned int BlockWidth256BytesY[],
912 unsigned int BlockHeight256BytesY[],
913 unsigned int BlockWidth256BytesC[],
914 unsigned int BlockHeight256BytesC[],
917 double DisplayPipeLineDeliveryTimeLuma[],
918 double DisplayPipeLineDeliveryTimeChroma[],
919 double DisplayPipeLineDeliveryTimeLumaPrefetch[],
920 double DisplayPipeLineDeliveryTimeChromaPrefetch[],
921 double DisplayPipeRequestDeliveryTimeLuma[],
922 double DisplayPipeRequestDeliveryTimeChroma[],
923 double DisplayPipeRequestDeliveryTimeLumaPrefetch[],
924 double DisplayPipeRequestDeliveryTimeChromaPrefetch[],
925 double CursorRequestDeliveryTime[],
926 double CursorRequestDeliveryTimePrefetch[]);
928 void dml32_CalculateMetaAndPTETimes(
929 bool use_one_row_for_frame[],
930 unsigned int NumberOfActiveSurfaces,
932 unsigned int MetaChunkSize,
933 unsigned int MinMetaChunkSizeBytes,
934 unsigned int HTotal[],
936 double VRatioChroma[],
937 double DestinationLinesToRequestRowInVBlank[],
938 double DestinationLinesToRequestRowInImmediateFlip[],
941 unsigned int BytePerPixelY[],
942 unsigned int BytePerPixelC[],
943 enum dm_rotation_angle SourceRotation[],
944 unsigned int dpte_row_height[],
945 unsigned int dpte_row_height_chroma[],
946 unsigned int meta_row_width[],
947 unsigned int meta_row_width_chroma[],
948 unsigned int meta_row_height[],
949 unsigned int meta_row_height_chroma[],
950 unsigned int meta_req_width[],
951 unsigned int meta_req_width_chroma[],
952 unsigned int meta_req_height[],
953 unsigned int meta_req_height_chroma[],
954 unsigned int dpte_group_bytes[],
955 unsigned int PTERequestSizeY[],
956 unsigned int PTERequestSizeC[],
957 unsigned int PixelPTEReqWidthY[],
958 unsigned int PixelPTEReqHeightY[],
959 unsigned int PixelPTEReqWidthC[],
960 unsigned int PixelPTEReqHeightC[],
961 unsigned int dpte_row_width_luma_ub[],
962 unsigned int dpte_row_width_chroma_ub[],
965 double DST_Y_PER_PTE_ROW_NOM_L[],
966 double DST_Y_PER_PTE_ROW_NOM_C[],
967 double DST_Y_PER_META_ROW_NOM_L[],
968 double DST_Y_PER_META_ROW_NOM_C[],
969 double TimePerMetaChunkNominal[],
970 double TimePerChromaMetaChunkNominal[],
971 double TimePerMetaChunkVBlank[],
972 double TimePerChromaMetaChunkVBlank[],
973 double TimePerMetaChunkFlip[],
974 double TimePerChromaMetaChunkFlip[],
975 double time_per_pte_group_nom_luma[],
976 double time_per_pte_group_vblank_luma[],
977 double time_per_pte_group_flip_luma[],
978 double time_per_pte_group_nom_chroma[],
979 double time_per_pte_group_vblank_chroma[],
980 double time_per_pte_group_flip_chroma[]);
982 void dml32_CalculateVMGroupAndRequestTimes(
983 unsigned int NumberOfActiveSurfaces,
985 unsigned int GPUVMMaxPageTableLevels,
986 unsigned int HTotal[],
987 unsigned int BytePerPixelC[],
988 double DestinationLinesToRequestVMInVBlank[],
989 double DestinationLinesToRequestVMInImmediateFlip[],
992 unsigned int dpte_row_width_luma_ub[],
993 unsigned int dpte_row_width_chroma_ub[],
994 unsigned int vm_group_bytes[],
995 unsigned int dpde0_bytes_per_frame_ub_l[],
996 unsigned int dpde0_bytes_per_frame_ub_c[],
997 unsigned int meta_pte_bytes_per_frame_ub_l[],
998 unsigned int meta_pte_bytes_per_frame_ub_c[],
1001 double TimePerVMGroupVBlank[],
1002 double TimePerVMGroupFlip[],
1003 double TimePerVMRequestVBlank[],
1004 double TimePerVMRequestFlip[]);
1006 void dml32_CalculateDCCConfiguration(
1008 bool DCCProgrammingAssumesScanDirectionUnknown,
1009 enum source_format_class SourcePixelFormat,
1010 unsigned int SurfaceWidthLuma,
1011 unsigned int SurfaceWidthChroma,
1012 unsigned int SurfaceHeightLuma,
1013 unsigned int SurfaceHeightChroma,
1014 unsigned int nomDETInKByte,
1015 unsigned int RequestHeight256ByteLuma,
1016 unsigned int RequestHeight256ByteChroma,
1017 enum dm_swizzle_mode TilingFormat,
1018 unsigned int BytePerPixelY,
1019 unsigned int BytePerPixelC,
1020 double BytePerPixelDETY,
1021 double BytePerPixelDETC,
1022 enum dm_rotation_angle SourceRotation,
1024 unsigned int *MaxUncompressedBlockLuma,
1025 unsigned int *MaxUncompressedBlockChroma,
1026 unsigned int *MaxCompressedBlockLuma,
1027 unsigned int *MaxCompressedBlockChroma,
1028 unsigned int *IndependentBlockLuma,
1029 unsigned int *IndependentBlockChroma);
1031 void dml32_CalculateStutterEfficiency(
1032 unsigned int CompressedBufferSizeInkByte,
1033 enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
1034 bool UnboundedRequestEnabled,
1035 unsigned int MetaFIFOSizeInKEntries,
1036 unsigned int ZeroSizeBufferEntries,
1037 unsigned int PixelChunkSizeInKByte,
1038 unsigned int NumberOfActiveSurfaces,
1039 unsigned int ROBBufferSizeInKByte,
1040 double TotalDataReadBandwidth,
1043 unsigned int CompbufReservedSpace64B,
1044 unsigned int CompbufReservedSpaceZs,
1046 double SRExitZ8Time,
1047 bool SynchronizeTimingsFinal,
1048 unsigned int BlendingAndTiming[],
1049 double StutterEnterPlusExitWatermark,
1050 double Z8StutterEnterPlusExitWatermark,
1051 bool ProgressiveToInterlaceUnitInOPP,
1053 double MinTTUVBlank[],
1054 unsigned int DPPPerSurface[],
1055 unsigned int DETBufferSizeY[],
1056 unsigned int BytePerPixelY[],
1057 double BytePerPixelDETY[],
1058 double SwathWidthY[],
1059 unsigned int SwathHeightY[],
1060 unsigned int SwathHeightC[],
1061 double NetDCCRateLuma[],
1062 double NetDCCRateChroma[],
1063 double DCCFractionOfZeroSizeRequestsLuma[],
1064 double DCCFractionOfZeroSizeRequestsChroma[],
1065 unsigned int HTotal[],
1066 unsigned int VTotal[],
1067 double PixelClock[],
1069 enum dm_rotation_angle SourceRotation[],
1070 unsigned int BlockHeight256BytesY[],
1071 unsigned int BlockWidth256BytesY[],
1072 unsigned int BlockHeight256BytesC[],
1073 unsigned int BlockWidth256BytesC[],
1074 unsigned int DCCYMaxUncompressedBlock[],
1075 unsigned int DCCCMaxUncompressedBlock[],
1076 unsigned int VActive[],
1078 bool WritebackEnable[],
1079 double ReadBandwidthSurfaceLuma[],
1080 double ReadBandwidthSurfaceChroma[],
1081 double meta_row_bw[],
1082 double dpte_row_bw[],
1085 double *StutterEfficiencyNotIncludingVBlank,
1086 double *StutterEfficiency,
1087 unsigned int *NumberOfStutterBurstsPerFrame,
1088 double *Z8StutterEfficiencyNotIncludingVBlank,
1089 double *Z8StutterEfficiency,
1090 unsigned int *Z8NumberOfStutterBurstsPerFrame,
1091 double *StutterPeriod,
1092 bool *DCHUBBUB_ARB_CSTATE_MAX_CAP_MODE);
1094 void dml32_CalculateMaxDETAndMinCompressedBufferSize(
1095 unsigned int ConfigReturnBufferSizeInKByte,
1096 unsigned int ROBBufferSizeInKByte,
1097 unsigned int MaxNumDPP,
1098 bool nomDETInKByteOverrideEnable, // VBA_DELTA, allow DV to override default DET size
1099 unsigned int nomDETInKByteOverrideValue, // VBA_DELTA
1102 unsigned int *MaxTotalDETInKByte,
1103 unsigned int *nomDETInKByte,
1104 unsigned int *MinCompressedBufferSizeInKByte);
1106 bool dml32_CalculateVActiveBandwithSupport(unsigned int NumberOfActiveSurfaces,
1108 bool NotUrgentLatencyHiding[],
1109 double ReadBandwidthLuma[],
1110 double ReadBandwidthChroma[],
1112 double meta_row_bandwidth[],
1113 double dpte_row_bandwidth[],
1114 unsigned int NumberOfDPP[],
1115 double UrgentBurstFactorLuma[],
1116 double UrgentBurstFactorChroma[],
1117 double UrgentBurstFactorCursor[]);
1119 void dml32_CalculatePrefetchBandwithSupport(unsigned int NumberOfActiveSurfaces,
1121 bool NotUrgentLatencyHiding[],
1122 double ReadBandwidthLuma[],
1123 double ReadBandwidthChroma[],
1124 double PrefetchBandwidthLuma[],
1125 double PrefetchBandwidthChroma[],
1127 double meta_row_bandwidth[],
1128 double dpte_row_bandwidth[],
1129 double cursor_bw_pre[],
1130 double prefetch_vmrow_bw[],
1131 unsigned int NumberOfDPP[],
1132 double UrgentBurstFactorLuma[],
1133 double UrgentBurstFactorChroma[],
1134 double UrgentBurstFactorCursor[],
1135 double UrgentBurstFactorLumaPre[],
1136 double UrgentBurstFactorChromaPre[],
1137 double UrgentBurstFactorCursorPre[],
1140 double *PrefetchBandwidth,
1141 double *FractionOfUrgentBandwidth,
1142 bool *PrefetchBandwidthSupport);
1144 double dml32_CalculateBandwidthAvailableForImmediateFlip(unsigned int NumberOfActiveSurfaces,
1146 double ReadBandwidthLuma[],
1147 double ReadBandwidthChroma[],
1148 double PrefetchBandwidthLuma[],
1149 double PrefetchBandwidthChroma[],
1151 double cursor_bw_pre[],
1152 unsigned int NumberOfDPP[],
1153 double UrgentBurstFactorLuma[],
1154 double UrgentBurstFactorChroma[],
1155 double UrgentBurstFactorCursor[],
1156 double UrgentBurstFactorLumaPre[],
1157 double UrgentBurstFactorChromaPre[],
1158 double UrgentBurstFactorCursorPre[]);
1160 void dml32_CalculateImmediateFlipBandwithSupport(unsigned int NumberOfActiveSurfaces,
1162 enum immediate_flip_requirement ImmediateFlipRequirement[],
1163 double final_flip_bw[],
1164 double ReadBandwidthLuma[],
1165 double ReadBandwidthChroma[],
1166 double PrefetchBandwidthLuma[],
1167 double PrefetchBandwidthChroma[],
1169 double meta_row_bandwidth[],
1170 double dpte_row_bandwidth[],
1171 double cursor_bw_pre[],
1172 double prefetch_vmrow_bw[],
1173 unsigned int NumberOfDPP[],
1174 double UrgentBurstFactorLuma[],
1175 double UrgentBurstFactorChroma[],
1176 double UrgentBurstFactorCursor[],
1177 double UrgentBurstFactorLumaPre[],
1178 double UrgentBurstFactorChromaPre[],
1179 double UrgentBurstFactorCursorPre[],
1182 double *TotalBandwidth,
1183 double *FractionOfUrgentBandwidth,
1184 bool *ImmediateFlipBandwidthSupport);