#include "dml2_internal_shared_types.h"
#include "dml2_core_shared.h"
#include "dml2_debug.h"
#include "lib_float_math.h"
double dml2_core_shared_div_rem(double dividend, unsigned int divisor, unsigned int *remainder)
{ … }
static void dml2_print_dml_mode_support_info(const struct dml2_core_internal_mode_support_info *support, bool fail_only);
static void get_stream_output_bpp(double *out_bpp, const struct dml2_display_cfg *display_cfg);
static unsigned int dml_round_to_multiple(unsigned int num, unsigned int multiple, bool up);
static unsigned int dml_get_num_active_pipes(int unsigned num_planes, const struct core_display_cfg_support_info *cfg_support_info);
static void dml_calc_pipe_plane_mapping(const struct core_display_cfg_support_info *cfg_support_info, unsigned int *pipe_plane);
static bool dml_is_phantom_pipe(const struct dml2_plane_parameters *plane_cfg);
static bool dml_get_is_phantom_pipe(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, unsigned int pipe_idx);
static void CalculateMaxDETAndMinCompressedBufferSize(unsigned int ConfigReturnBufferSizeInKByte,
unsigned int ConfigReturnBufferSegmentSizeInKByte,
unsigned int ROBBufferSizeInKByte,
unsigned int MaxNumDPP,
unsigned int nomDETInKByteOverrideEnable,
unsigned int nomDETInKByteOverrideValue,
bool is_mrq_present,
unsigned int *MaxTotalDETInKByte,
unsigned int *nomDETInKByte,
unsigned int *MinCompressedBufferSizeInKByte);
static void PixelClockAdjustmentForProgressiveToInterlaceUnit(const struct dml2_display_cfg *display_cfg, bool ptoi_supported, double *PixelClockBackEnd);
static unsigned int dml_get_tile_block_size_bytes(enum dml2_swizzle_mode sw_mode);
static bool dml_is_vertical_rotation(enum dml2_rotation_angle Scan);
static int unsigned dml_get_gfx_version(enum dml2_swizzle_mode sw_mode);
static void CalculateBytePerPixelAndBlockSizes(enum dml2_source_format_class SourcePixelFormat,
enum dml2_swizzle_mode SurfaceTiling,
unsigned int pitch_y,
unsigned int pitch_c,
unsigned int *BytePerPixelY,
unsigned int *BytePerPixelC,
double *BytePerPixelDETY,
double *BytePerPixelDETC,
unsigned int *BlockHeight256BytesY,
unsigned int *BlockHeight256BytesC,
unsigned int *BlockWidth256BytesY,
unsigned int *BlockWidth256BytesC,
unsigned int *MacroTileHeightY,
unsigned int *MacroTileHeightC,
unsigned int *MacroTileWidthY,
unsigned int *MacroTileWidthC,
bool *surf_linear128_l,
bool *surf_linear128_c);
static void CalculateSinglePipeDPPCLKAndSCLThroughput(
double HRatio,
double HRatioChroma,
double VRatio,
double VRatioChroma,
double MaxDCHUBToPSCLThroughput,
double MaxPSCLToLBThroughput,
double PixelClock,
enum dml2_source_format_class SourcePixelFormat,
unsigned int HTaps,
unsigned int HTapsChroma,
unsigned int VTaps,
unsigned int VTapsChroma,
double *PSCL_THROUGHPUT,
double *PSCL_THROUGHPUT_CHROMA,
double *DPPCLKUsingSingleDPP);
static void CalculateSwathWidth(
const struct dml2_display_cfg *display_cfg,
bool ForceSingleDPP,
unsigned int NumberOfActiveSurfaces,
enum dml2_odm_mode ODMMode[],
unsigned int BytePerPixY[],
unsigned int BytePerPixC[],
unsigned int Read256BytesBlockHeightY[],
unsigned int Read256BytesBlockHeightC[],
unsigned int Read256BytesBlockWidthY[],
unsigned int Read256BytesBlockWidthC[],
bool surf_linear128_l[],
bool surf_linear128_c[],
unsigned int DPPPerSurface[],
unsigned int req_per_swath_ub_l[],
unsigned int req_per_swath_ub_c[],
unsigned int SwathWidthSingleDPPY[],
unsigned int SwathWidthSingleDPPC[],
unsigned int SwathWidthY[],
unsigned int SwathWidthC[],
unsigned int MaximumSwathHeightY[],
unsigned int MaximumSwathHeightC[],
unsigned int swath_width_luma_ub[],
unsigned int swath_width_chroma_ub[]);
static bool UnboundedRequest(bool unb_req_force_en, bool unb_req_force_val, unsigned int TotalNumberOfActiveDPP, bool NoChromaOrLinear);
static void CalculateDETBufferSize(struct dml2_core_shared_calculate_det_buffer_size_params *p);
static double CalculateRequiredDispclk(enum dml2_odm_mode ODMMode, double PixelClock);
static double TruncToValidBPP(
struct dml2_core_shared_TruncToValidBPP_locals *l,
double LinkBitRate,
unsigned int Lanes,
unsigned int HTotal,
unsigned int HActive,
double PixelClock,
double DesiredBPP,
bool DSCEnable,
enum dml2_output_encoder_class Output,
enum dml2_output_format_class Format,
unsigned int DSCInputBitPerComponent,
unsigned int DSCSlices,
unsigned int AudioRate,
unsigned int AudioLayout,
enum dml2_odm_mode ODMModeNoDSC,
enum dml2_odm_mode ODMModeDSC,
unsigned int *RequiredSlots);
static unsigned int dscceComputeDelay(
unsigned int bpc,
double BPP,
unsigned int sliceWidth,
unsigned int numSlices,
enum dml2_output_format_class pixelFormat,
enum dml2_output_encoder_class Output);
static unsigned int dscComputeDelay(enum dml2_output_format_class pixelFormat, enum dml2_output_encoder_class Output);
static unsigned int CalculateHostVMDynamicLevels(bool GPUVMEnable, bool HostVMEnable, unsigned int HostVMMinPageSize, unsigned int HostVMMaxNonCachedPageTableLevels);
static unsigned int CalculateVMAndRowBytes(struct dml2_core_shared_calculate_vm_and_row_bytes_params *p);
static unsigned int CalculatePrefetchSourceLines(
double VRatio,
unsigned int VTaps,
bool Interlace,
bool ProgressiveToInterlaceUnitInOPP,
unsigned int SwathHeight,
enum dml2_rotation_angle RotationAngle,
bool mirrored,
bool ViewportStationary,
unsigned int SwathWidth,
unsigned int ViewportHeight,
unsigned int ViewportXStart,
unsigned int ViewportYStart,
unsigned int *VInitPreFill,
unsigned int *MaxNumSwath);
static void CalculateRowBandwidth(
bool GPUVMEnable,
bool use_one_row_for_frame,
enum dml2_source_format_class SourcePixelFormat,
double VRatio,
double VRatioChroma,
bool DCCEnable,
double LineTime,
unsigned int PixelPTEBytesPerRowLuma,
unsigned int PixelPTEBytesPerRowChroma,
unsigned int dpte_row_height_luma,
unsigned int dpte_row_height_chroma,
bool mrq_present,
unsigned int meta_row_bytes_per_row_ub_l,
unsigned int meta_row_bytes_per_row_ub_c,
unsigned int meta_row_height_luma,
unsigned int meta_row_height_chroma,
double *dpte_row_bw,
double *meta_row_bw);
static void CalculateMALLUseForStaticScreen(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int MALLAllocatedForDCN,
unsigned int SurfaceSizeInMALL[],
bool one_row_per_frame_fits_in_buffer[],
bool is_using_mall_for_ss[]);
static void CalculateDCCConfiguration(
bool DCCEnabled,
bool DCCProgrammingAssumesScanDirectionUnknown,
enum dml2_source_format_class SourcePixelFormat,
unsigned int SurfaceWidthLuma,
unsigned int SurfaceWidthChroma,
unsigned int SurfaceHeightLuma,
unsigned int SurfaceHeightChroma,
unsigned int nomDETInKByte,
unsigned int RequestHeight256ByteLuma,
unsigned int RequestHeight256ByteChroma,
enum dml2_swizzle_mode TilingFormat,
unsigned int BytePerPixelY,
unsigned int BytePerPixelC,
double BytePerPixelDETY,
double BytePerPixelDETC,
enum dml2_rotation_angle RotationAngle,
enum dml2_core_internal_request_type *RequestLuma,
enum dml2_core_internal_request_type *RequestChroma,
unsigned int *MaxUncompressedBlockLuma,
unsigned int *MaxUncompressedBlockChroma,
unsigned int *MaxCompressedBlockLuma,
unsigned int *MaxCompressedBlockChroma,
unsigned int *IndependentBlockLuma,
unsigned int *IndependentBlockChroma);
static void calculate_mcache_row_bytes(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_calculate_mcache_row_bytes_params *p);
static void calculate_mcache_setting(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_calculate_mcache_setting_params *p);
static void calculate_mall_bw_overhead_factor(
double mall_prefetch_sdp_overhead_factor[],
double mall_prefetch_dram_overhead_factor[],
const struct dml2_display_cfg *display_cfg,
unsigned int num_active_planes);
static double dml_get_return_bandwidth_available(
const struct dml2_soc_bb *soc,
enum dml2_core_internal_soc_state_type state_type,
enum dml2_core_internal_bw_type bw_type,
bool is_avg_bw,
bool is_hvm_en,
bool is_hvm_only,
double dcflk_mhz,
double fclk_mhz,
double dram_bw_mbps);
static void calculate_bandwidth_available(
double avg_bandwidth_available_min[dml2_core_internal_soc_state_max],
double avg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available_min[dml2_core_internal_soc_state_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available_vm_only[dml2_core_internal_soc_state_max],
double urg_bandwidth_available_pixel_and_vm[dml2_core_internal_soc_state_max],
const struct dml2_soc_bb *soc,
bool HostVMEnable,
double dcfclk_mhz,
double fclk_mhz,
double dram_bw_mbps);
static void calculate_avg_bandwidth_required(
double avg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
const struct dml2_display_cfg *display_cfg,
unsigned int num_active_planes,
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
double cursor_bw[],
double dcc_dram_bw_nom_overhead_factor_p0[],
double dcc_dram_bw_nom_overhead_factor_p1[],
double mall_prefetch_dram_overhead_factor[],
double mall_prefetch_sdp_overhead_factor[]);
static void CalculateVMRowAndSwath(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_CalculateVMRowAndSwath_params *p);
static double CalculateUrgentLatency(
double UrgentLatencyPixelDataOnly,
double UrgentLatencyPixelMixedWithVMData,
double UrgentLatencyVMDataOnly,
bool DoUrgentLatencyAdjustment,
double UrgentLatencyAdjustmentFabricClockComponent,
double UrgentLatencyAdjustmentFabricClockReference,
double FabricClock,
double uclk_freq_mhz,
enum dml2_qos_param_type qos_type,
unsigned int urgent_ramp_uclk_cycles,
unsigned int df_qos_response_time_fclk_cycles,
unsigned int max_round_trip_to_furthest_cs_fclk_cycles,
unsigned int mall_overhead_fclk_cycles,
double umc_urgent_ramp_latency_margin,
double fabric_max_transport_latency_margin);
static double CalculateTripToMemory(
double UrgLatency,
double FabricClock,
double uclk_freq_mhz,
enum dml2_qos_param_type qos_type,
unsigned int trip_to_memory_uclk_cycles,
unsigned int max_round_trip_to_furthest_cs_fclk_cycles,
unsigned int mall_overhead_fclk_cycles,
double umc_max_latency_margin,
double fabric_max_transport_latency_margin);
static double CalculateMetaTripToMemory(
double UrgLatency,
double FabricClock,
double uclk_freq_mhz,
enum dml2_qos_param_type qos_type,
unsigned int meta_trip_to_memory_uclk_cycles,
unsigned int meta_trip_to_memory_fclk_cycles,
double umc_max_latency_margin,
double fabric_max_transport_latency_margin);
static void calculate_cursor_req_attributes(
unsigned int cursor_width,
unsigned int cursor_bpp,
unsigned int *cursor_lines_per_chunk,
unsigned int *cursor_bytes_per_line,
unsigned int *cursor_bytes_per_chunk,
unsigned int *cursor_bytes);
static void calculate_cursor_urgent_burst_factor(
unsigned int CursorBufferSize,
unsigned int CursorWidth,
unsigned int cursor_bytes_per_chunk,
unsigned int cursor_lines_per_chunk,
double LineTime,
double UrgentLatency,
double *UrgentBurstFactorCursor,
bool *NotEnoughUrgentLatencyHiding);
static void CalculateUrgentBurstFactor(
const struct dml2_plane_parameters *plane_cfg,
unsigned int swath_width_luma_ub,
unsigned int swath_width_chroma_ub,
unsigned int SwathHeightY,
unsigned int SwathHeightC,
double LineTime,
double UrgentLatency,
double VRatio,
double VRatioC,
double BytePerPixelInDETY,
double BytePerPixelInDETC,
unsigned int DETBufferSizeY,
unsigned int DETBufferSizeC,
double *UrgentBurstFactorLuma,
double *UrgentBurstFactorChroma,
bool *NotEnoughUrgentLatencyHiding);
static void CalculateDCFCLKDeepSleep(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int BytePerPixelY[],
unsigned int BytePerPixelC[],
unsigned int SwathWidthY[],
unsigned int SwathWidthC[],
unsigned int DPPPerSurface[],
double PSCL_THROUGHPUT[],
double PSCL_THROUGHPUT_CHROMA[],
double Dppclk[],
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
unsigned int ReturnBusWidth,
double *DCFClkDeepSleep);
static double CalculateWriteBackDelay(
enum dml2_source_format_class WritebackPixelFormat,
double WritebackHRatio,
double WritebackVRatio,
unsigned int WritebackVTaps,
unsigned int WritebackDestinationWidth,
unsigned int WritebackDestinationHeight,
unsigned int WritebackSourceHeight,
unsigned int HTotal);
static unsigned int CalculateMaxVStartup(
bool ptoi_supported,
unsigned int vblank_nom_default_us,
const struct dml2_timing_cfg *timing,
double write_back_delay_us);
static void CalculateSwathAndDETConfiguration(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_CalculateSwathAndDETConfiguration_params *p);
static void CalculateODMMode(
unsigned int MaximumPixelsPerLinePerDSCUnit,
unsigned int HActive,
enum dml2_output_encoder_class Output,
enum dml2_odm_mode ODMUse,
double MaxDispclk,
bool DSCEnable,
unsigned int TotalNumberOfActiveDPP,
unsigned int MaxNumDPP,
double PixelClock,
bool *TotalAvailablePipesSupport,
unsigned int *NumberOfDPP,
enum dml2_odm_mode *ODMMode,
double *RequiredDISPCLKPerSurface);
static void CalculateOutputLink(
struct dml2_core_internal_scratch *s,
double PHYCLK,
double PHYCLKD18,
double PHYCLKD32,
double Downspreading,
bool IsMainSurfaceUsingTheIndicatedTiming,
enum dml2_output_encoder_class Output,
enum dml2_output_format_class OutputFormat,
unsigned int HTotal,
unsigned int HActive,
double PixelClockBackEnd,
double ForcedOutputLinkBPP,
unsigned int DSCInputBitPerComponent,
unsigned int NumberOfDSCSlices,
double AudioSampleRate,
unsigned int AudioSampleLayout,
enum dml2_odm_mode ODMModeNoDSC,
enum dml2_odm_mode ODMModeDSC,
enum dml2_dsc_enable_option DSCEnable,
unsigned int OutputLinkDPLanes,
enum dml2_output_link_dp_rate OutputLinkDPRate,
bool *RequiresDSC,
bool *RequiresFEC,
double *OutBpp,
enum dml2_core_internal_output_type *OutputType,
enum dml2_core_internal_output_type_rate *OutputRate,
unsigned int *RequiredSlots);
static double CalculateWriteBackDISPCLK(
enum dml2_source_format_class WritebackPixelFormat,
double PixelClock,
double WritebackHRatio,
double WritebackVRatio,
unsigned int WritebackHTaps,
unsigned int WritebackVTaps,
unsigned int WritebackSourceWidth,
unsigned int WritebackDestinationWidth,
unsigned int HTotal,
unsigned int WritebackLineBufferSize);
static double RequiredDTBCLK(
bool DSCEnable,
double PixelClock,
enum dml2_output_format_class OutputFormat,
double OutputBpp,
unsigned int DSCSlices,
unsigned int HTotal,
unsigned int HActive,
unsigned int AudioRate,
unsigned int AudioLayout);
static unsigned int DSCDelayRequirement(
bool DSCEnabled,
enum dml2_odm_mode ODMMode,
unsigned int DSCInputBitPerComponent,
double OutputBpp,
unsigned int HActive,
unsigned int HTotal,
unsigned int NumberOfDSCSlices,
enum dml2_output_format_class OutputFormat,
enum dml2_output_encoder_class Output,
double PixelClock,
double PixelClockBackEnd);
static void CalculateSurfaceSizeInMall(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int MALLAllocatedForDCN,
unsigned int BytesPerPixelY[],
unsigned int BytesPerPixelC[],
unsigned int Read256BytesBlockWidthY[],
unsigned int Read256BytesBlockWidthC[],
unsigned int Read256BytesBlockHeightY[],
unsigned int Read256BytesBlockHeightC[],
unsigned int ReadBlockWidthY[],
unsigned int ReadBlockWidthC[],
unsigned int ReadBlockHeightY[],
unsigned int ReadBlockHeightC[],
unsigned int SurfaceSizeInMALL[],
bool *ExceededMALLSize);
static void calculate_tdlut_setting(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_calculate_tdlut_setting_params *p);
static void CalculateTarb(
const struct dml2_display_cfg *display_cfg,
unsigned int PixelChunkSizeInKByte,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
unsigned int dpte_group_bytes[],
unsigned int tdlut_bytes_per_group[],
double HostVMInefficiencyFactor,
double HostVMInefficiencyFactorPrefetch,
unsigned int HostVMMinPageSize,
double ReturnBW,
unsigned int MetaChunkSize,
double *Tarb,
double *Tarb_prefetch);
static double CalculateTWait(long reserved_vblank_time_ns, double UrgentLatency, double Ttrip);
static void CalculateVUpdateAndDynamicMetadataParameters(
unsigned int MaxInterDCNTileRepeaters,
double Dppclk,
double Dispclk,
double DCFClkDeepSleep,
double PixelClock,
unsigned int HTotal,
unsigned int VBlank,
unsigned int DynamicMetadataTransmittedBytes,
unsigned int DynamicMetadataLinesBeforeActiveRequired,
unsigned int InterlaceEnable,
bool ProgressiveToInterlaceUnitInOPP,
double *TSetup,
double *Tdmbf,
double *Tdmec,
double *Tdmsks,
unsigned int *VUpdateOffsetPix,
unsigned int *VUpdateWidthPix,
unsigned int *VReadyOffsetPix);
static double get_urgent_bandwidth_required(
struct dml2_core_shared_get_urgent_bandwidth_required_locals *l,
const struct dml2_display_cfg *display_cfg,
enum dml2_core_internal_soc_state_type state_type,
enum dml2_core_internal_bw_type bw_type,
bool inc_flip_bw,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
double dcc_dram_bw_nom_overhead_factor_p0[],
double dcc_dram_bw_nom_overhead_factor_p1[],
double dcc_dram_bw_pref_overhead_factor_p0[],
double dcc_dram_bw_pref_overhead_factor_p1[],
double mall_prefetch_sdp_overhead_factor[],
double mall_prefetch_dram_overhead_factor[],
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
double PrefetchBandwidthLuma[],
double PrefetchBandwidthChroma[],
double cursor_bw[],
double dpte_row_bw[],
double meta_row_bw[],
double prefetch_cursor_bw[],
double prefetch_vmrow_bw[],
double flip_bw[],
double UrgentBurstFactorLuma[],
double UrgentBurstFactorChroma[],
double UrgentBurstFactorCursor[],
double UrgentBurstFactorLumaPre[],
double UrgentBurstFactorChromaPre[],
double UrgentBurstFactorCursorPre[]);
static void CalculateExtraLatency(
const struct dml2_display_cfg *display_cfg,
unsigned int ROBBufferSizeInKByte,
unsigned int RoundTripPingLatencyCycles,
unsigned int ReorderingBytes,
double DCFCLK,
double FabricClock,
unsigned int PixelChunkSizeInKByte,
double ReturnBW,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
unsigned int dpte_group_bytes[],
unsigned int tdlut_bytes_per_group[],
double HostVMInefficiencyFactor,
double HostVMInefficiencyFactorPrefetch,
unsigned int HostVMMinPageSize,
enum dml2_qos_param_type qos_type,
bool max_oustanding_when_urgent_expected,
unsigned int max_outstanding_requests,
unsigned int request_size_bytes_luma[],
unsigned int request_size_bytes_chroma[],
unsigned int MetaChunkSize,
unsigned int dchub_arb_to_ret_delay,
double Ttrip,
unsigned int hostvm_mode,
double *ExtraLatency,
double *ExtraLatency_sr,
double *ExtraLatencyPrefetch);
static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_CalculatePrefetchSchedule_params *p);
static void calculate_peak_bandwidth_required(
struct dml2_core_internal_scratch *s,
double urg_vactive_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double non_urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
const struct dml2_display_cfg *display_cfg,
unsigned int inc_flip_bw,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
double dcc_dram_bw_nom_overhead_factor_p0[],
double dcc_dram_bw_nom_overhead_factor_p1[],
double dcc_dram_bw_pref_overhead_factor_p0[],
double dcc_dram_bw_pref_overhead_factor_p1[],
double mall_prefetch_sdp_overhead_factor[],
double mall_prefetch_dram_overhead_factor[],
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
double PrefetchBandwidthLuma[],
double PrefetchBandwidthChroma[],
double cursor_bw[],
double dpte_row_bw[],
double meta_row_bw[],
double prefetch_cursor_bw[],
double prefetch_vmrow_bw[],
double flip_bw[],
double UrgentBurstFactorLuma[],
double UrgentBurstFactorChroma[],
double UrgentBurstFactorCursor[],
double UrgentBurstFactorLumaPre[],
double UrgentBurstFactorChromaPre[],
double UrgentBurstFactorCursorPre[]);
static void check_urgent_bandwidth_support(
double *frac_urg_bandwidth_nom,
double *frac_urg_bandwidth_mall,
bool *vactive_bandwidth_support_ok,
bool *bandwidth_support_ok,
unsigned int mall_allocated_for_dcn_mbytes,
double non_urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_vactive_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max]);
static double get_bandwidth_available_for_immediate_flip(
enum dml2_core_internal_soc_state_type eval_state,
double urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max]);
static void calculate_immediate_flip_bandwidth_support(
double *frac_urg_bandwidth_flip,
bool *flip_bandwidth_support_ok,
enum dml2_core_internal_soc_state_type eval_state,
double urg_bandwidth_required_flip[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double non_urg_bandwidth_required_flip[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max]);
static void CalculateFlipSchedule(
struct dml2_core_internal_scratch *s,
bool iflip_enable,
bool use_lb_flip_bw,
double HostVMInefficiencyFactor,
double Tvm_trips_flip,
double Tr0_trips_flip,
double Tvm_trips_flip_rounded,
double Tr0_trips_flip_rounded,
bool GPUVMEnable,
double vm_bytes,
double DPTEBytesPerRow,
double BandwidthAvailableForImmediateFlip,
unsigned int TotImmediateFlipBytes,
enum dml2_source_format_class SourcePixelFormat,
double LineTime,
double VRatio,
double VRatioChroma,
double Tno_bw_flip,
unsigned int dpte_row_height,
unsigned int dpte_row_height_chroma,
bool use_one_row_for_frame_flip,
unsigned int max_flip_time_us,
unsigned int per_pipe_flip_bytes,
unsigned int meta_row_bytes,
unsigned int meta_row_height,
unsigned int meta_row_height_chroma,
bool dcc_mrq_enable,
double *dst_y_per_vm_flip,
double *dst_y_per_row_flip,
double *final_flip_bw,
bool *ImmediateFlipSupportedForPipe);
static void CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_params *p);
static double uclk_khz_to_dram_bw_mbps(unsigned long uclk_khz, const struct dml2_dram_params *dram_config);
static double dram_bw_kbps_to_uclk_mhz(unsigned long long bw_kbps, const struct dml2_dram_params *dram_config);
static unsigned int get_qos_param_index(unsigned long uclk_freq_khz, const struct dml2_dcn4_uclk_dpm_dependent_qos_params *per_uclk_dpm_params);
static unsigned int get_active_min_uclk_dpm_index(unsigned long uclk_freq_khz, const struct dml2_soc_state_table *clk_table);
static unsigned int get_pipe_flip_bytes(
double hostvm_inefficiency_factor,
unsigned int vm_bytes,
unsigned int dpte_row_bytes,
unsigned int meta_row_bytes);
static void calculate_hostvm_inefficiency_factor(
double *HostVMInefficiencyFactor,
double *HostVMInefficiencyFactorPrefetch,
bool gpuvm_enable,
bool hostvm_enable,
unsigned int remote_iommu_outstanding_translations,
unsigned int max_outstanding_reqs,
double urg_bandwidth_avail_active_pixel_and_vm,
double urg_bandwidth_avail_active_vm_only);
static void CalculatePixelDeliveryTimes(
const struct dml2_display_cfg *display_cfg,
const struct core_display_cfg_support_info *cfg_support_info,
unsigned int NumberOfActiveSurfaces,
double VRatioPrefetchY[],
double VRatioPrefetchC[],
unsigned int swath_width_luma_ub[],
unsigned int swath_width_chroma_ub[],
double PSCL_THROUGHPUT[],
double PSCL_THROUGHPUT_CHROMA[],
double Dppclk[],
unsigned int BytePerPixelC[],
unsigned int req_per_swath_ub_l[],
unsigned int req_per_swath_ub_c[],
double DisplayPipeLineDeliveryTimeLuma[],
double DisplayPipeLineDeliveryTimeChroma[],
double DisplayPipeLineDeliveryTimeLumaPrefetch[],
double DisplayPipeLineDeliveryTimeChromaPrefetch[],
double DisplayPipeRequestDeliveryTimeLuma[],
double DisplayPipeRequestDeliveryTimeChroma[],
double DisplayPipeRequestDeliveryTimeLumaPrefetch[],
double DisplayPipeRequestDeliveryTimeChromaPrefetch[]);
static void CalculateMetaAndPTETimes(struct dml2_core_shared_CalculateMetaAndPTETimes_params *p);
static void CalculateVMGroupAndRequestTimes(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int BytePerPixelC[],
double dst_y_per_vm_vblank[],
double dst_y_per_vm_flip[],
unsigned int dpte_row_width_luma_ub[],
unsigned int dpte_row_width_chroma_ub[],
unsigned int vm_group_bytes[],
unsigned int dpde0_bytes_per_frame_ub_l[],
unsigned int dpde0_bytes_per_frame_ub_c[],
unsigned int tdlut_pte_bytes_per_frame[],
unsigned int meta_pte_bytes_per_frame_ub_l[],
unsigned int meta_pte_bytes_per_frame_ub_c[],
bool mrq_present,
double TimePerVMGroupVBlank[],
double TimePerVMGroupFlip[],
double TimePerVMRequestVBlank[],
double TimePerVMRequestFlip[]);
static void CalculateStutterEfficiency(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_CalculateStutterEfficiency_params *p);
static bool dml_is_dual_plane(enum dml2_source_format_class source_format);
static unsigned int dml_get_plane_idx(const struct dml2_core_internal_display_mode_lib *mode_lib, unsigned int pipe_idx);
static void rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_dchub_watermark_regs *wm_regs);
static unsigned int log_and_substract_if_non_zero(unsigned int a, unsigned int subtrahend);
static void rq_dlg_get_rq_reg(struct dml2_display_rq_regs *rq_regs,
const struct dml2_display_cfg *display_cfg,
const struct dml2_core_internal_display_mode_lib *mode_lib,
unsigned int pipe_idx);
static void rq_dlg_get_dlg_reg(struct dml2_core_internal_scratch *s,
struct dml2_display_dlg_regs *disp_dlg_regs,
struct dml2_display_ttu_regs *disp_ttu_regs,
const struct dml2_display_cfg *display_cfg,
const struct dml2_core_internal_display_mode_lib *mode_lib,
const unsigned int pipe_idx);
static void rq_dlg_get_arb_params(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_display_arb_regs *arb_param);
bool dml2_core_shared_mode_support(struct dml2_core_calcs_mode_support_ex *in_out_params)
{ … }
static void dml2_print_dml_mode_support_info(const struct dml2_core_internal_mode_support_info *support, bool fail_only)
{ … }
static void get_stream_output_bpp(double *out_bpp, const struct dml2_display_cfg *display_cfg)
{ … }
static unsigned int dml_round_to_multiple(unsigned int num, unsigned int multiple, bool up)
{ … }
static unsigned int dml_get_num_active_pipes(int unsigned num_planes, const struct core_display_cfg_support_info *cfg_support_info)
{ … }
static void dml_calc_pipe_plane_mapping(const struct core_display_cfg_support_info *cfg_support_info, unsigned int *pipe_plane)
{ … }
static bool dml_is_phantom_pipe(const struct dml2_plane_parameters *plane_cfg)
{ … }
static bool dml_get_is_phantom_pipe(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, unsigned int pipe_idx)
{ … }
static void CalculateMaxDETAndMinCompressedBufferSize(
unsigned int ConfigReturnBufferSizeInKByte,
unsigned int ConfigReturnBufferSegmentSizeInKByte,
unsigned int ROBBufferSizeInKByte,
unsigned int MaxNumDPP,
unsigned int nomDETInKByteOverrideEnable,
unsigned int nomDETInKByteOverrideValue,
bool is_mrq_present,
unsigned int *MaxTotalDETInKByte,
unsigned int *nomDETInKByte,
unsigned int *MinCompressedBufferSizeInKByte)
{ … }
static void PixelClockAdjustmentForProgressiveToInterlaceUnit(const struct dml2_display_cfg *display_cfg, bool ptoi_supported, double *PixelClockBackEnd)
{ … }
bool dml2_core_shared_is_420(enum dml2_source_format_class source_format)
{ … }
static unsigned int dml_get_tile_block_size_bytes(enum dml2_swizzle_mode sw_mode)
{ … }
const char *dml2_core_internal_bw_type_str(enum dml2_core_internal_bw_type bw_type)
{ … }
const char *dml2_core_internal_soc_state_type_str(enum dml2_core_internal_soc_state_type dml2_core_internal_soc_state_type)
{ … }
static bool dml_is_vertical_rotation(enum dml2_rotation_angle Scan)
{ … }
static int unsigned dml_get_gfx_version(enum dml2_swizzle_mode sw_mode)
{ … }
static void CalculateBytePerPixelAndBlockSizes(
enum dml2_source_format_class SourcePixelFormat,
enum dml2_swizzle_mode SurfaceTiling,
unsigned int pitch_y,
unsigned int pitch_c,
unsigned int *BytePerPixelY,
unsigned int *BytePerPixelC,
double *BytePerPixelDETY,
double *BytePerPixelDETC,
unsigned int *BlockHeight256BytesY,
unsigned int *BlockHeight256BytesC,
unsigned int *BlockWidth256BytesY,
unsigned int *BlockWidth256BytesC,
unsigned int *MacroTileHeightY,
unsigned int *MacroTileHeightC,
unsigned int *MacroTileWidthY,
unsigned int *MacroTileWidthC,
bool *surf_linear128_l,
bool *surf_linear128_c)
{ … }
static void CalculateSinglePipeDPPCLKAndSCLThroughput(
double HRatio,
double HRatioChroma,
double VRatio,
double VRatioChroma,
double MaxDCHUBToPSCLThroughput,
double MaxPSCLToLBThroughput,
double PixelClock,
enum dml2_source_format_class SourcePixelFormat,
unsigned int HTaps,
unsigned int HTapsChroma,
unsigned int VTaps,
unsigned int VTapsChroma,
double *PSCL_THROUGHPUT,
double *PSCL_THROUGHPUT_CHROMA,
double *DPPCLKUsingSingleDPP)
{ … }
static void CalculateSwathWidth(
const struct dml2_display_cfg *display_cfg,
bool ForceSingleDPP,
unsigned int NumberOfActiveSurfaces,
enum dml2_odm_mode ODMMode[],
unsigned int BytePerPixY[],
unsigned int BytePerPixC[],
unsigned int Read256BytesBlockHeightY[],
unsigned int Read256BytesBlockHeightC[],
unsigned int Read256BytesBlockWidthY[],
unsigned int Read256BytesBlockWidthC[],
bool surf_linear128_l[],
bool surf_linear128_c[],
unsigned int DPPPerSurface[],
unsigned int req_per_swath_ub_l[],
unsigned int req_per_swath_ub_c[],
unsigned int SwathWidthSingleDPPY[],
unsigned int SwathWidthSingleDPPC[],
unsigned int SwathWidthY[],
unsigned int SwathWidthC[],
unsigned int MaximumSwathHeightY[],
unsigned int MaximumSwathHeightC[],
unsigned int swath_width_luma_ub[],
unsigned int swath_width_chroma_ub[])
{ … }
static bool UnboundedRequest(bool unb_req_force_en, bool unb_req_force_val, unsigned int TotalNumberOfActiveDPP, bool NoChromaOrLinear)
{ … }
static void CalculateDETBufferSize(struct dml2_core_shared_calculate_det_buffer_size_params *p)
{ … }
static double CalculateRequiredDispclk(
enum dml2_odm_mode ODMMode,
double PixelClock)
{ … }
static double TruncToValidBPP(
struct dml2_core_shared_TruncToValidBPP_locals *l,
double LinkBitRate,
unsigned int Lanes,
unsigned int HTotal,
unsigned int HActive,
double PixelClock,
double DesiredBPP,
bool DSCEnable,
enum dml2_output_encoder_class Output,
enum dml2_output_format_class Format,
unsigned int DSCInputBitPerComponent,
unsigned int DSCSlices,
unsigned int AudioRate,
unsigned int AudioLayout,
enum dml2_odm_mode ODMModeNoDSC,
enum dml2_odm_mode ODMModeDSC,
unsigned int *RequiredSlots)
{ … }
static unsigned int dscceComputeDelay(
unsigned int bpc,
double BPP,
unsigned int sliceWidth,
unsigned int numSlices,
enum dml2_output_format_class pixelFormat,
enum dml2_output_encoder_class Output)
{ … }
static unsigned int dscComputeDelay(enum dml2_output_format_class pixelFormat, enum dml2_output_encoder_class Output)
{ … }
static unsigned int CalculateHostVMDynamicLevels(
bool GPUVMEnable,
bool HostVMEnable,
unsigned int HostVMMinPageSize,
unsigned int HostVMMaxNonCachedPageTableLevels)
{ … }
static unsigned int CalculateVMAndRowBytes(struct dml2_core_shared_calculate_vm_and_row_bytes_params *p)
{ … }
static unsigned int CalculatePrefetchSourceLines(
double VRatio,
unsigned int VTaps,
bool Interlace,
bool ProgressiveToInterlaceUnitInOPP,
unsigned int SwathHeight,
enum dml2_rotation_angle RotationAngle,
bool mirrored,
bool ViewportStationary,
unsigned int SwathWidth,
unsigned int ViewportHeight,
unsigned int ViewportXStart,
unsigned int ViewportYStart,
unsigned int *VInitPreFill,
unsigned int *MaxNumSwath)
{ … }
static void CalculateRowBandwidth(
bool GPUVMEnable,
bool use_one_row_for_frame,
enum dml2_source_format_class SourcePixelFormat,
double VRatio,
double VRatioChroma,
bool DCCEnable,
double LineTime,
unsigned int PixelPTEBytesPerRowLuma,
unsigned int PixelPTEBytesPerRowChroma,
unsigned int dpte_row_height_luma,
unsigned int dpte_row_height_chroma,
bool mrq_present,
unsigned int meta_row_bytes_per_row_ub_l,
unsigned int meta_row_bytes_per_row_ub_c,
unsigned int meta_row_height_luma,
unsigned int meta_row_height_chroma,
double *dpte_row_bw,
double *meta_row_bw)
{ … }
static void CalculateMALLUseForStaticScreen(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int MALLAllocatedForDCN,
unsigned int SurfaceSizeInMALL[],
bool one_row_per_frame_fits_in_buffer[],
bool is_using_mall_for_ss[])
{ … }
static void CalculateDCCConfiguration(
bool DCCEnabled,
bool DCCProgrammingAssumesScanDirectionUnknown,
enum dml2_source_format_class SourcePixelFormat,
unsigned int SurfaceWidthLuma,
unsigned int SurfaceWidthChroma,
unsigned int SurfaceHeightLuma,
unsigned int SurfaceHeightChroma,
unsigned int nomDETInKByte,
unsigned int RequestHeight256ByteLuma,
unsigned int RequestHeight256ByteChroma,
enum dml2_swizzle_mode TilingFormat,
unsigned int BytePerPixelY,
unsigned int BytePerPixelC,
double BytePerPixelDETY,
double BytePerPixelDETC,
enum dml2_rotation_angle RotationAngle,
enum dml2_core_internal_request_type *RequestLuma,
enum dml2_core_internal_request_type *RequestChroma,
unsigned int *MaxUncompressedBlockLuma,
unsigned int *MaxUncompressedBlockChroma,
unsigned int *MaxCompressedBlockLuma,
unsigned int *MaxCompressedBlockChroma,
unsigned int *IndependentBlockLuma,
unsigned int *IndependentBlockChroma)
{ … }
static void calculate_mcache_row_bytes(
struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_calculate_mcache_row_bytes_params *p)
{ … }
static void calculate_mcache_setting(
struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_calculate_mcache_setting_params *p)
{ … }
static void calculate_mall_bw_overhead_factor(
double mall_prefetch_sdp_overhead_factor[],
double mall_prefetch_dram_overhead_factor[],
const struct dml2_display_cfg *display_cfg,
unsigned int num_active_planes)
{ … }
static double dml_get_return_bandwidth_available(
const struct dml2_soc_bb *soc,
enum dml2_core_internal_soc_state_type state_type,
enum dml2_core_internal_bw_type bw_type,
bool is_avg_bw,
bool is_hvm_en,
bool is_hvm_only,
double dcflk_mhz,
double fclk_mhz,
double dram_bw_mbps)
{ … }
static void calculate_bandwidth_available(
double avg_bandwidth_available_min[dml2_core_internal_soc_state_max],
double avg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available_min[dml2_core_internal_soc_state_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available_vm_only[dml2_core_internal_soc_state_max],
double urg_bandwidth_available_pixel_and_vm[dml2_core_internal_soc_state_max],
const struct dml2_soc_bb *soc,
bool HostVMEnable,
double dcfclk_mhz,
double fclk_mhz,
double dram_bw_mbps)
{ … }
static void calculate_avg_bandwidth_required(
double avg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
const struct dml2_display_cfg *display_cfg,
unsigned int num_active_planes,
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
double cursor_bw[],
double dcc_dram_bw_nom_overhead_factor_p0[],
double dcc_dram_bw_nom_overhead_factor_p1[],
double mall_prefetch_dram_overhead_factor[],
double mall_prefetch_sdp_overhead_factor[])
{ … }
static void CalculateVMRowAndSwath(struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_CalculateVMRowAndSwath_params *p)
{ … }
static double CalculateUrgentLatency(
double UrgentLatencyPixelDataOnly,
double UrgentLatencyPixelMixedWithVMData,
double UrgentLatencyVMDataOnly,
bool DoUrgentLatencyAdjustment,
double UrgentLatencyAdjustmentFabricClockComponent,
double UrgentLatencyAdjustmentFabricClockReference,
double FabricClock,
double uclk_freq_mhz,
enum dml2_qos_param_type qos_type,
unsigned int urgent_ramp_uclk_cycles,
unsigned int df_qos_response_time_fclk_cycles,
unsigned int max_round_trip_to_furthest_cs_fclk_cycles,
unsigned int mall_overhead_fclk_cycles,
double umc_urgent_ramp_latency_margin,
double fabric_max_transport_latency_margin)
{ … }
static double CalculateTripToMemory(
double UrgLatency,
double FabricClock,
double uclk_freq_mhz,
enum dml2_qos_param_type qos_type,
unsigned int trip_to_memory_uclk_cycles,
unsigned int max_round_trip_to_furthest_cs_fclk_cycles,
unsigned int mall_overhead_fclk_cycles,
double umc_max_latency_margin,
double fabric_max_transport_latency_margin)
{ … }
static double CalculateMetaTripToMemory(
double UrgLatency,
double FabricClock,
double uclk_freq_mhz,
enum dml2_qos_param_type qos_type,
unsigned int meta_trip_to_memory_uclk_cycles,
unsigned int meta_trip_to_memory_fclk_cycles,
double umc_max_latency_margin,
double fabric_max_transport_latency_margin)
{ … }
static void calculate_cursor_req_attributes(
unsigned int cursor_width,
unsigned int cursor_bpp,
unsigned int *cursor_lines_per_chunk,
unsigned int *cursor_bytes_per_line,
unsigned int *cursor_bytes_per_chunk,
unsigned int *cursor_bytes)
{ … }
static void calculate_cursor_urgent_burst_factor(
unsigned int CursorBufferSize,
unsigned int CursorWidth,
unsigned int cursor_bytes_per_chunk,
unsigned int cursor_lines_per_chunk,
double LineTime,
double UrgentLatency,
double *UrgentBurstFactorCursor,
bool *NotEnoughUrgentLatencyHiding)
{ … }
static void CalculateUrgentBurstFactor(
const struct dml2_plane_parameters *plane_cfg,
unsigned int swath_width_luma_ub,
unsigned int swath_width_chroma_ub,
unsigned int SwathHeightY,
unsigned int SwathHeightC,
double LineTime,
double UrgentLatency,
double VRatio,
double VRatioC,
double BytePerPixelInDETY,
double BytePerPixelInDETC,
unsigned int DETBufferSizeY,
unsigned int DETBufferSizeC,
double *UrgentBurstFactorLuma,
double *UrgentBurstFactorChroma,
bool *NotEnoughUrgentLatencyHiding)
{ … }
static void CalculateDCFCLKDeepSleep(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int BytePerPixelY[],
unsigned int BytePerPixelC[],
unsigned int SwathWidthY[],
unsigned int SwathWidthC[],
unsigned int DPPPerSurface[],
double PSCL_THROUGHPUT[],
double PSCL_THROUGHPUT_CHROMA[],
double Dppclk[],
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
unsigned int ReturnBusWidth,
double *DCFClkDeepSleep)
{ … }
static double CalculateWriteBackDelay(
enum dml2_source_format_class WritebackPixelFormat,
double WritebackHRatio,
double WritebackVRatio,
unsigned int WritebackVTaps,
unsigned int WritebackDestinationWidth,
unsigned int WritebackDestinationHeight,
unsigned int WritebackSourceHeight,
unsigned int HTotal)
{ … }
static unsigned int CalculateMaxVStartup(
bool ptoi_supported,
unsigned int vblank_nom_default_us,
const struct dml2_timing_cfg *timing,
double write_back_delay_us)
{ … }
static void CalculateSwathAndDETConfiguration(struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_CalculateSwathAndDETConfiguration_params *p)
{ … }
static void CalculateODMMode(
unsigned int MaximumPixelsPerLinePerDSCUnit,
unsigned int HActive,
enum dml2_output_encoder_class Output,
enum dml2_odm_mode ODMUse,
double MaxDispclk,
bool DSCEnable,
unsigned int TotalNumberOfActiveDPP,
unsigned int MaxNumDPP,
double PixelClock,
bool *TotalAvailablePipesSupport,
unsigned int *NumberOfDPP,
enum dml2_odm_mode *ODMMode,
double *RequiredDISPCLKPerSurface)
{ … }
static void CalculateOutputLink(
struct dml2_core_internal_scratch *s,
double PHYCLK,
double PHYCLKD18,
double PHYCLKD32,
double Downspreading,
bool IsMainSurfaceUsingTheIndicatedTiming,
enum dml2_output_encoder_class Output,
enum dml2_output_format_class OutputFormat,
unsigned int HTotal,
unsigned int HActive,
double PixelClockBackEnd,
double ForcedOutputLinkBPP,
unsigned int DSCInputBitPerComponent,
unsigned int NumberOfDSCSlices,
double AudioSampleRate,
unsigned int AudioSampleLayout,
enum dml2_odm_mode ODMModeNoDSC,
enum dml2_odm_mode ODMModeDSC,
enum dml2_dsc_enable_option DSCEnable,
unsigned int OutputLinkDPLanes,
enum dml2_output_link_dp_rate OutputLinkDPRate,
bool *RequiresDSC,
bool *RequiresFEC,
double *OutBpp,
enum dml2_core_internal_output_type *OutputType,
enum dml2_core_internal_output_type_rate *OutputRate,
unsigned int *RequiredSlots)
{ … }
static double CalculateWriteBackDISPCLK(
enum dml2_source_format_class WritebackPixelFormat,
double PixelClock,
double WritebackHRatio,
double WritebackVRatio,
unsigned int WritebackHTaps,
unsigned int WritebackVTaps,
unsigned int WritebackSourceWidth,
unsigned int WritebackDestinationWidth,
unsigned int HTotal,
unsigned int WritebackLineBufferSize)
{ … }
static double RequiredDTBCLK(
bool DSCEnable,
double PixelClock,
enum dml2_output_format_class OutputFormat,
double OutputBpp,
unsigned int DSCSlices,
unsigned int HTotal,
unsigned int HActive,
unsigned int AudioRate,
unsigned int AudioLayout)
{ … }
static unsigned int DSCDelayRequirement(
bool DSCEnabled,
enum dml2_odm_mode ODMMode,
unsigned int DSCInputBitPerComponent,
double OutputBpp,
unsigned int HActive,
unsigned int HTotal,
unsigned int NumberOfDSCSlices,
enum dml2_output_format_class OutputFormat,
enum dml2_output_encoder_class Output,
double PixelClock,
double PixelClockBackEnd)
{ … }
static void CalculateSurfaceSizeInMall(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int MALLAllocatedForDCN,
unsigned int BytesPerPixelY[],
unsigned int BytesPerPixelC[],
unsigned int Read256BytesBlockWidthY[],
unsigned int Read256BytesBlockWidthC[],
unsigned int Read256BytesBlockHeightY[],
unsigned int Read256BytesBlockHeightC[],
unsigned int ReadBlockWidthY[],
unsigned int ReadBlockWidthC[],
unsigned int ReadBlockHeightY[],
unsigned int ReadBlockHeightC[],
unsigned int SurfaceSizeInMALL[],
bool *ExceededMALLSize)
{ … }
static void calculate_tdlut_setting(
struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_calculate_tdlut_setting_params *p)
{ … }
static void CalculateTarb(
const struct dml2_display_cfg *display_cfg,
unsigned int PixelChunkSizeInKByte,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
unsigned int dpte_group_bytes[],
unsigned int tdlut_bytes_per_group[],
double HostVMInefficiencyFactor,
double HostVMInefficiencyFactorPrefetch,
unsigned int HostVMMinPageSize,
double ReturnBW,
unsigned int MetaChunkSize,
double *Tarb,
double *Tarb_prefetch)
{ … }
static double CalculateTWait(
long reserved_vblank_time_ns,
double UrgentLatency,
double Ttrip)
{ … }
static void CalculateVUpdateAndDynamicMetadataParameters(
unsigned int MaxInterDCNTileRepeaters,
double Dppclk,
double Dispclk,
double DCFClkDeepSleep,
double PixelClock,
unsigned int HTotal,
unsigned int VBlank,
unsigned int DynamicMetadataTransmittedBytes,
unsigned int DynamicMetadataLinesBeforeActiveRequired,
unsigned int InterlaceEnable,
bool ProgressiveToInterlaceUnitInOPP,
double *TSetup,
double *Tdmbf,
double *Tdmec,
double *Tdmsks,
unsigned int *VUpdateOffsetPix,
unsigned int *VUpdateWidthPix,
unsigned int *VReadyOffsetPix)
{ … }
static double get_urgent_bandwidth_required(
struct dml2_core_shared_get_urgent_bandwidth_required_locals *l,
const struct dml2_display_cfg *display_cfg,
enum dml2_core_internal_soc_state_type state_type,
enum dml2_core_internal_bw_type bw_type,
bool inc_flip_bw,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
double dcc_dram_bw_nom_overhead_factor_p0[],
double dcc_dram_bw_nom_overhead_factor_p1[],
double dcc_dram_bw_pref_overhead_factor_p0[],
double dcc_dram_bw_pref_overhead_factor_p1[],
double mall_prefetch_sdp_overhead_factor[],
double mall_prefetch_dram_overhead_factor[],
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
double PrefetchBandwidthLuma[],
double PrefetchBandwidthChroma[],
double cursor_bw[],
double dpte_row_bw[],
double meta_row_bw[],
double prefetch_cursor_bw[],
double prefetch_vmrow_bw[],
double flip_bw[],
double UrgentBurstFactorLuma[],
double UrgentBurstFactorChroma[],
double UrgentBurstFactorCursor[],
double UrgentBurstFactorLumaPre[],
double UrgentBurstFactorChromaPre[],
double UrgentBurstFactorCursorPre[])
{ … }
static void CalculateExtraLatency(
const struct dml2_display_cfg *display_cfg,
unsigned int ROBBufferSizeInKByte,
unsigned int RoundTripPingLatencyCycles,
unsigned int ReorderingBytes,
double DCFCLK,
double FabricClock,
unsigned int PixelChunkSizeInKByte,
double ReturnBW,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
unsigned int dpte_group_bytes[],
unsigned int tdlut_bytes_per_group[],
double HostVMInefficiencyFactor,
double HostVMInefficiencyFactorPrefetch,
unsigned int HostVMMinPageSize,
enum dml2_qos_param_type qos_type,
bool max_oustanding_when_urgent_expected,
unsigned int max_outstanding_requests,
unsigned int request_size_bytes_luma[],
unsigned int request_size_bytes_chroma[],
unsigned int MetaChunkSize,
unsigned int dchub_arb_to_ret_delay,
double Ttrip,
unsigned int hostvm_mode,
double *ExtraLatency,
double *ExtraLatency_sr,
double *ExtraLatencyPrefetch)
{ … }
static bool CalculatePrefetchSchedule(struct dml2_core_internal_scratch *scratch, struct dml2_core_calcs_CalculatePrefetchSchedule_params *p)
{ … }
static void calculate_peak_bandwidth_required(
struct dml2_core_internal_scratch *s,
double urg_vactive_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double non_urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
const struct dml2_display_cfg *display_cfg,
unsigned int inc_flip_bw,
unsigned int NumberOfActiveSurfaces,
unsigned int NumberOfDPP[],
double dcc_dram_bw_nom_overhead_factor_p0[],
double dcc_dram_bw_nom_overhead_factor_p1[],
double dcc_dram_bw_pref_overhead_factor_p0[],
double dcc_dram_bw_pref_overhead_factor_p1[],
double mall_prefetch_sdp_overhead_factor[],
double mall_prefetch_dram_overhead_factor[],
double ReadBandwidthLuma[],
double ReadBandwidthChroma[],
double PrefetchBandwidthLuma[],
double PrefetchBandwidthChroma[],
double cursor_bw[],
double dpte_row_bw[],
double meta_row_bw[],
double prefetch_cursor_bw[],
double prefetch_vmrow_bw[],
double flip_bw[],
double UrgentBurstFactorLuma[],
double UrgentBurstFactorChroma[],
double UrgentBurstFactorCursor[],
double UrgentBurstFactorLumaPre[],
double UrgentBurstFactorChromaPre[],
double UrgentBurstFactorCursorPre[])
{ … }
static void check_urgent_bandwidth_support(
double *frac_urg_bandwidth_nom,
double *frac_urg_bandwidth_mall,
bool *vactive_bandwidth_support_ok,
bool *bandwidth_support_ok,
unsigned int mall_allocated_for_dcn_mbytes,
double non_urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_vactive_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max])
{ … }
static double get_bandwidth_available_for_immediate_flip(enum dml2_core_internal_soc_state_type eval_state,
double urg_bandwidth_required[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max])
{ … }
static void calculate_immediate_flip_bandwidth_support(
double *frac_urg_bandwidth_flip,
bool *flip_bandwidth_support_ok,
enum dml2_core_internal_soc_state_type eval_state,
double urg_bandwidth_required_flip[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double non_urg_bandwidth_required_flip[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max],
double urg_bandwidth_available[dml2_core_internal_soc_state_max][dml2_core_internal_bw_max])
{ … }
static void CalculateFlipSchedule(
struct dml2_core_internal_scratch *s,
bool iflip_enable,
bool use_lb_flip_bw,
double HostVMInefficiencyFactor,
double Tvm_trips_flip,
double Tr0_trips_flip,
double Tvm_trips_flip_rounded,
double Tr0_trips_flip_rounded,
bool GPUVMEnable,
double vm_bytes,
double DPTEBytesPerRow,
double BandwidthAvailableForImmediateFlip,
unsigned int TotImmediateFlipBytes,
enum dml2_source_format_class SourcePixelFormat,
double LineTime,
double VRatio,
double VRatioChroma,
double Tno_bw_flip,
unsigned int dpte_row_height,
unsigned int dpte_row_height_chroma,
bool use_one_row_for_frame_flip,
unsigned int max_flip_time_us,
unsigned int per_pipe_flip_bytes,
unsigned int meta_row_bytes,
unsigned int meta_row_height,
unsigned int meta_row_height_chroma,
bool dcc_mrq_enable,
double *dst_y_per_vm_flip,
double *dst_y_per_row_flip,
double *final_flip_bw,
bool *ImmediateFlipSupportedForPipe)
{ … }
static void CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport_params *p)
{ … }
static double uclk_khz_to_dram_bw_mbps(unsigned long uclk_khz, const struct dml2_dram_params *dram_config)
{ … }
static double dram_bw_kbps_to_uclk_mhz(unsigned long long bw_kbps, const struct dml2_dram_params *dram_config)
{ … }
static unsigned int get_qos_param_index(unsigned long uclk_freq_khz, const struct dml2_dcn4_uclk_dpm_dependent_qos_params *per_uclk_dpm_params)
{ … }
static unsigned int get_active_min_uclk_dpm_index(unsigned long uclk_freq_khz, const struct dml2_soc_state_table *clk_table)
{ … }
static unsigned int get_pipe_flip_bytes(
double hostvm_inefficiency_factor,
unsigned int vm_bytes,
unsigned int dpte_row_bytes,
unsigned int meta_row_bytes)
{ … }
static void calculate_hostvm_inefficiency_factor(
double *HostVMInefficiencyFactor,
double *HostVMInefficiencyFactorPrefetch,
bool gpuvm_enable,
bool hostvm_enable,
unsigned int remote_iommu_outstanding_translations,
unsigned int max_outstanding_reqs,
double urg_bandwidth_avail_active_pixel_and_vm,
double urg_bandwidth_avail_active_vm_only)
{ … }
static void CalculatePixelDeliveryTimes(
const struct dml2_display_cfg *display_cfg,
const struct core_display_cfg_support_info *cfg_support_info,
unsigned int NumberOfActiveSurfaces,
double VRatioPrefetchY[],
double VRatioPrefetchC[],
unsigned int swath_width_luma_ub[],
unsigned int swath_width_chroma_ub[],
double PSCL_THROUGHPUT[],
double PSCL_THROUGHPUT_CHROMA[],
double Dppclk[],
unsigned int BytePerPixelC[],
unsigned int req_per_swath_ub_l[],
unsigned int req_per_swath_ub_c[],
double DisplayPipeLineDeliveryTimeLuma[],
double DisplayPipeLineDeliveryTimeChroma[],
double DisplayPipeLineDeliveryTimeLumaPrefetch[],
double DisplayPipeLineDeliveryTimeChromaPrefetch[],
double DisplayPipeRequestDeliveryTimeLuma[],
double DisplayPipeRequestDeliveryTimeChroma[],
double DisplayPipeRequestDeliveryTimeLumaPrefetch[],
double DisplayPipeRequestDeliveryTimeChromaPrefetch[])
{ … }
static void CalculateMetaAndPTETimes(struct dml2_core_shared_CalculateMetaAndPTETimes_params *p)
{ … }
static void CalculateVMGroupAndRequestTimes(
const struct dml2_display_cfg *display_cfg,
unsigned int NumberOfActiveSurfaces,
unsigned int BytePerPixelC[],
double dst_y_per_vm_vblank[],
double dst_y_per_vm_flip[],
unsigned int dpte_row_width_luma_ub[],
unsigned int dpte_row_width_chroma_ub[],
unsigned int vm_group_bytes[],
unsigned int dpde0_bytes_per_frame_ub_l[],
unsigned int dpde0_bytes_per_frame_ub_c[],
unsigned int tdlut_pte_bytes_per_frame[],
unsigned int meta_pte_bytes_per_frame_ub_l[],
unsigned int meta_pte_bytes_per_frame_ub_c[],
bool mrq_present,
double TimePerVMGroupVBlank[],
double TimePerVMGroupFlip[],
double TimePerVMRequestVBlank[],
double TimePerVMRequestFlip[])
{ … }
static void CalculateStutterEfficiency(struct dml2_core_internal_scratch *scratch,
struct dml2_core_calcs_CalculateStutterEfficiency_params *p)
{ … }
bool dml2_core_shared_mode_programming(struct dml2_core_calcs_mode_programming_ex *in_out_params)
{ … }
static bool dml_is_dual_plane(enum dml2_source_format_class source_format)
{ … }
static unsigned int dml_get_plane_idx(const struct dml2_core_internal_display_mode_lib *mode_lib, unsigned int pipe_idx)
{ … }
static void rq_dlg_get_wm_regs(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_dchub_watermark_regs *wm_regs)
{ … }
static unsigned int log_and_substract_if_non_zero(unsigned int a, unsigned int subtrahend)
{ … }
void dml2_core_shared_cursor_dlg_reg(struct dml2_cursor_dlg_regs *cursor_dlg_regs, const struct dml2_get_cursor_dlg_reg *p)
{ … }
static void rq_dlg_get_rq_reg(struct dml2_display_rq_regs *rq_regs,
const struct dml2_display_cfg *display_cfg,
const struct dml2_core_internal_display_mode_lib *mode_lib,
unsigned int pipe_idx)
{ … }
static void rq_dlg_get_dlg_reg(
struct dml2_core_internal_scratch *s,
struct dml2_display_dlg_regs *disp_dlg_regs,
struct dml2_display_ttu_regs *disp_ttu_regs,
const struct dml2_display_cfg *display_cfg,
const struct dml2_core_internal_display_mode_lib *mode_lib,
const unsigned int pipe_idx)
{ … }
static void rq_dlg_get_arb_params(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_display_arb_regs *arb_param)
{ … }
void dml2_core_shared_get_watermarks(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_dchub_watermark_regs *out)
{ … }
void dml2_core_shared_get_arb_params(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_display_arb_regs *out)
{ … }
void dml2_core_shared_get_pipe_regs(const struct dml2_display_cfg *display_cfg,
struct dml2_core_internal_display_mode_lib *mode_lib,
struct dml2_dchub_per_pipe_register_set *out, int pipe_index)
{ … }
void dml2_core_shared_get_stream_programming(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_per_stream_programming *out, int pipe_index)
{ … }
void dml2_core_shared_get_mcache_allocation(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_mcache_surface_allocation *out, int plane_idx)
{ … }
void dml2_core_shared_get_mall_allocation(struct dml2_core_internal_display_mode_lib *mode_lib, unsigned int *out, int pipe_index)
{ … }
void dml2_core_shared_get_plane_support_info(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct core_plane_support_info *out, int plane_idx)
{ … }
void dml2_core_shared_get_stream_support_info(const struct dml2_display_cfg *display_cfg, const struct dml2_core_internal_display_mode_lib *mode_lib, struct core_stream_support_info *out, int plane_index)
{ … }
void dml2_core_shared_get_informative(const struct dml2_core_internal_display_mode_lib *mode_lib, struct dml2_display_cfg_programming *out)
{ … }