XilinxProcessorIPLib/drivers/dp14txss/examples/src/zcu_pt_dp14_mst/xvid_pat_gen.c
static void VidgenSetConfig(XDp *InstancePtr, Vpg_VidgenConfig *VidgenConfig,
				u8 Stream, u8 VSplitMode, u8 first_time)
{
	XDp_TxMainStreamAttributes *MsaConfig =
			&InstancePtr->TxInstance.MsaConfig[Stream - 1];
	XDp_TxLinkConfig *LinkConfig = &InstancePtr->TxInstance.LinkConfig;
	u32 UserPixelWidth;
	u8 DSBypass;
	XVidC_VideoMode VmId;
//	u32 Status;
    u32 Count = 0;
	VmId = MsaConfig->Vtm.VmId;

	/* Configure MSA values from the Display Monitor Timing (DMT) table.
	 * Will provide a way to optionally acquire these values from the EDID
	 * of the sink.
	 */
	VidgenConfig->MVid = MsaConfig->PixelClockHz / 1000;
	VidgenConfig->VidClkSel =
			(LinkConfig->LinkRate == (XDP_TX_LINK_BW_SET_270GBPS));

	UserPixelWidth = MsaConfig->UserPixelWidth;
	VidgenConfig->Misc0 = MsaConfig->Misc0;
	VidgenConfig->Misc1 = MsaConfig->Misc1;
#if !NEW_PAT_GEN
	VidgenConfig->DePolarity = 0x0;
	VidgenConfig->FrameLock0 = 0;
	VidgenConfig->FrameLock1 = 0;
	VidgenConfig->HdColorBarMode = 0;


	VidgenConfig->Timing.VSyncPolarity =
					MsaConfig->Vtm.Timing.VSyncPolarity;
	VidgenConfig->Timing.HSyncPolarity =
					MsaConfig->Vtm.Timing.HSyncPolarity;
	VidgenConfig->Timing.F0PVSyncWidth =
					MsaConfig->Vtm.Timing.F0PVSyncWidth;
	VidgenConfig->Timing.F0PVBackPorch =
					MsaConfig->Vtm.Timing.F0PVBackPorch;
	VidgenConfig->Timing.F0PVFrontPorch =
					MsaConfig->Vtm.Timing.F0PVFrontPorch;
	VidgenConfig->Timing.VActive = MsaConfig->Vtm.Timing.VActive;

	/* In Vertical frame split mode double the Horizontal parameters to
	* VPG
	*/
	if ((VmId == XVIDC_VM_UHD2_60_P) && VSplitMode) {
		/* Re-compute horizontal values based on user pixel width. */
		VidgenConfig->Timing.HActive =
			MsaConfig->Vtm.Timing.HActive * 2 / UserPixelWidth;
		VidgenConfig->Timing.HBackPorch =
			MsaConfig->Vtm.Timing.HBackPorch * 2 / UserPixelWidth;
		VidgenConfig->Timing.HFrontPorch =
			MsaConfig->Vtm.Timing.HFrontPorch * 2 / UserPixelWidth;
		VidgenConfig->Timing.HSyncWidth =
			MsaConfig->Vtm.Timing.HSyncWidth * 2 / UserPixelWidth;

		VidgenConfig->MVid /= 2;
		DSBypass = 0;
	}
	else {
		/* Re-compute horizontal values based on user pixel width. */
		VidgenConfig->Timing.HActive =
			MsaConfig->Vtm.Timing.HActive / UserPixelWidth;
		VidgenConfig->Timing.HBackPorch =
			MsaConfig->Vtm.Timing.HBackPorch / UserPixelWidth;
		VidgenConfig->Timing.HFrontPorch =
			MsaConfig->Vtm.Timing.HFrontPorch / UserPixelWidth;
		VidgenConfig->Timing.HSyncWidth =
			MsaConfig->Vtm.Timing.HSyncWidth / UserPixelWidth;

		VidgenConfig->MVid /= UserPixelWidth;
		DSBypass = 1;
	}

	if (DSBypass == 1) {
		VidgenConfig->DSMode = 0;
	}
	else {
		VidgenConfig->DSMode = 1;
	}

	/* Configure the pattern generator. */
	VidgenConfig->TcHsBlnk = VidgenConfig->Timing.HActive - 1;
	VidgenConfig->TcHsSync = VidgenConfig->Timing.HActive +
				VidgenConfig->Timing.HFrontPorch - 1 ;
	VidgenConfig->TcHeSync = VidgenConfig->Timing.HActive +
				VidgenConfig->Timing.HFrontPorch +
				VidgenConfig->Timing.HSyncWidth - 1;
	VidgenConfig->TcHeBlnk = VidgenConfig->Timing.HActive +
				VidgenConfig->Timing.HFrontPorch +
				VidgenConfig->Timing.HSyncWidth +
				VidgenConfig->Timing.HBackPorch - 1;
	VidgenConfig->TcVsBlnk = VidgenConfig->Timing.VActive - 1;
	VidgenConfig->TcVsSync = VidgenConfig->Timing.VActive +
				VidgenConfig->Timing.F0PVFrontPorch - 1;
	VidgenConfig->TcVeSync = VidgenConfig->Timing.VActive +
				VidgenConfig->Timing.F0PVFrontPorch +
				VidgenConfig->Timing.F0PVSyncWidth - 1;
	VidgenConfig->Timing.F0PVTotal = VidgenConfig->Timing.VActive +
				VidgenConfig->Timing.F0PVFrontPorch +
				VidgenConfig->Timing.F0PVSyncWidth +
				VidgenConfig->Timing.F0PVBackPorch - 1;
#else

	VidgenConfig->Timing.VActive = MsaConfig->Vtm.Timing.VActive;
	VidgenConfig->Timing.HActive =
		MsaConfig->Vtm.Timing.HActive / 4;

#endif
}
/*****************************************************************************/
/**
*
* This function calculates video pattern generator parameters.
*
* @param	InstancePtr is a pointer to the XDp instance.
* @param	VidgenConfig is a pointer to Vpg_VidgenConfig that will be
*		used to timing parameters.
* @param	Stream is the stream number that will be used to ret rive
*		MSA parameters.
* @param	VSplitMode specifies vertical split mode to be used for
*		splitting resolution vertically.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function calculates video pattern generator parameters.
This function calculates video pattern generator parameters .
static void VidgenSetConfig(XDp *InstancePtr, Vpg_VidgenConfig *VidgenConfig,
				u8 Stream, u8 VSplitMode, u8 first_time)
{
	XDp_TxMainStreamAttributes *MsaConfig =
			&InstancePtr->TxInstance.MsaConfig[Stream - 1];
	XDp_TxLinkConfig *LinkConfig = &InstancePtr->TxInstance.LinkConfig;
	u32 UserPixelWidth;
	u8 DSBypass;
	XVidC_VideoMode VmId;
    u32 Count = 0;
	VmId = MsaConfig->Vtm.VmId;
	VidgenConfig->MVid = MsaConfig->PixelClockHz / 1000;
	VidgenConfig->VidClkSel =
			(LinkConfig->LinkRate == (XDP_TX_LINK_BW_SET_270GBPS));
	UserPixelWidth = MsaConfig->UserPixelWidth;
	VidgenConfig->Misc0 = MsaConfig->Misc0;
	VidgenConfig->Misc1 = MsaConfig->Misc1;
#if !NEW_PAT_GEN
	VidgenConfig->DePolarity = 0x0;
	VidgenConfig->FrameLock0 = 0;
	VidgenConfig->FrameLock1 = 0;
	VidgenConfig->HdColorBarMode = 0;
	VidgenConfig->Timing.VSyncPolarity =
					MsaConfig->Vtm.Timing.VSyncPolarity;
	VidgenConfig->Timing.HSyncPolarity =
					MsaConfig->Vtm.Timing.HSyncPolarity;
	VidgenConfig->Timing.F0PVSyncWidth =
					MsaConfig->Vtm.Timing.F0PVSyncWidth;
	VidgenConfig->Timing.F0PVBackPorch =
					MsaConfig->Vtm.Timing.F0PVBackPorch;
	VidgenConfig->Timing.F0PVFrontPorch =
					MsaConfig->Vtm.Timing.F0PVFrontPorch;
	VidgenConfig->Timing.VActive = MsaConfig->Vtm.Timing.VActive;
	if ((VmId == XVIDC_VM_UHD2_60_P) && VSplitMode) {
		VidgenConfig->Timing.HActive =
			MsaConfig->Vtm.Timing.HActive * 2 / UserPixelWidth;
		VidgenConfig->Timing.HBackPorch =
			MsaConfig->Vtm.Timing.HBackPorch * 2 / UserPixelWidth;
		VidgenConfig->Timing.HFrontPorch =
			MsaConfig->Vtm.Timing.HFrontPorch * 2 / UserPixelWidth;
		VidgenConfig->Timing.HSyncWidth =
			MsaConfig->Vtm.Timing.HSyncWidth * 2 / UserPixelWidth;
		VidgenConfig->MVid /= 2;
		DSBypass = 0;
	}
	else {
		VidgenConfig->Timing.HActive =
			MsaConfig->Vtm.Timing.HActive / UserPixelWidth;
		VidgenConfig->Timing.HBackPorch =
			MsaConfig->Vtm.Timing.HBackPorch / UserPixelWidth;
		VidgenConfig->Timing.HFrontPorch =
			MsaConfig->Vtm.Timing.HFrontPorch / UserPixelWidth;
		VidgenConfig->Timing.HSyncWidth =
			MsaConfig->Vtm.Timing.HSyncWidth / UserPixelWidth;
		VidgenConfig->MVid /= UserPixelWidth;
		DSBypass = 1;
	}
	if (DSBypass == 1) {
		VidgenConfig->DSMode = 0;
	}
	else {
		VidgenConfig->DSMode = 1;
	}
	VidgenConfig->TcHsBlnk = VidgenConfig->Timing.HActive - 1;
	VidgenConfig->TcHsSync = VidgenConfig->Timing.HActive +
				VidgenConfig->Timing.HFrontPorch - 1 ;
	VidgenConfig->TcHeSync = VidgenConfig->Timing.HActive +
				VidgenConfig->Timing.HFrontPorch +
				VidgenConfig->Timing.HSyncWidth - 1;
	VidgenConfig->TcHeBlnk = VidgenConfig->Timing.HActive +
				VidgenConfig->Timing.HFrontPorch +
				VidgenConfig->Timing.HSyncWidth +
				VidgenConfig->Timing.HBackPorch - 1;
	VidgenConfig->TcVsBlnk = VidgenConfig->Timing.VActive - 1;
	VidgenConfig->TcVsSync = VidgenConfig->Timing.VActive +
				VidgenConfig->Timing.F0PVFrontPorch - 1;
	VidgenConfig->TcVeSync = VidgenConfig->Timing.VActive +
				VidgenConfig->Timing.F0PVFrontPorch +
				VidgenConfig->Timing.F0PVSyncWidth - 1;
	VidgenConfig->Timing.F0PVTotal = VidgenConfig->Timing.VActive +
				VidgenConfig->Timing.F0PVFrontPorch +
				VidgenConfig->Timing.F0PVSyncWidth +
				VidgenConfig->Timing.F0PVBackPorch - 1;
#else
	VidgenConfig->Timing.VActive = MsaConfig->Vtm.Timing.VActive;
	VidgenConfig->Timing.HActive =
		MsaConfig->Vtm.Timing.HActive / 4;
#endif
}
static void VidgenSetConfig ( XDp * InstancePtr , Vpg_VidgenConfig * VidgenConfig , u8 Stream , u8 VSplitMode , u8 first_time ) { XDp_TxMainStreamAttributes * MsaConfig = & InstancePtr -> TxInstance . MsaConfig [ Stream - 1 ] ; XDp_TxLinkConfig * LinkConfig = & InstancePtr -> TxInstance . LinkConfig ; u32 UserPixelWidth ; u8 DSBypass ; XVidC_VideoMode VmId ; u32 Count = 0 ; VmId = MsaConfig -> Vtm . VmId ; VidgenConfig -> MVid = MsaConfig -> PixelClockHz / 1000 ; VidgenConfig -> VidClkSel = ( LinkConfig -> LinkRate == ( XDP_TX_LINK_BW_SET_270GBPS ) ) ; UserPixelWidth = MsaConfig -> UserPixelWidth ; VidgenConfig -> Misc0 = MsaConfig -> Misc0 ; VidgenConfig -> Misc1 = MsaConfig -> Misc1 ; #if ! NEW_PAT_GEN VidgenConfig -> DePolarity = 0x0 ; VidgenConfig -> FrameLock0 = 0 ; VidgenConfig -> FrameLock1 = 0 ; VidgenConfig -> HdColorBarMode = 0 ; VidgenConfig -> Timing . VSyncPolarity = MsaConfig -> Vtm . Timing . VSyncPolarity ; VidgenConfig -> Timing . HSyncPolarity = MsaConfig -> Vtm . Timing . HSyncPolarity ; VidgenConfig -> Timing . F0PVSyncWidth = MsaConfig -> Vtm . Timing . F0PVSyncWidth ; VidgenConfig -> Timing . F0PVBackPorch = MsaConfig -> Vtm . Timing . F0PVBackPorch ; VidgenConfig -> Timing . F0PVFrontPorch = MsaConfig -> Vtm . Timing . F0PVFrontPorch ; VidgenConfig -> Timing . VActive = MsaConfig -> Vtm . Timing . VActive ; if ( ( VmId == XVIDC_VM_UHD2_60_P ) && VSplitMode ) { VidgenConfig -> Timing . HActive = MsaConfig -> Vtm . Timing . HActive * 2 / UserPixelWidth ; VidgenConfig -> Timing . HBackPorch = MsaConfig -> Vtm . Timing . HBackPorch * 2 / UserPixelWidth ; VidgenConfig -> Timing . HFrontPorch = MsaConfig -> Vtm . Timing . HFrontPorch * 2 / UserPixelWidth ; VidgenConfig -> Timing . HSyncWidth = MsaConfig -> Vtm . Timing . HSyncWidth * 2 / UserPixelWidth ; VidgenConfig -> MVid /= 2 ; DSBypass = 0 ; } else { VidgenConfig -> Timing . HActive = MsaConfig -> Vtm . Timing . HActive / UserPixelWidth ; VidgenConfig -> Timing . HBackPorch = MsaConfig -> Vtm . Timing . HBackPorch / UserPixelWidth ; VidgenConfig -> Timing . HFrontPorch = MsaConfig -> Vtm . Timing . HFrontPorch / UserPixelWidth ; VidgenConfig -> Timing . HSyncWidth = MsaConfig -> Vtm . Timing . HSyncWidth / UserPixelWidth ; VidgenConfig -> MVid /= UserPixelWidth ; DSBypass = 1 ; } if ( DSBypass == 1 ) { VidgenConfig -> DSMode = 0 ; } else { VidgenConfig -> DSMode = 1 ; } VidgenConfig -> TcHsBlnk = VidgenConfig -> Timing . HActive - 1 ; VidgenConfig -> TcHsSync = VidgenConfig -> Timing . HActive + VidgenConfig -> Timing . HFrontPorch - 1 ; VidgenConfig -> TcHeSync = VidgenConfig -> Timing . HActive + VidgenConfig -> Timing . HFrontPorch + VidgenConfig -> Timing . HSyncWidth - 1 ; VidgenConfig -> TcHeBlnk = VidgenConfig -> Timing . HActive + VidgenConfig -> Timing . HFrontPorch + VidgenConfig -> Timing . HSyncWidth + VidgenConfig -> Timing . HBackPorch - 1 ; VidgenConfig -> TcVsBlnk = VidgenConfig -> Timing . VActive - 1 ; VidgenConfig -> TcVsSync = VidgenConfig -> Timing . VActive + VidgenConfig -> Timing . F0PVFrontPorch - 1 ; VidgenConfig -> TcVeSync = VidgenConfig -> Timing . VActive + VidgenConfig -> Timing . F0PVFrontPorch + VidgenConfig -> Timing . F0PVSyncWidth - 1 ; VidgenConfig -> Timing . F0PVTotal = VidgenConfig -> Timing . VActive + VidgenConfig -> Timing . F0PVFrontPorch + VidgenConfig -> Timing . F0PVSyncWidth + VidgenConfig -> Timing . F0PVBackPorch - 1 ; #else VidgenConfig -> Timing . VActive = MsaConfig -> Vtm . Timing . VActive ; VidgenConfig -> Timing . HActive = MsaConfig -> Vtm . Timing . HActive / 4 ; #endif }
This function calculates video pattern generator parameters.
This function calculates video pattern generator parameters .
//	u32 Status; /* Configure MSA values from the Display Monitor Timing (DMT) table.
	 * Will provide a way to optionally acquire these values from the EDID
	 * of the sink.
	 */ /* In Vertical frame split mode double the Horizontal parameters to
	* VPG
	*/ /* Re-compute horizontal values based on user pixel width. */ /* Re-compute horizontal values based on user pixel width. */ /* Configure the pattern generator. */