lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202106232316.HhGOOZQV-lkp@intel.com>
Date:   Wed, 23 Jun 2021 23:49:25 +0800
From:   kernel test robot <lkp@...el.com>
To:     Alex Deucher <alexander.deucher@....com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org, Luben Tuikov <luben.tuikov@....com>
Subject: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3641:6:
 warning: stack frame size (2848) exceeds limit (2048) in function
 'dml30_ModeSupportAndSystemConfigurationFull'

Hi Alex,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0c18f29aae7ce3dadd26d8ee3505d07cc982df75
commit: 20f2ffe504728612d7b0c34e4f8280e34251e704 drm/amdgpu: fold CONFIG_DRM_AMD_DC_DCN3* into CONFIG_DRM_AMD_DC_DCN (v3)
date:   8 months ago
config: powerpc64-randconfig-r001-20210622 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project b259740801d3515810ecc15bf0c24b0d476a1608)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=20f2ffe504728612d7b0c34e4f8280e34251e704
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 20f2ffe504728612d7b0c34e4f8280e34251e704
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:27:
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc.h:29:
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dc_types.h:32:
   In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/os_types.h:30:
   In file included from include/linux/kgdb.h:18:
   In file included from include/linux/atomic.h:7:
   In file included from arch/powerpc/include/asm/atomic.h:11:
   In file included from arch/powerpc/include/asm/cmpxchg.h:8:
   In file included from include/linux/bug.h:5:
   In file included from arch/powerpc/include/asm/bug.h:109:
   In file included from include/asm-generic/bug.h:20:
   In file included from include/linux/kernel.h:12:
   In file included from include/linux/bitops.h:29:
   In file included from arch/powerpc/include/asm/bitops.h:62:
   arch/powerpc/include/asm/barrier.h:49:9: warning: '__lwsync' macro redefined [-Wmacro-redefined]
   #define __lwsync()      __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory")
           ^
   <built-in>:309:9: note: previous definition is here
   #define __lwsync __builtin_ppc_lwsync
           ^
   drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3052:10: warning: variable 'MaxUsedBW' set but not used [-Wunused-but-set-variable]
                   double MaxUsedBW = 0;
                          ^
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:1917:13: warning: stack frame size (3200) exceeds limit (2048) in function 'DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation' [-Wframe-larger-than]
   static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(
               ^
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3641:6: warning: stack frame size (2848) exceeds limit (2048) in function 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than]
   void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
        ^
   4 warnings generated.


vim +/dml30_ModeSupportAndSystemConfigurationFull +3641 drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c

6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3640  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21 @3641  void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3642  {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3643  	struct vba_vars_st *v = &mode_lib->vba;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3644  	int MinPrefetchMode = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3645  	int MaxPrefetchMode = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3646  	int i;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3647  	unsigned int j, k, m;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3648  	bool   EnoughWritebackUnits = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3649  	bool   WritebackModeSupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3650  	bool   ViewportExceedsSurface = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3651  	double MaxTotalVActiveRDBandwidth = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3652  	long ReorderingBytes = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3653  	bool NotUrgentLatencyHiding[DC__NUM_DPP__MAX] = { 0 };
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3654  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3655  	/*MODE SUPPORT, VOLTAGE STATE AND SOC CONFIGURATION*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3656  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3657  	/*Scale Ratio, taps Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3658  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3659  	v->ScaleRatioAndTapsSupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3660  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3661  		if (v->ScalerEnabled[k] == false
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3662  				&& ((v->SourcePixelFormat[k] != dm_444_64
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3663  						&& v->SourcePixelFormat[k] != dm_444_32
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3664  						&& v->SourcePixelFormat[k] != dm_444_16
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3665  						&& v->SourcePixelFormat[k] != dm_mono_16
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3666  						&& v->SourcePixelFormat[k] != dm_mono_8
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3667  						&& v->SourcePixelFormat[k] != dm_rgbe
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3668  						&& v->SourcePixelFormat[k] != dm_rgbe_alpha)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3669  						|| v->HRatio[k] != 1.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3670  						|| v->htaps[k] != 1.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3671  						|| v->VRatio[k] != 1.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3672  						|| v->vtaps[k] != 1.0)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3673  			v->ScaleRatioAndTapsSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3674  		} else if (v->vtaps[k] < 1.0 || v->vtaps[k] > 8.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3675  				|| v->htaps[k] < 1.0 || v->htaps[k] > 8.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3676  				|| (v->htaps[k] > 1.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3677  						&& (v->htaps[k] % 2) == 1)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3678  				|| v->HRatio[k] > v->MaxHSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3679  				|| v->VRatio[k] > v->MaxVSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3680  				|| v->HRatio[k] > v->htaps[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3681  				|| v->VRatio[k] > v->vtaps[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3682  				|| (v->SourcePixelFormat[k] != dm_444_64
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3683  						&& v->SourcePixelFormat[k] != dm_444_32
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3684  						&& v->SourcePixelFormat[k] != dm_444_16
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3685  						&& v->SourcePixelFormat[k] != dm_mono_16
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3686  						&& v->SourcePixelFormat[k] != dm_mono_8
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3687  						&& v->SourcePixelFormat[k] != dm_rgbe
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3688  						&& (v->VTAPsChroma[k] < 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3689  							|| v->VTAPsChroma[k] > 8
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3690  							|| v->HTAPsChroma[k] < 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3691  							|| v->HTAPsChroma[k] > 8
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3692  							|| (v->HTAPsChroma[k] > 1 && v->HTAPsChroma[k] % 2 == 1)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3693  							|| v->HRatioChroma[k] > v->MaxHSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3694  							|| v->VRatioChroma[k] > v->MaxVSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3695  							|| v->HRatioChroma[k] > v->HTAPsChroma[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3696  							|| v->VRatioChroma[k] > v->VTAPsChroma[k]))) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3697  			v->ScaleRatioAndTapsSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3698  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3699  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3700  	/*Source Format, Pixel Format and Scan Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3701  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3702  	v->SourceFormatPixelAndScanSupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3703  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3704  		if ((v->SurfaceTiling[k] == dm_sw_linear && (!(v->SourceScan[k] != dm_vert) || v->DCCEnable[k] == true))
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3705  				|| ((v->SurfaceTiling[k] == dm_sw_64kb_d || v->SurfaceTiling[k] == dm_sw_64kb_d_t || v->SurfaceTiling[k] == dm_sw_64kb_d_x)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3706  						&& !(v->SourcePixelFormat[k] == dm_444_64))) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3707  			v->SourceFormatPixelAndScanSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3708  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3709  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3710  	/*Bandwidth Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3711  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3712  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3713  		CalculateBytePerPixelAnd256BBlockSizes(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3714  				v->SourcePixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3715  				v->SurfaceTiling[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3716  				&v->BytePerPixelY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3717  				&v->BytePerPixelC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3718  				&v->BytePerPixelInDETY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3719  				&v->BytePerPixelInDETC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3720  				&v->Read256BlockHeightY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3721  				&v->Read256BlockHeightC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3722  				&v->Read256BlockWidthY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3723  				&v->Read256BlockWidthC[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3724  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3725  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3726  		if (v->SourceScan[k] != dm_vert) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3727  			v->SwathWidthYSingleDPP[k] = v->ViewportWidth[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3728  			v->SwathWidthCSingleDPP[k] = v->ViewportWidthChroma[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3729  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3730  			v->SwathWidthYSingleDPP[k] = v->ViewportHeight[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3731  			v->SwathWidthCSingleDPP[k] = v->ViewportHeightChroma[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3732  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3733  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3734  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3735  		v->ReadBandwidthLuma[k] = v->SwathWidthYSingleDPP[k] * dml_ceil(v->BytePerPixelInDETY[k], 1.0) / (v->HTotal[k] / v->PixelClock[k]) * v->VRatio[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3736  		v->ReadBandwidthChroma[k] = v->SwathWidthYSingleDPP[k] / 2 * dml_ceil(v->BytePerPixelInDETC[k], 2.0) / (v->HTotal[k] / v->PixelClock[k]) * v->VRatio[k] / 2.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3737  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3738  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3739  		if (v->WritebackEnable[k] == true
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3740  				&& v->WritebackPixelFormat[k] == dm_444_64) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3741  			v->WriteBandwidth[k] = v->WritebackDestinationWidth[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3742  					* v->WritebackDestinationHeight[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3743  					/ (v->WritebackSourceHeight[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3744  							* v->HTotal[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3745  							/ v->PixelClock[k]) * 8.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3746  		} else if (v->WritebackEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3747  			v->WriteBandwidth[k] = v->WritebackDestinationWidth[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3748  					* v->WritebackDestinationHeight[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3749  					/ (v->WritebackSourceHeight[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3750  							* v->HTotal[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3751  							/ v->PixelClock[k]) * 4.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3752  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3753  			v->WriteBandwidth[k] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3754  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3755  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3756  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3757  	/*Writeback Latency support check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3758  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3759  	v->WritebackLatencySupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3760  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3761  		if (v->WritebackEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3762  			if (v->WritebackConfiguration == dm_whole_buffer_for_single_stream_no_interleave ||
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3763  			    v->WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3764  				if (v->WriteBandwidth[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3765  						> 2.0 * v->WritebackInterfaceBufferSize * 1024
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3766  								/ v->WritebackLatency) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3767  					v->WritebackLatencySupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3768  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3769  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3770  				if (v->WriteBandwidth[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3771  						> v->WritebackInterfaceBufferSize * 1024
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3772  								/ v->WritebackLatency) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3773  					v->WritebackLatencySupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3774  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3775  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3776  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3777  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3778  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3779  	/*Writeback Mode Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3780  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3781  	v->TotalNumberOfActiveWriteback = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3782  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3783  		if (v->WritebackEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3784  			v->TotalNumberOfActiveWriteback =
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3785  					v->TotalNumberOfActiveWriteback + 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3786  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3787  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3788  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3789  	if (v->TotalNumberOfActiveWriteback > v->MaxNumWriteback) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3790  		EnoughWritebackUnits = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3791  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3792  	if (!v->WritebackSupportInterleaveAndUsingWholeBufferForASingleStream
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3793  			&& (v->WritebackConfiguration == dm_whole_buffer_for_single_stream_no_interleave
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3794  					|| v->WritebackConfiguration == dm_whole_buffer_for_single_stream_interleave)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3795  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3796  		WritebackModeSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3797  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3798  	if (v->WritebackConfiguration == dm_whole_buffer_for_single_stream_no_interleave && v->TotalNumberOfActiveWriteback > 1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3799  		WritebackModeSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3800  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3801  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3802  	/*Writeback Scale Ratio and Taps Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3803  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3804  	v->WritebackScaleRatioAndTapsSupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3805  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3806  		if (v->WritebackEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3807  			if (v->WritebackHRatio[k] > v->WritebackMaxHSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3808  					|| v->WritebackVRatio[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3809  							> v->WritebackMaxVSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3810  					|| v->WritebackHRatio[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3811  							< v->WritebackMinHSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3812  					|| v->WritebackVRatio[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3813  							< v->WritebackMinVSCLRatio
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3814  					|| v->WritebackHTaps[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3815  							> v->WritebackMaxHSCLTaps
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3816  					|| v->WritebackVTaps[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3817  							> v->WritebackMaxVSCLTaps
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3818  					|| v->WritebackHRatio[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3819  							> v->WritebackHTaps[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3820  					|| v->WritebackVRatio[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3821  							> v->WritebackVTaps[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3822  					|| (v->WritebackHTaps[k] > 2.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3823  							&& ((v->WritebackHTaps[k] % 2)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3824  									== 1))) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3825  				v->WritebackScaleRatioAndTapsSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3826  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3827  			if (2.0 * v->WritebackDestinationWidth[k] * (v->WritebackVTaps[k] - 1) * 57 > v->WritebackLineBufferSize) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3828  				v->WritebackScaleRatioAndTapsSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3829  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3830  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3831  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3832  	/*Maximum DISPCLK/DPPCLK Support check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3833  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3834  	v->WritebackRequiredDISPCLK = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3835  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3836  		if (v->WritebackEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3837  			v->WritebackRequiredDISPCLK = dml_max(v->WritebackRequiredDISPCLK,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3838  					dml30_CalculateWriteBackDISPCLK(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3839  							v->WritebackPixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3840  							v->PixelClock[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3841  							v->WritebackHRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3842  							v->WritebackVRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3843  							v->WritebackHTaps[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3844  							v->WritebackVTaps[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3845  							v->WritebackSourceWidth[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3846  							v->WritebackDestinationWidth[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3847  							v->HTotal[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3848  							v->WritebackLineBufferSize));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3849  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3850  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3851  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3852  		if (v->HRatio[k] > 1.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3853  			v->PSCL_FACTOR[k] = dml_min(v->MaxDCHUBToPSCLThroughput, v->MaxPSCLToLBThroughput * v->HRatio[k] / dml_ceil(v->htaps[k] / 6.0, 1.0));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3854  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3855  			v->PSCL_FACTOR[k] = dml_min(v->MaxDCHUBToPSCLThroughput, v->MaxPSCLToLBThroughput);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3856  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3857  		if (v->BytePerPixelC[k] == 0.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3858  			v->PSCL_FACTOR_CHROMA[k] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3859  			v->MinDPPCLKUsingSingleDPP[k] = v->PixelClock[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3860  					* dml_max3(v->vtaps[k] / 6.0 * dml_min(1.0, v->HRatio[k]), v->HRatio[k] * v->VRatio[k] / v->PSCL_FACTOR[k], 1.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3861  			if ((v->htaps[k] > 6.0 || v->vtaps[k] > 6.0) && v->MinDPPCLKUsingSingleDPP[k] < 2.0 * v->PixelClock[k]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3862  				v->MinDPPCLKUsingSingleDPP[k] = 2.0 * v->PixelClock[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3863  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3864  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3865  			if (v->HRatioChroma[k] > 1.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3866  				v->PSCL_FACTOR_CHROMA[k] = dml_min(v->MaxDCHUBToPSCLThroughput,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3867  						v->MaxPSCLToLBThroughput * v->HRatioChroma[k] / dml_ceil(v->HTAPsChroma[k] / 6.0, 1.0));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3868  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3869  				v->PSCL_FACTOR_CHROMA[k] = dml_min(v->MaxDCHUBToPSCLThroughput, v->MaxPSCLToLBThroughput);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3870  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3871  			v->MinDPPCLKUsingSingleDPP[k] = v->PixelClock[k] * dml_max5(v->vtaps[k] / 6.0 * dml_min(1.0, v->HRatio[k]),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3872  							v->HRatio[k] * v->VRatio[k] / v->PSCL_FACTOR[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3873  							v->VTAPsChroma[k] / 6.0 * dml_min(1.0, v->HRatioChroma[k]),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3874  							v->HRatioChroma[k] * v->VRatioChroma[k] / v->PSCL_FACTOR_CHROMA[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3875  							1.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3876  			if ((v->htaps[k] > 6.0 || v->vtaps[k] > 6.0 || v->HTAPsChroma[k] > 6.0 || v->VTAPsChroma[k] > 6.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3877  					&& v->MinDPPCLKUsingSingleDPP[k] < 2.0 * v->PixelClock[k]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3878  				v->MinDPPCLKUsingSingleDPP[k] = 2.0 * v->PixelClock[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3879  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3880  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3881  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3882  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3883  		int MaximumSwathWidthSupportLuma = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3884  		int MaximumSwathWidthSupportChroma = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3885  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3886  		if (v->SurfaceTiling[k] == dm_sw_linear) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3887  			MaximumSwathWidthSupportLuma = 8192.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3888  		} else if (v->SourceScan[k] == dm_vert && v->BytePerPixelC[k] > 0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3889  			MaximumSwathWidthSupportLuma = 2880.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3890  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3891  			MaximumSwathWidthSupportLuma = 5760.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3892  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3893  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3894  		if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_420_12) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3895  			MaximumSwathWidthSupportChroma = MaximumSwathWidthSupportLuma / 2.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3896  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3897  			MaximumSwathWidthSupportChroma = MaximumSwathWidthSupportLuma;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3898  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3899  		v->MaximumSwathWidthInLineBufferLuma = v->LineBufferSize * dml_max(v->HRatio[k], 1.0) / v->LBBitPerPixel[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3900  				/ (v->vtaps[k] + dml_max(dml_ceil(v->VRatio[k], 1.0) - 2, 0.0));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3901  		if (v->BytePerPixelC[k] == 0.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3902  			v->MaximumSwathWidthInLineBufferChroma = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3903  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3904  			v->MaximumSwathWidthInLineBufferChroma = v->LineBufferSize * dml_max(v->HRatioChroma[k], 1.0) / v->LBBitPerPixel[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3905  					/ (v->VTAPsChroma[k] + dml_max(dml_ceil(v->VRatioChroma[k], 1.0) - 2, 0.0));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3906  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3907  		v->MaximumSwathWidthLuma[k] = dml_min(MaximumSwathWidthSupportLuma, v->MaximumSwathWidthInLineBufferLuma);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3908  		v->MaximumSwathWidthChroma[k] = dml_min(MaximumSwathWidthSupportChroma, v->MaximumSwathWidthInLineBufferChroma);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3909  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3910  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3911  	CalculateSwathAndDETConfiguration(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3912  			true,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3913  			v->NumberOfActivePlanes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3914  			v->DETBufferSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3915  			v->MaximumSwathWidthLuma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3916  			v->MaximumSwathWidthChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3917  			v->SourceScan,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3918  			v->SourcePixelFormat,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3919  			v->SurfaceTiling,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3920  			v->ViewportWidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3921  			v->ViewportHeight,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3922  			v->SurfaceWidthY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3923  			v->SurfaceWidthC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3924  			v->SurfaceHeightY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3925  			v->SurfaceHeightC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3926  			v->Read256BlockHeightY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3927  			v->Read256BlockHeightC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3928  			v->Read256BlockWidthY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3929  			v->Read256BlockWidthC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3930  			v->odm_combine_dummy,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3931  			v->BlendingAndTiming,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3932  			v->BytePerPixelY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3933  			v->BytePerPixelC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3934  			v->BytePerPixelInDETY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3935  			v->BytePerPixelInDETC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3936  			v->HActive,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3937  			v->HRatio,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3938  			v->HRatioChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3939  			v->DPPPerPlane,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3940  			v->swath_width_luma_ub,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3941  			v->swath_width_chroma_ub,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3942  			v->SwathWidthY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3943  			v->SwathWidthC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3944  			v->SwathHeightY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3945  			v->SwathHeightC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3946  			v->DETBufferSizeY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3947  			v->DETBufferSizeC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3948  			v->SingleDPPViewportSizeSupportPerPlane,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3949  			&v->ViewportSizeSupport[0][0]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3950  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3951  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3952  		for (j = 0; j < 2; j++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3953  			v->MaxDispclkRoundedDownToDFSGranularity = RoundToDFSGranularityDown(v->MaxDispclk[i], v->DISPCLKDPPCLKVCOSpeed);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3954  			v->MaxDppclkRoundedDownToDFSGranularity = RoundToDFSGranularityDown(v->MaxDppclk[i], v->DISPCLKDPPCLKVCOSpeed);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3955  			v->RequiredDISPCLK[i][j] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3956  			v->DISPCLK_DPPCLK_Support[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3957  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3958  				v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3959  						* (1.0 + v->DISPCLKRampingMargin / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3960  				if ((v->PlaneRequiredDISPCLKWithoutODMCombine >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3961  						&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3962  					v->PlaneRequiredDISPCLKWithoutODMCombine = v->PixelClock[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3963  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3964  				v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3965  						* (1 + v->DISPCLKRampingMargin / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3966  				if ((v->PlaneRequiredDISPCLKWithODMCombine2To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3967  						&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3968  					v->PlaneRequiredDISPCLKWithODMCombine2To1 = v->PixelClock[k] / 2 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3969  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3970  				v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3971  						* (1 + v->DISPCLKRampingMargin / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3972  				if ((v->PlaneRequiredDISPCLKWithODMCombine4To1 >= v->MaxDispclk[i] && v->MaxDispclk[i] == v->MaxDispclk[mode_lib->soc.num_states]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3973  						&& v->MaxDppclk[i] == v->MaxDppclk[mode_lib->soc.num_states])) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3974  					v->PlaneRequiredDISPCLKWithODMCombine4To1 = v->PixelClock[k] / 4 * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3975  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3976  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3977  				if (v->ODMCombinePolicy == dm_odm_combine_policy_none) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3978  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_disabled;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3979  					v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithoutODMCombine;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3980  				} else if (v->ODMCombinePolicy == dm_odm_combine_policy_2to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3981  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_2to1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3982  					v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine2To1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3983  				} else if (v->ODMCombinePolicy == dm_odm_combine_policy_4to1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3984  						|| v->PlaneRequiredDISPCLKWithODMCombine2To1 > v->MaxDispclkRoundedDownToDFSGranularity) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3985  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_4to1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3986  					v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine4To1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3987  				} else if (v->PlaneRequiredDISPCLKWithoutODMCombine > v->MaxDispclkRoundedDownToDFSGranularity) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3988  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_2to1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3989  					v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine2To1;
5ec37c089e7d02 Dmytro Laktyushkin 2020-08-06  3990  				} else if (v->DSCEnabled[k] && (v->HActive[k] > DCN30_MAX_DSC_IMAGE_WIDTH)) {
5ec37c089e7d02 Dmytro Laktyushkin 2020-08-06  3991  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_2to1;
5ec37c089e7d02 Dmytro Laktyushkin 2020-08-06  3992  					v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine2To1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3993  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3994  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_disabled;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  3995  					v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithoutODMCombine;
f8b9f9a599db59 Chris Park         2020-06-09  3996  					/*420 format workaround*/
f8b9f9a599db59 Chris Park         2020-06-09  3997  					if (v->HActive[k] > 4096 && v->OutputFormat[k] == dm_420) {
f8b9f9a599db59 Chris Park         2020-06-09  3998  						v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_2to1;
f8b9f9a599db59 Chris Park         2020-06-09  3999  						v->PlaneRequiredDISPCLK = v->PlaneRequiredDISPCLKWithODMCombine2To1;
f8b9f9a599db59 Chris Park         2020-06-09  4000  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4001  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4002  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4003  				if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4004  					v->MPCCombine[i][j][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4005  					v->NoOfDPP[i][j][k] = 4;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4006  					v->RequiredDPPCLK[i][j][k] = v->MinDPPCLKUsingSingleDPP[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) / 4;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4007  				} else if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4008  					v->MPCCombine[i][j][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4009  					v->NoOfDPP[i][j][k] = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4010  					v->RequiredDPPCLK[i][j][k] = v->MinDPPCLKUsingSingleDPP[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) / 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4011  				} else if ((v->WhenToDoMPCCombine == dm_mpc_never
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4012  						|| (v->MinDPPCLKUsingSingleDPP[k] * (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) <= v->MaxDppclkRoundedDownToDFSGranularity
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4013  								&& v->SingleDPPViewportSizeSupportPerPlane[k] == true))) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4014  					v->MPCCombine[i][j][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4015  					v->NoOfDPP[i][j][k] = 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4016  					v->RequiredDPPCLK[i][j][k] = v->MinDPPCLKUsingSingleDPP[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4017  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4018  					v->MPCCombine[i][j][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4019  					v->NoOfDPP[i][j][k] = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4020  					v->RequiredDPPCLK[i][j][k] = v->MinDPPCLKUsingSingleDPP[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) / 2.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4021  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4022  				v->RequiredDISPCLK[i][j] = dml_max(v->RequiredDISPCLK[i][j], v->PlaneRequiredDISPCLK);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4023  				if ((v->MinDPPCLKUsingSingleDPP[k] / v->NoOfDPP[i][j][k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4024  						> v->MaxDppclkRoundedDownToDFSGranularity) || (v->PlaneRequiredDISPCLK > v->MaxDispclkRoundedDownToDFSGranularity)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4025  					v->DISPCLK_DPPCLK_Support[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4026  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4027  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4028  			v->TotalNumberOfActiveDPP[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4029  			v->TotalNumberOfSingleDPPPlanes[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4030  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4031  				v->TotalNumberOfActiveDPP[i][j] = v->TotalNumberOfActiveDPP[i][j] + v->NoOfDPP[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4032  				if (v->NoOfDPP[i][j][k] == 1)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4033  					v->TotalNumberOfSingleDPPPlanes[i][j] = v->TotalNumberOfSingleDPPPlanes[i][j] + 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4034  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4035  			if (j == 1 && v->WhenToDoMPCCombine != dm_mpc_never) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4036  				while (!(v->TotalNumberOfActiveDPP[i][j] >= v->MaxNumDPP || v->TotalNumberOfSingleDPPPlanes[i][j] == 0)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4037  					double BWOfNonSplitPlaneOfMaximumBandwidth = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4038  					unsigned int NumberOfNonSplitPlaneOfMaximumBandwidth = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4039  					BWOfNonSplitPlaneOfMaximumBandwidth = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4040  					NumberOfNonSplitPlaneOfMaximumBandwidth = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4041  					for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4042  						if (v->ReadBandwidthLuma[k] + v->ReadBandwidthChroma[k] > BWOfNonSplitPlaneOfMaximumBandwidth
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4043  								&& v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_disabled && v->MPCCombine[i][j][k] == false) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4044  							BWOfNonSplitPlaneOfMaximumBandwidth = v->ReadBandwidthLuma[k] + v->ReadBandwidthChroma[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4045  							NumberOfNonSplitPlaneOfMaximumBandwidth = k;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4046  						}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4047  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4048  					v->MPCCombine[i][j][NumberOfNonSplitPlaneOfMaximumBandwidth] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4049  					v->NoOfDPP[i][j][NumberOfNonSplitPlaneOfMaximumBandwidth] = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4050  					v->RequiredDPPCLK[i][j][NumberOfNonSplitPlaneOfMaximumBandwidth] = v->MinDPPCLKUsingSingleDPP[NumberOfNonSplitPlaneOfMaximumBandwidth]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4051  							* (1 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100) / 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4052  					v->TotalNumberOfActiveDPP[i][j] = v->TotalNumberOfActiveDPP[i][j] + 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4053  					v->TotalNumberOfSingleDPPPlanes[i][j] = v->TotalNumberOfSingleDPPPlanes[i][j] + 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4054  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4055  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4056  			if (v->TotalNumberOfActiveDPP[i][j] > v->MaxNumDPP) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4057  				v->RequiredDISPCLK[i][j] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4058  				v->DISPCLK_DPPCLK_Support[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4059  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4060  					v->ODMCombineEnablePerState[i][k] = dm_odm_combine_mode_disabled;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4061  					if (v->SingleDPPViewportSizeSupportPerPlane[k] == false && v->WhenToDoMPCCombine != dm_mpc_never) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4062  						v->MPCCombine[i][j][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4063  						v->NoOfDPP[i][j][k] = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4064  						v->RequiredDPPCLK[i][j][k] = v->MinDPPCLKUsingSingleDPP[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) / 2.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4065  					} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4066  						v->MPCCombine[i][j][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4067  						v->NoOfDPP[i][j][k] = 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4068  						v->RequiredDPPCLK[i][j][k] = v->MinDPPCLKUsingSingleDPP[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4069  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4070  					if (!(v->MaxDispclk[i] == v->MaxDispclk[v->soc.num_states - 1] && v->MaxDppclk[i] == v->MaxDppclk[v->soc.num_states - 1])) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4071  						v->PlaneRequiredDISPCLK = v->PixelClock[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4072  								* (1.0 + v->DISPCLKRampingMargin / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4073  					} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4074  						v->PlaneRequiredDISPCLK = v->PixelClock[k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4075  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4076  					v->RequiredDISPCLK[i][j] = dml_max(v->RequiredDISPCLK[i][j], v->PlaneRequiredDISPCLK);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4077  					if ((v->MinDPPCLKUsingSingleDPP[k] / v->NoOfDPP[i][j][k] * (1.0 + v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4078  							> v->MaxDppclkRoundedDownToDFSGranularity) || (v->PlaneRequiredDISPCLK > v->MaxDispclkRoundedDownToDFSGranularity)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4079  						v->DISPCLK_DPPCLK_Support[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4080  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4081  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4082  				v->TotalNumberOfActiveDPP[i][j] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4083  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4084  					v->TotalNumberOfActiveDPP[i][j] = v->TotalNumberOfActiveDPP[i][j] + v->NoOfDPP[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4085  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4086  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4087  			v->RequiredDISPCLK[i][j] = dml_max(v->RequiredDISPCLK[i][j], v->WritebackRequiredDISPCLK);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4088  			if (v->MaxDispclkRoundedDownToDFSGranularity < v->WritebackRequiredDISPCLK) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4089  				v->DISPCLK_DPPCLK_Support[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4090  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4091  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4092  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4093  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4094  	/*Total Available Pipes Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4095  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4096  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4097  		for (j = 0; j < 2; j++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4098  			if (v->TotalNumberOfActiveDPP[i][j] <= v->MaxNumDPP) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4099  				v->TotalAvailablePipesSupport[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4100  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4101  				v->TotalAvailablePipesSupport[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4102  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4103  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4104  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4105  	/*Display IO and DSC Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4106  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4107  	v->NonsupportedDSCInputBPC = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4108  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4109  		if (!(v->DSCInputBitPerComponent[k] == 12.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4110  				|| v->DSCInputBitPerComponent[k] == 10.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4111  				|| v->DSCInputBitPerComponent[k] == 8.0)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4112  			v->NonsupportedDSCInputBPC = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4113  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4114  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4115  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4116  	/*Number Of DSC Slices*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4117  	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4118  		if (v->BlendingAndTiming[k] == k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4119  			if (v->PixelClockBackEnd[k] > 3200) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4120  				v->NumberOfDSCSlices[k] = dml_ceil(v->PixelClockBackEnd[k] / 400.0, 4.0);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4121  			} else if (v->PixelClockBackEnd[k] > 1360) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4122  				v->NumberOfDSCSlices[k] = 8;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4123  			} else if (v->PixelClockBackEnd[k] > 680) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4124  				v->NumberOfDSCSlices[k] = 4;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4125  			} else if (v->PixelClockBackEnd[k] > 340) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4126  				v->NumberOfDSCSlices[k] = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4127  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4128  				v->NumberOfDSCSlices[k] = 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4129  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4130  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4131  			v->NumberOfDSCSlices[k] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4132  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4133  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4134  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4135  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4136  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4137  			v->RequiresDSC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4138  			v->RequiresFEC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4139  			if (v->BlendingAndTiming[k] == k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4140  				if (v->Output[k] == dm_hdmi) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4141  					v->RequiresDSC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4142  					v->RequiresFEC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4143  					v->OutputBppPerState[i][k] = TruncToValidBPP(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4144  							dml_min(600.0, v->PHYCLKPerState[i]) * 10,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4145  							3,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4146  							v->HTotal[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4147  							v->HActive[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4148  							v->PixelClockBackEnd[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4149  							v->ForcedOutputLinkBPP[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4150  							false,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4151  							v->Output[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4152  							v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4153  							v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4154  							v->NumberOfDSCSlices[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4155  							v->AudioSampleRate[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4156  							v->AudioSampleLayout[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4157  							v->ODMCombineEnablePerState[i][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4158  				} else if (v->Output[k] == dm_dp || v->Output[k] == dm_edp) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4159  					if (v->DSCEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4160  						v->RequiresDSC[i][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4161  						v->LinkDSCEnable = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4162  						if (v->Output[k] == dm_dp) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4163  							v->RequiresFEC[i][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4164  						} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4165  							v->RequiresFEC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4166  						}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4167  					} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4168  						v->RequiresDSC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4169  						v->LinkDSCEnable = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4170  						v->RequiresFEC[i][k] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4171  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4172  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4173  					v->Outbpp = BPP_INVALID;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4174  					if (v->PHYCLKPerState[i] >= 270.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4175  						v->Outbpp = TruncToValidBPP(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4176  								(1.0 - v->Downspreading / 100.0) * 2700,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4177  								v->OutputLinkDPLanes[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4178  								v->HTotal[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4179  								v->HActive[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4180  								v->PixelClockBackEnd[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4181  								v->ForcedOutputLinkBPP[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4182  								v->LinkDSCEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4183  								v->Output[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4184  								v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4185  								v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4186  								v->NumberOfDSCSlices[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4187  								v->AudioSampleRate[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4188  								v->AudioSampleLayout[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4189  								v->ODMCombineEnablePerState[i][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4190  						v->OutputBppPerState[i][k] = v->Outbpp;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4191  						// TODO: Need some other way to handle this nonsense
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4192  						// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR"
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4193  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4194  					if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 540.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4195  						v->Outbpp = TruncToValidBPP(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4196  								(1.0 - v->Downspreading / 100.0) * 5400,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4197  								v->OutputLinkDPLanes[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4198  								v->HTotal[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4199  								v->HActive[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4200  								v->PixelClockBackEnd[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4201  								v->ForcedOutputLinkBPP[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4202  								v->LinkDSCEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4203  								v->Output[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4204  								v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4205  								v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4206  								v->NumberOfDSCSlices[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4207  								v->AudioSampleRate[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4208  								v->AudioSampleLayout[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4209  								v->ODMCombineEnablePerState[i][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4210  						v->OutputBppPerState[i][k] = v->Outbpp;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4211  						// TODO: Need some other way to handle this nonsense
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4212  						// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR2"
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4213  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4214  					if (v->Outbpp == BPP_INVALID && v->PHYCLKPerState[i] >= 810.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4215  						v->Outbpp = TruncToValidBPP(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4216  								(1.0 - v->Downspreading / 100.0) * 8100,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4217  								v->OutputLinkDPLanes[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4218  								v->HTotal[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4219  								v->HActive[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4220  								v->PixelClockBackEnd[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4221  								v->ForcedOutputLinkBPP[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4222  								v->LinkDSCEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4223  								v->Output[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4224  								v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4225  								v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4226  								v->NumberOfDSCSlices[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4227  								v->AudioSampleRate[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4228  								v->AudioSampleLayout[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4229  								v->ODMCombineEnablePerState[i][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4230  						if (v->Outbpp == BPP_INVALID && v->ForcedOutputLinkBPP[k] == 0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4231  							//if (v->Outbpp == BPP_INVALID && v->DSCEnabled[k] == dm_dsc_enable_only_if_necessary && v->ForcedOutputLinkBPP[k] == 0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4232  							v->RequiresDSC[i][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4233  							v->LinkDSCEnable = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4234  							if (v->Output[k] == dm_dp) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4235  								v->RequiresFEC[i][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4236  							}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4237  							v->Outbpp = TruncToValidBPP(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4238  									(1.0 - v->Downspreading / 100.0) * 8100,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4239  									v->OutputLinkDPLanes[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4240  									v->HTotal[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4241  									v->HActive[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4242  									v->PixelClockBackEnd[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4243  									v->ForcedOutputLinkBPP[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4244  									v->LinkDSCEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4245  									v->Output[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4246  									v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4247  									v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4248  									v->NumberOfDSCSlices[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4249  									v->AudioSampleRate[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4250  									v->AudioSampleLayout[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4251  									v->ODMCombineEnablePerState[i][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4252  						}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4253  						v->OutputBppPerState[i][k] = v->Outbpp;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4254  						// TODO: Need some other way to handle this nonsense
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4255  						// v->OutputTypeAndRatePerState[i][k] = v->Output[k] & " HBR3"
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4256  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4257  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4258  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4259  				v->OutputBppPerState[i][k] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4260  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4261  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4262  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4263  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4264  		v->DIOSupport[i] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4265  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4266  			if (v->BlendingAndTiming[k] == k && (v->Output[k] == dm_dp || v->Output[k] == dm_edp || v->Output[k] == dm_hdmi)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4267  					&& (v->OutputBppPerState[i][k] == 0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4268  							|| (v->OutputFormat[k] == dm_420 && v->Interlace[k] == true && v->ProgressiveToInterlaceUnitInOPP == true))) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4269  				v->DIOSupport[i] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4270  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4271  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4272  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4273  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4274  	for (i = 0; i < v->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4275  		v->ODMCombine4To1SupportCheckOK[i] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4276  		for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4277  			if (v->BlendingAndTiming[k] == k && v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4278  					&& (v->ODMCombine4To1Supported == false || v->Output[k] == dm_dp || v->Output[k] == dm_edp || v->Output[k] == dm_hdmi)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4279  				v->ODMCombine4To1SupportCheckOK[i] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4280  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4281  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4282  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4283  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4284  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4285  		v->DSCCLKRequiredMoreThanSupported[i] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4286  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4287  			if (v->BlendingAndTiming[k] == k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4288  				if (v->Output[k] == dm_dp || v->Output[k] == dm_edp) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4289  					if (v->OutputFormat[k] == dm_420) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4290  						v->DSCFormatFactor = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4291  					} else if (v->OutputFormat[k] == dm_444) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4292  						v->DSCFormatFactor = 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4293  					} else if (v->OutputFormat[k] == dm_n422) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4294  						v->DSCFormatFactor = 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4295  					} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4296  						v->DSCFormatFactor = 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4297  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4298  					if (v->RequiresDSC[i][k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4299  						if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4300  							if (v->PixelClockBackEnd[k] / 12.0 / v->DSCFormatFactor
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4301  									> (1.0 - v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * v->MaxDSCCLK[i]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4302  								v->DSCCLKRequiredMoreThanSupported[i] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4303  							}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4304  						} else if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4305  							if (v->PixelClockBackEnd[k] / 6.0 / v->DSCFormatFactor
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4306  									> (1.0 - v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * v->MaxDSCCLK[i]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4307  								v->DSCCLKRequiredMoreThanSupported[i] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4308  							}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4309  						} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4310  							if (v->PixelClockBackEnd[k] / 3.0 / v->DSCFormatFactor
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4311  									> (1.0 - v->DISPCLKDPPCLKDSCCLKDownSpreading / 100.0) * v->MaxDSCCLK[i]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4312  								v->DSCCLKRequiredMoreThanSupported[i] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4313  							}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4314  						}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4315  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4316  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4317  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4318  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4319  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4320  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4321  		v->NotEnoughDSCUnits[i] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4322  		v->TotalDSCUnitsRequired = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4323  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4324  			if (v->RequiresDSC[i][k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4325  				if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_4to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4326  					v->TotalDSCUnitsRequired = v->TotalDSCUnitsRequired + 4.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4327  				} else if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4328  					v->TotalDSCUnitsRequired = v->TotalDSCUnitsRequired + 2.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4329  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4330  					v->TotalDSCUnitsRequired = v->TotalDSCUnitsRequired + 1.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4331  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4332  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4333  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4334  		if (v->TotalDSCUnitsRequired > v->NumberOfDSC) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4335  			v->NotEnoughDSCUnits[i] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4336  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4337  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4338  	/*DSC Delay per state*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4339  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4340  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4341  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4342  			if (v->OutputBppPerState[i][k] == BPP_INVALID) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4343  				v->BPP = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4344  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4345  				v->BPP = v->OutputBppPerState[i][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4346  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4347  			if (v->RequiresDSC[i][k] == true && v->BPP != 0.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4348  				if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_disabled) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4349  					v->DSCDelayPerState[i][k] = dscceComputeDelay(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4350  							v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4351  							v->BPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4352  							dml_ceil(1.0 * v->HActive[k] / v->NumberOfDSCSlices[k], 1.0),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4353  							v->NumberOfDSCSlices[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4354  							v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4355  							v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4356  				} else if (v->ODMCombineEnablePerState[i][k] == dm_odm_combine_mode_2to1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4357  					v->DSCDelayPerState[i][k] = 2.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4358  							* dscceComputeDelay(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4359  									v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4360  									v->BPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4361  									dml_ceil(1.0 * v->HActive[k] / v->NumberOfDSCSlices[k], 1.0),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4362  									v->NumberOfDSCSlices[k] / 2,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4363  									v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4364  									v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4365  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4366  					v->DSCDelayPerState[i][k] = 4.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4367  							* (dscceComputeDelay(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4368  									v->DSCInputBitPerComponent[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4369  									v->BPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4370  									dml_ceil(1.0 * v->HActive[k] / v->NumberOfDSCSlices[k], 1.0),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4371  									v->NumberOfDSCSlices[k] / 4,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4372  									v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4373  									v->Output[k]) + dscComputeDelay(v->OutputFormat[k], v->Output[k]));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4374  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4375  				v->DSCDelayPerState[i][k] = v->DSCDelayPerState[i][k] * v->PixelClock[k] / v->PixelClockBackEnd[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4376  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4377  				v->DSCDelayPerState[i][k] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4378  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4379  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4380  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4381  			for (m = 0; m <= v->NumberOfActivePlanes - 1; m++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4382  				if (v->BlendingAndTiming[k] == m && v->RequiresDSC[i][m] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4383  					v->DSCDelayPerState[i][k] = v->DSCDelayPerState[i][m];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4384  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4385  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4386  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4387  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4388  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4389  	//Calculate Swath, DET Configuration, DCFCLKDeepSleep
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4390  	//
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4391  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4392  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4393  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4394  				v->RequiredDPPCLKThisState[k] = v->RequiredDPPCLK[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4395  				v->NoOfDPPThisState[k] = v->NoOfDPP[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4396  				v->ODMCombineEnableThisState[k] = v->ODMCombineEnablePerState[i][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4397  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4398  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4399  			CalculateSwathAndDETConfiguration(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4400  					false,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4401  					v->NumberOfActivePlanes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4402  					v->DETBufferSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4403  					v->MaximumSwathWidthLuma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4404  					v->MaximumSwathWidthChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4405  					v->SourceScan,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4406  					v->SourcePixelFormat,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4407  					v->SurfaceTiling,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4408  					v->ViewportWidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4409  					v->ViewportHeight,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4410  					v->SurfaceWidthY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4411  					v->SurfaceWidthC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4412  					v->SurfaceHeightY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4413  					v->SurfaceHeightC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4414  					v->Read256BlockHeightY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4415  					v->Read256BlockHeightC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4416  					v->Read256BlockWidthY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4417  					v->Read256BlockWidthC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4418  					v->ODMCombineEnableThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4419  					v->BlendingAndTiming,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4420  					v->BytePerPixelY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4421  					v->BytePerPixelC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4422  					v->BytePerPixelInDETY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4423  					v->BytePerPixelInDETC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4424  					v->HActive,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4425  					v->HRatio,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4426  					v->HRatioChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4427  					v->NoOfDPPThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4428  					v->swath_width_luma_ub_this_state,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4429  					v->swath_width_chroma_ub_this_state,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4430  					v->SwathWidthYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4431  					v->SwathWidthCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4432  					v->SwathHeightYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4433  					v->SwathHeightCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4434  					v->DETBufferSizeYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4435  					v->DETBufferSizeCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4436  					v->dummystring,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4437  					&v->ViewportSizeSupport[i][j]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4438  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4439  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4440  				v->swath_width_luma_ub_all_states[i][j][k] = v->swath_width_luma_ub_this_state[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4441  				v->swath_width_chroma_ub_all_states[i][j][k] = v->swath_width_chroma_ub_this_state[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4442  				v->SwathWidthYAllStates[i][j][k] = v->SwathWidthYThisState[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4443  				v->SwathWidthCAllStates[i][j][k] = v->SwathWidthCThisState[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4444  				v->SwathHeightYAllStates[i][j][k] = v->SwathHeightYThisState[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4445  				v->SwathHeightCAllStates[i][j][k] = v->SwathHeightCThisState[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4446  				v->DETBufferSizeYAllStates[i][j][k] = v->DETBufferSizeYThisState[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4447  				v->DETBufferSizeCAllStates[i][j][k] = v->DETBufferSizeCThisState[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4448  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4449  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4450  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4451  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4452  	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4453  		v->cursor_bw[k] = v->NumberOfCursors[k] * v->CursorWidth[k][0] * v->CursorBPP[k][0] / 8.0 / (v->HTotal[k] / v->PixelClock[k]) * v->VRatio[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4454  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4455  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4456  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4457  		for (j = 0; j < 2; j++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4458  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4459  				v->swath_width_luma_ub_this_state[k] = v->swath_width_luma_ub_all_states[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4460  				v->swath_width_chroma_ub_this_state[k] = v->swath_width_chroma_ub_all_states[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4461  				v->SwathWidthYThisState[k] = v->SwathWidthYAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4462  				v->SwathWidthCThisState[k] = v->SwathWidthCAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4463  				v->SwathHeightYThisState[k] = v->SwathHeightYAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4464  				v->SwathHeightCThisState[k] = v->SwathHeightCAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4465  				v->DETBufferSizeYThisState[k] = v->DETBufferSizeYAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4466  				v->DETBufferSizeCThisState[k] = v->DETBufferSizeCAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4467  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4468  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4469  			v->TotalNumberOfDCCActiveDPP[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4470  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4471  				if (v->DCCEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4472  					v->TotalNumberOfDCCActiveDPP[i][j] = v->TotalNumberOfDCCActiveDPP[i][j] + v->NoOfDPP[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4473  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4474  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4475  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4476  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4477  				if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_420_12
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4478  						|| v->SourcePixelFormat[k] == dm_rgbe_alpha) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4479  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4480  					if ((v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_420_12) && v->SourceScan[k] != dm_vert) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4481  						v->PTEBufferSizeInRequestsForLuma = (v->PTEBufferSizeInRequestsLuma + v->PTEBufferSizeInRequestsChroma) / 2;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4482  						v->PTEBufferSizeInRequestsForChroma = v->PTEBufferSizeInRequestsForLuma;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4483  					} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4484  						v->PTEBufferSizeInRequestsForLuma = v->PTEBufferSizeInRequestsLuma;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4485  						v->PTEBufferSizeInRequestsForChroma = v->PTEBufferSizeInRequestsChroma;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4486  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4487  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4488  					v->PDEAndMetaPTEBytesPerFrameC = CalculateVMAndRowBytes(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4489  							mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4490  							v->DCCEnable[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4491  							v->Read256BlockHeightC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4492  							v->Read256BlockWidthY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4493  							v->SourcePixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4494  							v->SurfaceTiling[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4495  							v->BytePerPixelC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4496  							v->SourceScan[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4497  							v->SwathWidthCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4498  							v->ViewportHeightChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4499  							v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4500  							v->HostVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4501  							v->HostVMMaxNonCachedPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4502  							v->GPUVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4503  							v->HostVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4504  							v->PTEBufferSizeInRequestsForChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4505  							v->PitchC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4506  							0.0,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4507  							&v->MacroTileWidthC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4508  							&v->MetaRowBytesC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4509  							&v->DPTEBytesPerRowC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4510  							&v->PTEBufferSizeNotExceededC[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4511  							&v->dummyinteger7,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4512  							&v->dpte_row_height_chroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4513  							&v->dummyinteger28,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4514  							&v->dummyinteger26,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4515  							&v->dummyinteger23,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4516  							&v->meta_row_height_chroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4517  							&v->dummyinteger8,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4518  							&v->dummyinteger9,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4519  							&v->dummyinteger19,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4520  							&v->dummyinteger20,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4521  							&v->dummyinteger17,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4522  							&v->dummyinteger10,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4523  							&v->dummyinteger11);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4524  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4525  					v->PrefetchLinesC[i][j][k] = CalculatePrefetchSourceLines(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4526  							mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4527  							v->VRatioChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4528  							v->VTAPsChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4529  							v->Interlace[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4530  							v->ProgressiveToInterlaceUnitInOPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4531  							v->SwathHeightCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4532  							v->ViewportYStartC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4533  							&v->PrefillC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4534  							&v->MaxNumSwC[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4535  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4536  					v->PTEBufferSizeInRequestsForLuma = v->PTEBufferSizeInRequestsLuma + v->PTEBufferSizeInRequestsChroma;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4537  					v->PTEBufferSizeInRequestsForChroma = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4538  					v->PDEAndMetaPTEBytesPerFrameC = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4539  					v->MetaRowBytesC = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4540  					v->DPTEBytesPerRowC = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4541  					v->PrefetchLinesC[i][j][k] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4542  					v->PTEBufferSizeNotExceededC[i][j][k] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4543  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4544  				v->PDEAndMetaPTEBytesPerFrameY = CalculateVMAndRowBytes(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4545  						mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4546  						v->DCCEnable[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4547  						v->Read256BlockHeightY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4548  						v->Read256BlockWidthY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4549  						v->SourcePixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4550  						v->SurfaceTiling[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4551  						v->BytePerPixelY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4552  						v->SourceScan[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4553  						v->SwathWidthYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4554  						v->ViewportHeight[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4555  						v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4556  						v->HostVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4557  						v->HostVMMaxNonCachedPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4558  						v->GPUVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4559  						v->HostVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4560  						v->PTEBufferSizeInRequestsForLuma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4561  						v->PitchY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4562  						v->DCCMetaPitchY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4563  						&v->MacroTileWidthY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4564  						&v->MetaRowBytesY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4565  						&v->DPTEBytesPerRowY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4566  						&v->PTEBufferSizeNotExceededY[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4567  						v->dummyinteger4,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4568  						&v->dpte_row_height[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4569  						&v->dummyinteger29,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4570  						&v->dummyinteger27,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4571  						&v->dummyinteger24,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4572  						&v->meta_row_height[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4573  						&v->dummyinteger25,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4574  						&v->dpte_group_bytes[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4575  						&v->dummyinteger21,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4576  						&v->dummyinteger22,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4577  						&v->dummyinteger18,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4578  						&v->dummyinteger5,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4579  						&v->dummyinteger6);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4580  				v->PrefetchLinesY[i][j][k] = CalculatePrefetchSourceLines(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4581  						mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4582  						v->VRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4583  						v->vtaps[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4584  						v->Interlace[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4585  						v->ProgressiveToInterlaceUnitInOPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4586  						v->SwathHeightYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4587  						v->ViewportYStartY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4588  						&v->PrefillY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4589  						&v->MaxNumSwY[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4590  				v->PDEAndMetaPTEBytesPerFrame[i][j][k] = v->PDEAndMetaPTEBytesPerFrameY + v->PDEAndMetaPTEBytesPerFrameC;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4591  				v->MetaRowBytes[i][j][k] = v->MetaRowBytesY + v->MetaRowBytesC;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4592  				v->DPTEBytesPerRow[i][j][k] = v->DPTEBytesPerRowY + v->DPTEBytesPerRowC;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4593  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4594  				CalculateRowBandwidth(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4595  						v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4596  						v->SourcePixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4597  						v->VRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4598  						v->VRatioChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4599  						v->DCCEnable[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4600  						v->HTotal[k] / v->PixelClock[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4601  						v->MetaRowBytesY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4602  						v->MetaRowBytesC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4603  						v->meta_row_height[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4604  						v->meta_row_height_chroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4605  						v->DPTEBytesPerRowY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4606  						v->DPTEBytesPerRowC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4607  						v->dpte_row_height[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4608  						v->dpte_row_height_chroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4609  						&v->meta_row_bandwidth[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4610  						&v->dpte_row_bandwidth[i][j][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4611  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4612  			v->UrgLatency[i] = CalculateUrgentLatency(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4613  					v->UrgentLatencyPixelDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4614  					v->UrgentLatencyPixelMixedWithVMData,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4615  					v->UrgentLatencyVMDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4616  					v->DoUrgentLatencyAdjustment,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4617  					v->UrgentLatencyAdjustmentFabricClockComponent,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4618  					v->UrgentLatencyAdjustmentFabricClockReference,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4619  					v->FabricClockPerState[i]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4620  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4621  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4622  				CalculateUrgentBurstFactor(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4623  						v->swath_width_luma_ub_this_state[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4624  						v->swath_width_chroma_ub_this_state[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4625  						v->DETBufferSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4626  						v->SwathHeightYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4627  						v->SwathHeightCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4628  						v->HTotal[k] / v->PixelClock[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4629  						v->UrgLatency[i],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4630  						v->CursorBufferSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4631  						v->CursorWidth[k][0],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4632  						v->CursorBPP[k][0],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4633  						v->VRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4634  						v->VRatioChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4635  						v->BytePerPixelInDETY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4636  						v->BytePerPixelInDETC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4637  						v->DETBufferSizeYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4638  						v->DETBufferSizeCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4639  						&v->UrgentBurstFactorCursor[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4640  						&v->UrgentBurstFactorLuma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4641  						&v->UrgentBurstFactorChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4642  						&NotUrgentLatencyHiding[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4643  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4644  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4645  			v->NotUrgentLatencyHiding[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4646  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4647  				if (NotUrgentLatencyHiding[k]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4648  					v->NotUrgentLatencyHiding[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4649  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4650  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4651  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4652  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4653  				v->VActivePixelBandwidth[i][j][k] = v->ReadBandwidthLuma[k] * v->UrgentBurstFactorLuma[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4654  						+ v->ReadBandwidthChroma[k] * v->UrgentBurstFactorChroma[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4655  				v->VActiveCursorBandwidth[i][j][k] = v->cursor_bw[k] * v->UrgentBurstFactorCursor[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4656  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4657  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4658  			v->TotalVActivePixelBandwidth[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4659  			v->TotalVActiveCursorBandwidth[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4660  			v->TotalMetaRowBandwidth[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4661  			v->TotalDPTERowBandwidth[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4662  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4663  				v->TotalVActivePixelBandwidth[i][j] = v->TotalVActivePixelBandwidth[i][j] + v->VActivePixelBandwidth[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4664  				v->TotalVActiveCursorBandwidth[i][j] = v->TotalVActiveCursorBandwidth[i][j] + v->VActiveCursorBandwidth[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4665  				v->TotalMetaRowBandwidth[i][j] = v->TotalMetaRowBandwidth[i][j] + v->NoOfDPP[i][j][k] * v->meta_row_bandwidth[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4666  				v->TotalDPTERowBandwidth[i][j] = v->TotalDPTERowBandwidth[i][j] + v->NoOfDPP[i][j][k] * v->dpte_row_bandwidth[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4667  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4668  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4669  			CalculateDCFCLKDeepSleep(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4670  					mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4671  					v->NumberOfActivePlanes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4672  					v->BytePerPixelY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4673  					v->BytePerPixelC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4674  					v->VRatio,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4675  					v->VRatioChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4676  					v->SwathWidthYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4677  					v->SwathWidthCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4678  					v->NoOfDPPThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4679  					v->HRatio,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4680  					v->HRatioChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4681  					v->PixelClock,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4682  					v->PSCL_FACTOR,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4683  					v->PSCL_FACTOR_CHROMA,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4684  					v->RequiredDPPCLKThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4685  					v->ReadBandwidthLuma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4686  					v->ReadBandwidthChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4687  					v->ReturnBusWidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4688  					&v->ProjectedDCFCLKDeepSleep[i][j]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4689  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4690  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4691  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4692  	//Calculate Return BW
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4693  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4694  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4695  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4696  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4697  				if (v->BlendingAndTiming[k] == k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4698  					if (v->WritebackEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4699  						v->WritebackDelayTime[k] = v->WritebackLatency
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4700  								+ CalculateWriteBackDelay(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4701  										v->WritebackPixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4702  										v->WritebackHRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4703  										v->WritebackVRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4704  										v->WritebackVTaps[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4705  										v->WritebackDestinationWidth[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4706  										v->WritebackDestinationHeight[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4707  										v->WritebackSourceHeight[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4708  										v->HTotal[k]) / v->RequiredDISPCLK[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4709  					} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4710  						v->WritebackDelayTime[k] = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4711  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4712  					for (m = 0; m <= v->NumberOfActivePlanes - 1; m++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4713  						if (v->BlendingAndTiming[m] == k && v->WritebackEnable[m] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4714  							v->WritebackDelayTime[k] = dml_max(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4715  									v->WritebackDelayTime[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4716  									v->WritebackLatency
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4717  											+ CalculateWriteBackDelay(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4718  													v->WritebackPixelFormat[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4719  													v->WritebackHRatio[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4720  													v->WritebackVRatio[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4721  													v->WritebackVTaps[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4722  													v->WritebackDestinationWidth[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4723  													v->WritebackDestinationHeight[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4724  													v->WritebackSourceHeight[m],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4725  													v->HTotal[m]) / v->RequiredDISPCLK[i][j]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4726  						}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4727  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4728  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4729  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4730  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4731  				for (m = 0; m <= v->NumberOfActivePlanes - 1; m++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4732  					if (v->BlendingAndTiming[k] == m) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4733  						v->WritebackDelayTime[k] = v->WritebackDelayTime[m];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4734  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4735  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4736  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4737  			v->MaxMaxVStartup[i][j] = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4738  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4739  				v->MaximumVStartup[i][j][k] = v->VTotal[k] - v->VActive[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4740  						- dml_max(1.0, dml_ceil(1.0 * v->WritebackDelayTime[k] / (v->HTotal[k] / v->PixelClock[k]), 1.0));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4741  				v->MaxMaxVStartup[i][j] = dml_max(v->MaxMaxVStartup[i][j], v->MaximumVStartup[i][j][k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4742  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4743  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4744  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4745  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4746  	ReorderingBytes = v->NumberOfChannels
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4747  			* dml_max3(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4748  					v->UrgentOutOfOrderReturnPerChannelPixelDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4749  					v->UrgentOutOfOrderReturnPerChannelPixelMixedWithVMData,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4750  					v->UrgentOutOfOrderReturnPerChannelVMDataOnly);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4751  	v->FinalDRAMClockChangeLatency = (v->DRAMClockChangeLatencyOverride > 0 ? v->DRAMClockChangeLatencyOverride : v->DRAMClockChangeLatency);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4752  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4753  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4754  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4755  			v->DCFCLKState[i][j] = v->DCFCLKPerState[i];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4756  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4757  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4758  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4759  	if (v->UseMinimumRequiredDCFCLK == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4760  		UseMinimumDCFCLK(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4761  				mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4762  				v->MaxInterDCNTileRepeaters,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4763  				MaxPrefetchMode,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4764  				v->FinalDRAMClockChangeLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4765  				v->SREnterPlusExitTime,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4766  				v->ReturnBusWidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4767  				v->RoundTripPingLatencyCycles,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4768  				ReorderingBytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4769  				v->PixelChunkSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4770  				v->MetaChunkSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4771  				v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4772  				v->GPUVMMaxPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4773  				v->HostVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4774  				v->NumberOfActivePlanes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4775  				v->HostVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4776  				v->HostVMMaxNonCachedPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4777  				v->DynamicMetadataVMEnabled,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4778  				v->ImmediateFlipRequirement,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4779  				v->ProgressiveToInterlaceUnitInOPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4780  				v->MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4781  				v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4782  				v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4783  				v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4784  				v->VTotal,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4785  				v->VActive,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4786  				v->DynamicMetadataTransmittedBytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4787  				v->DynamicMetadataLinesBeforeActiveRequired,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4788  				v->Interlace,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4789  				v->RequiredDPPCLK,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4790  				v->RequiredDISPCLK,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4791  				v->UrgLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4792  				v->NoOfDPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4793  				v->ProjectedDCFCLKDeepSleep,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4794  				v->MaximumVStartup,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4795  				v->TotalVActivePixelBandwidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4796  				v->TotalVActiveCursorBandwidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4797  				v->TotalMetaRowBandwidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4798  				v->TotalDPTERowBandwidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4799  				v->TotalNumberOfActiveDPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4800  				v->TotalNumberOfDCCActiveDPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4801  				v->dpte_group_bytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4802  				v->PrefetchLinesY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4803  				v->PrefetchLinesC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4804  				v->swath_width_luma_ub_all_states,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4805  				v->swath_width_chroma_ub_all_states,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4806  				v->BytePerPixelY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4807  				v->BytePerPixelC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4808  				v->HTotal,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4809  				v->PixelClock,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4810  				v->PDEAndMetaPTEBytesPerFrame,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4811  				v->DPTEBytesPerRow,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4812  				v->MetaRowBytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4813  				v->DynamicMetadataEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4814  				v->VActivePixelBandwidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4815  				v->VActiveCursorBandwidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4816  				v->ReadBandwidthLuma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4817  				v->ReadBandwidthChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4818  				v->DCFCLKPerState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4819  				v->DCFCLKState);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4820  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4821  		if (v->ClampMinDCFCLK) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4822  			/* Clamp calculated values to actual minimum */
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4823  			for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4824  				for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4825  					if (v->DCFCLKState[i][j] < mode_lib->soc.min_dcfclk) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4826  						v->DCFCLKState[i][j] = mode_lib->soc.min_dcfclk;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4827  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4828  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4829  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4830  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4831  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4832  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4833  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4834  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4835  			v->IdealSDPPortBandwidthPerState[i][j] = dml_min3(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4836  					v->ReturnBusWidth * v->DCFCLKState[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4837  					v->DRAMSpeedPerState[i] * v->NumberOfChannels * v->DRAMChannelWidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4838  					v->FabricClockPerState[i] * v->FabricDatapathToDCNDataReturn);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4839  			if (v->HostVMEnable != true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4840  				v->ReturnBWPerState[i][j] = v->IdealSDPPortBandwidthPerState[i][j] * v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelDataOnly
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4841  						/ 100;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4842  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4843  				v->ReturnBWPerState[i][j] = v->IdealSDPPortBandwidthPerState[i][j]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4844  						* v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData / 100;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4845  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4846  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4847  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4848  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4849  	//Re-ordering Buffer Support Check
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4850  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4851  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4852  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4853  			if ((v->ROBBufferSizeInKByte - v->PixelChunkSizeInKByte) * 1024 / v->ReturnBWPerState[i][j]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4854  					> (v->RoundTripPingLatencyCycles + 32) / v->DCFCLKState[i][j] + ReorderingBytes / v->ReturnBWPerState[i][j]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4855  				v->ROBSupport[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4856  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4857  				v->ROBSupport[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4858  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4859  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4860  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4861  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4862  	//Vertical Active BW support check
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4863  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4864  	MaxTotalVActiveRDBandwidth = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4865  	for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4866  		MaxTotalVActiveRDBandwidth = MaxTotalVActiveRDBandwidth + v->ReadBandwidthLuma[k] + v->ReadBandwidthChroma[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4867  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4868  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4869  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4870  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4871  			v->MaxTotalVerticalActiveAvailableBandwidth[i][j] = dml_min(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4872  					v->IdealSDPPortBandwidthPerState[i][j] * v->MaxAveragePercentOfIdealSDPPortBWDisplayCanUseInNormalSystemOperation / 100,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4873  					v->DRAMSpeedPerState[i] * v->NumberOfChannels * v->DRAMChannelWidth * v->MaxAveragePercentOfIdealDRAMBWDisplayCanUseInNormalSystemOperation
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4874  							/ 100);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4875  			if (MaxTotalVActiveRDBandwidth <= v->MaxTotalVerticalActiveAvailableBandwidth[i][j]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4876  				v->TotalVerticalActiveBandwidthSupport[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4877  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4878  				v->TotalVerticalActiveBandwidthSupport[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4879  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4880  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4881  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4882  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4883  	//Prefetch Check
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4884  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4885  	for (i = 0; i < mode_lib->soc.num_states; ++i) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4886  		for (j = 0; j <= 1; ++j) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4887  			int NextPrefetchModeState = MinPrefetchMode;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4888  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4889  			v->TimeCalc = 24 / v->ProjectedDCFCLKDeepSleep[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4890  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4891  			v->BandwidthWithoutPrefetchSupported[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4892  			if (v->TotalVActivePixelBandwidth[i][j] + v->TotalVActiveCursorBandwidth[i][j] + v->TotalMetaRowBandwidth[i][j] + v->TotalDPTERowBandwidth[i][j]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4893  					> v->ReturnBWPerState[i][j] || v->NotUrgentLatencyHiding[i][j]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4894  				v->BandwidthWithoutPrefetchSupported[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4895  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4896  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4897  			for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4898  				v->NoOfDPPThisState[k] = v->NoOfDPP[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4899  				v->swath_width_luma_ub_this_state[k] = v->swath_width_luma_ub_all_states[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4900  				v->swath_width_chroma_ub_this_state[k] = v->swath_width_chroma_ub_all_states[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4901  				v->SwathWidthYThisState[k] = v->SwathWidthYAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4902  				v->SwathWidthCThisState[k] = v->SwathWidthCAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4903  				v->SwathHeightYThisState[k] = v->SwathHeightYAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4904  				v->SwathHeightCThisState[k] = v->SwathHeightCAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4905  				v->DETBufferSizeYThisState[k] = v->DETBufferSizeYAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4906  				v->DETBufferSizeCThisState[k] = v->DETBufferSizeCAllStates[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4907  				v->ODMCombineEnabled[k] = v->ODMCombineEnablePerState[i][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4908  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4909  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4910  			v->ExtraLatency = CalculateExtraLatency(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4911  					v->RoundTripPingLatencyCycles,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4912  					ReorderingBytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4913  					v->DCFCLKState[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4914  					v->TotalNumberOfActiveDPP[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4915  					v->PixelChunkSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4916  					v->TotalNumberOfDCCActiveDPP[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4917  					v->MetaChunkSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4918  					v->ReturnBWPerState[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4919  					v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4920  					v->HostVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4921  					v->NumberOfActivePlanes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4922  					v->NoOfDPPThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4923  					v->dpte_group_bytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4924  					v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4925  					v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4926  					v->HostVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4927  					v->HostVMMaxNonCachedPageTableLevels);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4928  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4929  			v->NextMaxVStartup = v->MaxMaxVStartup[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4930  			do {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4931  				v->PrefetchModePerState[i][j] = NextPrefetchModeState;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4932  				v->MaxVStartup = v->NextMaxVStartup;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4933  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4934  				v->TWait = CalculateTWait(v->PrefetchModePerState[i][j], v->FinalDRAMClockChangeLatency, v->UrgLatency[i], v->SREnterPlusExitTime);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4935  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4936  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4937  					Pipe myPipe = { 0 };
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4938  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4939  					myPipe.DPPCLK = v->RequiredDPPCLK[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4940  					myPipe.DISPCLK = v->RequiredDISPCLK[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4941  					myPipe.PixelClock = v->PixelClock[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4942  					myPipe.DCFCLKDeepSleep = v->ProjectedDCFCLKDeepSleep[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4943  					myPipe.DPPPerPlane = v->NoOfDPP[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4944  					myPipe.ScalerEnabled = v->ScalerEnabled[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4945  					myPipe.SourceScan = v->SourceScan[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4946  					myPipe.BlockWidth256BytesY = v->Read256BlockWidthY[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4947  					myPipe.BlockHeight256BytesY = v->Read256BlockHeightY[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4948  					myPipe.BlockWidth256BytesC = v->Read256BlockWidthC[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4949  					myPipe.BlockHeight256BytesC = v->Read256BlockHeightC[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4950  					myPipe.InterlaceEnable = v->Interlace[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4951  					myPipe.NumberOfCursors = v->NumberOfCursors[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4952  					myPipe.VBlank = v->VTotal[k] - v->VActive[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4953  					myPipe.HTotal = v->HTotal[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4954  					myPipe.DCCEnable = v->DCCEnable[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4955  					myPipe.ODMCombineEnabled = !!v->ODMCombineEnabled[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4956  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4957  					v->NoTimeForPrefetch[i][j][k] = CalculatePrefetchSchedule(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4958  							mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4959  							v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4960  							v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4961  							&myPipe,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4962  							v->DSCDelayPerState[i][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4963  							v->DPPCLKDelaySubtotal + v->DPPCLKDelayCNVCFormater,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4964  							v->DPPCLKDelaySCL,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4965  							v->DPPCLKDelaySCLLBOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4966  							v->DPPCLKDelayCNVCCursor,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4967  							v->DISPCLKDelaySubtotal,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4968  							v->SwathWidthYThisState[k] / v->HRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4969  							v->OutputFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4970  							v->MaxInterDCNTileRepeaters,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4971  							dml_min(v->MaxVStartup, v->MaximumVStartup[i][j][k]),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4972  							v->MaximumVStartup[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4973  							v->GPUVMMaxPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4974  							v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4975  							v->HostVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4976  							v->HostVMMaxNonCachedPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4977  							v->HostVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4978  							v->DynamicMetadataEnable[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4979  							v->DynamicMetadataVMEnabled,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4980  							v->DynamicMetadataLinesBeforeActiveRequired[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4981  							v->DynamicMetadataTransmittedBytes[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4982  							v->UrgLatency[i],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4983  							v->ExtraLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4984  							v->TimeCalc,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4985  							v->PDEAndMetaPTEBytesPerFrame[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4986  							v->MetaRowBytes[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4987  							v->DPTEBytesPerRow[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4988  							v->PrefetchLinesY[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4989  							v->SwathWidthYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4990  							v->BytePerPixelY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4991  							v->PrefillY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4992  							v->MaxNumSwY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4993  							v->PrefetchLinesC[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4994  							v->SwathWidthCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4995  							v->BytePerPixelC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4996  							v->PrefillC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4997  							v->MaxNumSwC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4998  							v->swath_width_luma_ub_this_state[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  4999  							v->swath_width_chroma_ub_this_state[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5000  							v->SwathHeightYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5001  							v->SwathHeightCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5002  							v->TWait,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5003  							v->ProgressiveToInterlaceUnitInOPP,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5004  							&v->DSTXAfterScaler[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5005  							&v->DSTYAfterScaler[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5006  							&v->LineTimesForPrefetch[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5007  							&v->PrefetchBW[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5008  							&v->LinesForMetaPTE[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5009  							&v->LinesForMetaAndDPTERow[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5010  							&v->VRatioPreY[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5011  							&v->VRatioPreC[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5012  							&v->RequiredPrefetchPixelDataBWLuma[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5013  							&v->RequiredPrefetchPixelDataBWChroma[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5014  							&v->NoTimeForDynamicMetadata[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5015  							&v->Tno_bw[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5016  							&v->prefetch_vmrow_bw[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5017  							&v->Tdmdl_vm[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5018  							&v->Tdmdl[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5019  							&v->VUpdateOffsetPix[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5020  							&v->VUpdateWidthPix[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5021  							&v->VReadyOffsetPix[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5022  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5023  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5024  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5025  					CalculateUrgentBurstFactor(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5026  							v->swath_width_luma_ub_this_state[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5027  							v->swath_width_chroma_ub_this_state[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5028  							v->DETBufferSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5029  							v->SwathHeightYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5030  							v->SwathHeightCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5031  							v->HTotal[k] / v->PixelClock[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5032  							v->UrgentLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5033  							v->CursorBufferSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5034  							v->CursorWidth[k][0],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5035  							v->CursorBPP[k][0],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5036  							v->VRatioPreY[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5037  							v->VRatioPreC[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5038  							v->BytePerPixelInDETY[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5039  							v->BytePerPixelInDETC[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5040  							v->DETBufferSizeYThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5041  							v->DETBufferSizeCThisState[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5042  							&v->UrgentBurstFactorCursorPre[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5043  							&v->UrgentBurstFactorLumaPre[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5044  							&v->UrgentBurstFactorChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5045  							&v->NoUrgentLatencyHidingPre[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5046  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5047  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5048  				v->MaximumReadBandwidthWithPrefetch = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5049  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5050  					v->cursor_bw_pre[k] = v->NumberOfCursors[k] * v->CursorWidth[k][0] * v->CursorBPP[k][0] / 8.0 / (v->HTotal[k] / v->PixelClock[k])
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5051  							* v->VRatioPreY[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5052  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5053  					v->MaximumReadBandwidthWithPrefetch = v->MaximumReadBandwidthWithPrefetch
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5054  							+ dml_max4(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5055  									v->VActivePixelBandwidth[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5056  									v->VActiveCursorBandwidth[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5057  											+ v->NoOfDPP[i][j][k] * (v->meta_row_bandwidth[i][j][k] + v->dpte_row_bandwidth[i][j][k]),
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5058  									v->NoOfDPP[i][j][k] * v->prefetch_vmrow_bw[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5059  									v->NoOfDPP[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5060  											* (v->RequiredPrefetchPixelDataBWLuma[i][j][k] * v->UrgentBurstFactorLumaPre[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5061  													+ v->RequiredPrefetchPixelDataBWChroma[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5062  															* v->UrgentBurstFactorChromaPre[k])
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5063  											+ v->cursor_bw_pre[k] * v->UrgentBurstFactorCursorPre[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5064  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5065  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5066  				v->NotEnoughUrgentLatencyHidingPre = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5067  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5068  					if (v->NoUrgentLatencyHidingPre[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5069  						v->NotEnoughUrgentLatencyHidingPre = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5070  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5071  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5072  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5073  				v->PrefetchSupported[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5074  				if (v->BandwidthWithoutPrefetchSupported[i][j] == false || v->MaximumReadBandwidthWithPrefetch > v->ReturnBWPerState[i][j]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5075  						|| v->NotEnoughUrgentLatencyHidingPre == 1) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5076  					v->PrefetchSupported[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5077  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5078  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5079  					if (v->LineTimesForPrefetch[k] < 2.0 || v->LinesForMetaPTE[k] >= 32.0 || v->LinesForMetaAndDPTERow[k] >= 16.0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5080  							|| v->NoTimeForPrefetch[i][j][k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5081  						v->PrefetchSupported[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5082  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5083  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5084  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5085  				v->DynamicMetadataSupported[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5086  				for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5087  					if (v->NoTimeForDynamicMetadata[i][j][k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5088  						v->DynamicMetadataSupported[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5089  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5090  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5091  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5092  				v->VRatioInPrefetchSupported[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5093  				for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5094  					if (v->VRatioPreY[i][j][k] > 4.0 || v->VRatioPreC[i][j][k] > 4.0 || v->NoTimeForPrefetch[i][j][k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5095  						v->VRatioInPrefetchSupported[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5096  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5097  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5098  				v->AnyLinesForVMOrRowTooLarge = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5099  				for (k = 0; k < v->NumberOfActivePlanes; ++k) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5100  					if (v->LinesForMetaAndDPTERow[k] >= 16 || v->LinesForMetaPTE[k] >= 32) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5101  						v->AnyLinesForVMOrRowTooLarge = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5102  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5103  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5104  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5105  				if (v->PrefetchSupported[i][j] == true && v->VRatioInPrefetchSupported[i][j] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5106  					v->BandwidthAvailableForImmediateFlip = v->ReturnBWPerState[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5107  					for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5108  						v->BandwidthAvailableForImmediateFlip = v->BandwidthAvailableForImmediateFlip
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5109  								- dml_max(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5110  										v->VActivePixelBandwidth[i][j][k] + v->VActiveCursorBandwidth[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5111  										v->NoOfDPP[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5112  												* (v->RequiredPrefetchPixelDataBWLuma[i][j][k] * v->UrgentBurstFactorLumaPre[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5113  														+ v->RequiredPrefetchPixelDataBWChroma[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5114  																* v->UrgentBurstFactorChromaPre[k])
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5115  												+ v->cursor_bw_pre[k] * v->UrgentBurstFactorCursorPre[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5116  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5117  					v->TotImmediateFlipBytes = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5118  					for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5119  						v->TotImmediateFlipBytes = v->TotImmediateFlipBytes + v->NoOfDPP[i][j][k] * v->PDEAndMetaPTEBytesPerFrame[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5120  								+ v->MetaRowBytes[i][j][k] + v->DPTEBytesPerRow[i][j][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5121  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5122  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5123  					for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5124  						CalculateFlipSchedule(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5125  								mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5126  								v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyPixelMixedWithVMData,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5127  								v->PercentOfIdealDRAMFabricAndSDPPortBWReceivedAfterUrgLatencyVMDataOnly,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5128  								v->ExtraLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5129  								v->UrgLatency[i],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5130  								v->GPUVMMaxPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5131  								v->HostVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5132  								v->HostVMMaxNonCachedPageTableLevels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5133  								v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5134  								v->HostVMMinPageSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5135  								v->PDEAndMetaPTEBytesPerFrame[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5136  								v->MetaRowBytes[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5137  								v->DPTEBytesPerRow[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5138  								v->BandwidthAvailableForImmediateFlip,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5139  								v->TotImmediateFlipBytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5140  								v->SourcePixelFormat[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5141  								v->HTotal[k] / v->PixelClock[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5142  								v->VRatio[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5143  								v->VRatioChroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5144  								v->Tno_bw[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5145  								v->DCCEnable[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5146  								v->dpte_row_height[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5147  								v->meta_row_height[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5148  								v->dpte_row_height_chroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5149  								v->meta_row_height_chroma[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5150  								&v->DestinationLinesToRequestVMInImmediateFlip[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5151  								&v->DestinationLinesToRequestRowInImmediateFlip[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5152  								&v->final_flip_bw[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5153  								&v->ImmediateFlipSupportedForPipe[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5154  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5155  					v->total_dcn_read_bw_with_flip = 0.0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5156  					for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5157  						v->total_dcn_read_bw_with_flip = v->total_dcn_read_bw_with_flip
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5158  								+ dml_max3(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5159  										v->NoOfDPP[i][j][k] * v->prefetch_vmrow_bw[k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5160  										v->NoOfDPP[i][j][k] * v->final_flip_bw[k] + v->VActivePixelBandwidth[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5161  												+ v->VActiveCursorBandwidth[i][j][k],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5162  										v->NoOfDPP[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5163  												* (v->final_flip_bw[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5164  														+ v->RequiredPrefetchPixelDataBWLuma[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5165  																* v->UrgentBurstFactorLumaPre[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5166  														+ v->RequiredPrefetchPixelDataBWChroma[i][j][k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5167  																* v->UrgentBurstFactorChromaPre[k])
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5168  												+ v->cursor_bw_pre[k] * v->UrgentBurstFactorCursorPre[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5169  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5170  					v->ImmediateFlipSupportedForState[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5171  					if (v->total_dcn_read_bw_with_flip > v->ReturnBWPerState[i][j]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5172  						v->ImmediateFlipSupportedForState[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5173  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5174  					for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5175  						if (v->ImmediateFlipSupportedForPipe[k] == false) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5176  							v->ImmediateFlipSupportedForState[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5177  						}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5178  					}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5179  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5180  					v->ImmediateFlipSupportedForState[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5181  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5182  				if (v->MaxVStartup <= 13 || v->AnyLinesForVMOrRowTooLarge == false) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5183  					v->NextMaxVStartup = v->MaxMaxVStartup[i][j];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5184  					NextPrefetchModeState = NextPrefetchModeState + 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5185  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5186  					v->NextMaxVStartup = v->NextMaxVStartup - 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5187  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5188  			} while (!((v->PrefetchSupported[i][j] == true && v->DynamicMetadataSupported[i][j] == true && v->VRatioInPrefetchSupported[i][j] == true
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5189  					&& ((v->HostVMEnable == false && v->ImmediateFlipRequirement != dm_immediate_flip_required)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5190  							|| v->ImmediateFlipSupportedForState[i][j] == true))
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5191  					|| (v->NextMaxVStartup == v->MaxMaxVStartup[i][j] && NextPrefetchModeState > MaxPrefetchMode)));
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5192  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5193  			CalculateWatermarksAndDRAMSpeedChangeSupport(
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5194  					mode_lib,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5195  					v->PrefetchModePerState[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5196  					v->NumberOfActivePlanes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5197  					v->MaxLineBufferLines,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5198  					v->LineBufferSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5199  					v->DPPOutputBufferPixels,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5200  					v->DETBufferSizeInKByte,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5201  					v->WritebackInterfaceBufferSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5202  					v->DCFCLKState[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5203  					v->ReturnBWPerState[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5204  					v->GPUVMEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5205  					v->dpte_group_bytes,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5206  					v->MetaChunkSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5207  					v->UrgLatency[i],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5208  					v->ExtraLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5209  					v->WritebackLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5210  					v->WritebackChunkSize,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5211  					v->SOCCLKPerState[i],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5212  					v->FinalDRAMClockChangeLatency,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5213  					v->SRExitTime,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5214  					v->SREnterPlusExitTime,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5215  					v->ProjectedDCFCLKDeepSleep[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5216  					v->NoOfDPPThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5217  					v->DCCEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5218  					v->RequiredDPPCLKThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5219  					v->DETBufferSizeYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5220  					v->DETBufferSizeCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5221  					v->SwathHeightYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5222  					v->SwathHeightCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5223  					v->LBBitPerPixel,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5224  					v->SwathWidthYThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5225  					v->SwathWidthCThisState,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5226  					v->HRatio,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5227  					v->HRatioChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5228  					v->vtaps,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5229  					v->VTAPsChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5230  					v->VRatio,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5231  					v->VRatioChroma,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5232  					v->HTotal,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5233  					v->PixelClock,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5234  					v->BlendingAndTiming,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5235  					v->BytePerPixelInDETY,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5236  					v->BytePerPixelInDETC,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5237  					v->DSTXAfterScaler,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5238  					v->DSTYAfterScaler,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5239  					v->WritebackEnable,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5240  					v->WritebackPixelFormat,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5241  					v->WritebackDestinationWidth,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5242  					v->WritebackDestinationHeight,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5243  					v->WritebackSourceHeight,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5244  					&v->DRAMClockChangeSupport[i][j],
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5245  					&v->UrgentWatermark,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5246  					&v->WritebackUrgentWatermark,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5247  					&v->DRAMClockChangeWatermark,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5248  					&v->WritebackDRAMClockChangeWatermark,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5249  					&v->StutterExitWatermark,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5250  					&v->StutterEnterPlusExitWatermark,
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5251  					&v->MinActiveDRAMClockChangeLatencySupported);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5252  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5253  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5254  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5255  	/*PTE Buffer Size Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5256  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5257  	for (i = 0; i < v->soc.num_states; i++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5258  		for (j = 0; j < 2; j++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5259  			v->PTEBufferSizeNotExceeded[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5260  			for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5261  				if (v->PTEBufferSizeNotExceededY[i][j][k] == false || v->PTEBufferSizeNotExceededC[i][j][k] == false) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5262  					v->PTEBufferSizeNotExceeded[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5263  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5264  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5265  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5266  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5267  	/*Cursor Support Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5268  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5269  	v->CursorSupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5270  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5271  		if (v->CursorWidth[k][0] > 0.0) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5272  			if (v->CursorBPP[k][0] == 64 && v->Cursor64BppSupport == false) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5273  				v->CursorSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5274  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5275  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5276  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5277  	/*Valid Pitch Check*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5278  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5279  	v->PitchSupport = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5280  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5281  		v->AlignedYPitch[k] = dml_ceil(dml_max(v->PitchY[k], v->SurfaceWidthY[k]), v->MacroTileWidthY[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5282  		if (v->DCCEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5283  			v->AlignedDCCMetaPitchY[k] = dml_ceil(dml_max(v->DCCMetaPitchY[k], v->SurfaceWidthY[k]), 64.0 * v->Read256BlockWidthY[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5284  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5285  			v->AlignedDCCMetaPitchY[k] = v->DCCMetaPitchY[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5286  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5287  		if (v->SourcePixelFormat[k] != dm_444_64 && v->SourcePixelFormat[k] != dm_444_32 && v->SourcePixelFormat[k] != dm_444_16 && v->SourcePixelFormat[k] != dm_mono_16
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5288  				&& v->SourcePixelFormat[k] != dm_rgbe && v->SourcePixelFormat[k] != dm_mono_8) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5289  			v->AlignedCPitch[k] = dml_ceil(dml_max(v->PitchC[k], v->SurfaceWidthC[k]), v->MacroTileWidthC[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5290  			if (v->DCCEnable[k] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5291  				v->AlignedDCCMetaPitchC[k] = dml_ceil(dml_max(v->DCCMetaPitchC[k], v->SurfaceWidthC[k]), 64.0 * v->Read256BlockWidthC[k]);
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5292  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5293  				v->AlignedDCCMetaPitchC[k] = v->DCCMetaPitchC[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5294  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5295  		} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5296  			v->AlignedCPitch[k] = v->PitchC[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5297  			v->AlignedDCCMetaPitchC[k] = v->DCCMetaPitchC[k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5298  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5299  		if (v->AlignedYPitch[k] > v->PitchY[k] || v->AlignedCPitch[k] > v->PitchC[k] || v->AlignedDCCMetaPitchY[k] > v->DCCMetaPitchY[k]
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5300  				|| v->AlignedDCCMetaPitchC[k] > v->DCCMetaPitchC[k]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5301  			v->PitchSupport = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5302  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5303  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5304  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5305  	for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5306  		if (v->ViewportWidth[k] > v->SurfaceWidthY[k] || v->ViewportHeight[k] > v->SurfaceHeightY[k])
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5307  			ViewportExceedsSurface = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5308  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5309  		if (v->SourcePixelFormat[k] != dm_444_64 && v->SourcePixelFormat[k] != dm_444_32 && v->SourcePixelFormat[k] != dm_444_16
71f49c4898eef4 Ye Bin             2020-09-17  5310  				&& v->SourcePixelFormat[k] != dm_444_8 && v->SourcePixelFormat[k] != dm_rgbe) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5311  			if (v->ViewportWidthChroma[k] > v->SurfaceWidthC[k] || v->ViewportHeightChroma[k] > v->SurfaceHeightC[k]) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5312  				ViewportExceedsSurface = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5313  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5314  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5315  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5316  	/*Mode Support, Voltage State and SOC Configuration*/
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5317  
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5318  	for (i = v->soc.num_states - 1; i >= 0; i--) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5319  		for (j = 0; j < 2; j++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5320  			if (v->ScaleRatioAndTapsSupport == 1 && v->SourceFormatPixelAndScanSupport == 1 && v->ViewportSizeSupport[i][j] == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5321  					&& v->DIOSupport[i] == 1 && v->ODMCombine4To1SupportCheckOK[i] == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5322  					&& v->NotEnoughDSCUnits[i] == 0 && v->DSCCLKRequiredMoreThanSupported[i] == 0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5323  					&& v->DTBCLKRequiredMoreThanSupported[i] == 0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5324  					&& v->ROBSupport[i][j] == 1 && v->DISPCLK_DPPCLK_Support[i][j] == 1 && v->TotalAvailablePipesSupport[i][j] == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5325  					&& EnoughWritebackUnits == 1 && WritebackModeSupport == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5326  					&& v->WritebackLatencySupport == 1 && v->WritebackScaleRatioAndTapsSupport == 1 && v->CursorSupport == 1 && v->PitchSupport == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5327  					&& ViewportExceedsSurface == 0 && v->PrefetchSupported[i][j] == 1 && v->DynamicMetadataSupported[i][j] == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5328  					&& v->TotalVerticalActiveBandwidthSupport[i][j] == 1 && v->VRatioInPrefetchSupported[i][j] == 1
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5329  					&& v->PTEBufferSizeNotExceeded[i][j] == 1 && v->NonsupportedDSCInputBPC == 0
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5330  					&& ((v->HostVMEnable == 0 && v->ImmediateFlipRequirement != dm_immediate_flip_required)
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5331  							|| v->ImmediateFlipSupportedForState[i][j] == true)) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5332  				v->ModeSupport[i][j] = true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5333  			} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5334  				v->ModeSupport[i][j] = false;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5335  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5336  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5337  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5338  	{
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5339  		unsigned int MaximumMPCCombine = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5340  		for (i = v->soc.num_states; i >= 0; i--) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5341  			if (i == v->soc.num_states || v->ModeSupport[i][0] == true || v->ModeSupport[i][1] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5342  				v->VoltageLevel = i;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5343  				v->ModeIsSupported = v->ModeSupport[i][0] == true || v->ModeSupport[i][1] == true;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5344  				if (v->ModeSupport[i][1] == true) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5345  					MaximumMPCCombine = 1;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5346  				} else {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5347  					MaximumMPCCombine = 0;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5348  				}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5349  			}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5350  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5351  		v->ImmediateFlipSupport = v->ImmediateFlipSupportedForState[v->VoltageLevel][MaximumMPCCombine];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5352  		for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5353  			v->MPCCombineEnable[k] = v->MPCCombine[v->VoltageLevel][MaximumMPCCombine][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5354  			v->DPPPerPlane[k] = v->NoOfDPP[v->VoltageLevel][MaximumMPCCombine][k];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5355  		}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5356  		v->DCFCLK = v->DCFCLKState[v->VoltageLevel][MaximumMPCCombine];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5357  		v->DRAMSpeed = v->DRAMSpeedPerState[v->VoltageLevel];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5358  		v->FabricClock = v->FabricClockPerState[v->VoltageLevel];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5359  		v->SOCCLK = v->SOCCLKPerState[v->VoltageLevel];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5360  		v->ReturnBW = v->ReturnBWPerState[v->VoltageLevel][MaximumMPCCombine];
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5361  		v->maxMpcComb = MaximumMPCCombine;
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5362  	}
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5363  }
6725a88f88a7e9 Bhawanpreet Lakha  2020-05-21  5364  

:::::: The code at line 3641 was first introduced by commit
:::::: 6725a88f88a7e922e91c45bf83d320487810c192 drm/amd/display: Add DCN3 DML

:::::: TO: Bhawanpreet Lakha <Bhawanpreet.Lakha@....com>
:::::: CC: Alex Deucher <alexander.deucher@....com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (28952 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ