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: <202010261250.hwc1OKsw-lkp@intel.com>
Date:   Mon, 26 Oct 2020 12:07:53 +0800
From:   kernel test robot <lkp@...el.com>
To:     Bhawanpreet Lakha <Bhawanpreet.Lakha@....com>
Cc:     kbuild-all@...ts.01.org, clang-built-linux@...glegroups.com,
        linux-kernel@...r.kernel.org,
        Alex Deucher <alexander.deucher@....com>
Subject: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3640:6:
 warning: stack frame size of 2104 bytes in function
 'dml30_ModeSupportAndSystemConfigurationFull'

Hi Bhawanpreet,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   3650b228f83adda7e5ee532e2b90429c03f7b9ec
commit: 96134346bb6ae3f212617dd66a1105250f31a7ef drm/amd/display: Add DCN3 to Kconfig
date:   4 months ago
config: x86_64-randconfig-r003-20201026 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1c8371692dfe8245bc6690ff1262dcced4649d21)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=96134346bb6ae3f212617dd66a1105250f31a7ef
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 96134346bb6ae3f212617dd66a1105250f31a7ef
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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 >>):

>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn30/display_mode_vba_30.c:3640:6: warning: stack frame size of 2104 bytes in function 'dml30_ModeSupportAndSystemConfigurationFull' [-Wframe-larger-than=]
   void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_lib)
        ^
   1 warning generated.

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

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

:::::: The code at line 3640 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" (34157 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ