XilinxProcessorIPLib/drivers/dp12txss/src/xdptxss.c
static void DpTxSs_CalculateMsa(XDpTxSs *InstancePtr, u8 Stream)
{
	XDpTxSs_MainStreamAttributes *MsaConfig;
	XVidC_VideoMode VidMode;
	u32 FrameRate;
	u32 ClkFreq;
	u32 Ival;
	float Fval;
	u8 LinkRate;

	MsaConfig = &InstancePtr->DpPtr->TxInstance.MsaConfig[Stream - 1];
	LinkRate = InstancePtr->DpPtr->TxInstance.LinkConfig.LinkRate;

	/*Calculate pixel clock in HZ */
	ClkFreq = (LinkRate * 27 * MsaConfig->MVid) / MsaConfig->NVid;
	MsaConfig->PixelClockHz = ((u32)ClkFreq) * 1000000;

	/*Calculate frame rate */
	Fval = (ClkFreq * 1000000.0) / (MsaConfig->Vtm.Timing.HTotal *
                                MsaConfig->Vtm.Timing.F0PVTotal);

	Ival = (u32) Fval;

	FrameRate = (u32) (Fval == (float) Ival) ? Ival : Ival + 1;

	/* Round of frame rate */
	if ((FrameRate == 59) || (FrameRate == 61)) {
		FrameRate = 60;
	}
	else if ((FrameRate == 29) || (FrameRate == 31)) {
		FrameRate = 30;
	}
	else if ((FrameRate == 76) || (FrameRate == 74)) {
		FrameRate = 75;
	}
	MsaConfig->Vtm.FrameRate = FrameRate;

	/* Calculate horizontal front porch */
	MsaConfig->Vtm.Timing.HFrontPorch = MsaConfig->Vtm.Timing.HTotal -
			MsaConfig->HStart - MsaConfig->Vtm.Timing.HActive;

	/* Calculate horizontal back porch */
	MsaConfig->Vtm.Timing.HBackPorch = MsaConfig->HStart -
			MsaConfig->Vtm.Timing.HSyncWidth;

	/* Calculate vertical frame zero front porch */
	MsaConfig->Vtm.Timing.F0PVFrontPorch =
		MsaConfig->Vtm.Timing.F0PVTotal - MsaConfig->VStart -
			MsaConfig->Vtm.Timing.VActive;

	/* Calculate vertical frame zero back porch */
	MsaConfig->Vtm.Timing.F0PVBackPorch = MsaConfig->VStart -
			MsaConfig->Vtm.Timing.F0PVSyncWidth;

	/* Set frame 1 parameters */
	MsaConfig->Vtm.Timing.F1VFrontPorch = 0;
	MsaConfig->Vtm.Timing.F1VSyncWidth = 0;
	MsaConfig->Vtm.Timing.F1VBackPorch = 0;
	MsaConfig->Vtm.Timing.F1VTotal = 0;

	/* Check video mode is present in video common library */
	VidMode = XVidC_GetVideoModeId(MsaConfig->Vtm.Timing.HActive,
			MsaConfig->Vtm.Timing.VActive,
				MsaConfig->Vtm.FrameRate,
					XVIDC_VF_PROGRESSIVE);
	if (VidMode == XVIDC_VM_NOT_SUPPORTED) {
		MsaConfig->Vtm.VmId = XVIDC_VM_CUSTOM;
		InstancePtr->UsrOpt.VmId = XVIDC_VM_CUSTOM;
	}
	else {
		MsaConfig->Vtm.VmId = XVIDC_VM_CUSTOM;
		InstancePtr->UsrOpt.VmId = XVIDC_VM_CUSTOM;
	}

	/* Set bits per color */
	InstancePtr->UsrOpt.Bpc = MsaConfig->BitsPerColor;

	/* Use custom MSA */
	XDp_TxCfgMsaUseCustom(InstancePtr->DpPtr, Stream, MsaConfig, TRUE);
}
/*****************************************************************************/
/**
*
* This function computes multi-stream attribute and populates frame rate,
* pixel clock and so on.
*
* @param	InstancePtr is a pointer to the XDpTxSs core instance.
* @param	Stream is the stream number for which the MSA values will be
*		computed for.
*
* @return	None.
*
* @note		None.
*
******************************************************************************/
This function computes multi-stream attribute and populates frame rate,
pixel clock and so on.
This function computes multi - stream attribute and populates frame rate pixel clock and so on .
static void DpTxSs_CalculateMsa(XDpTxSs *InstancePtr, u8 Stream)
{
	XDpTxSs_MainStreamAttributes *MsaConfig;
	XVidC_VideoMode VidMode;
	u32 FrameRate;
	u32 ClkFreq;
	u32 Ival;
	float Fval;
	u8 LinkRate;
	MsaConfig = &InstancePtr->DpPtr->TxInstance.MsaConfig[Stream - 1];
	LinkRate = InstancePtr->DpPtr->TxInstance.LinkConfig.LinkRate;
	ClkFreq = (LinkRate * 27 * MsaConfig->MVid) / MsaConfig->NVid;
	MsaConfig->PixelClockHz = ((u32)ClkFreq) * 1000000;
	Fval = (ClkFreq * 1000000.0) / (MsaConfig->Vtm.Timing.HTotal *
                                MsaConfig->Vtm.Timing.F0PVTotal);
	Ival = (u32) Fval;
	FrameRate = (u32) (Fval == (float) Ival) ? Ival : Ival + 1;
	if ((FrameRate == 59) || (FrameRate == 61)) {
		FrameRate = 60;
	}
	else if ((FrameRate == 29) || (FrameRate == 31)) {
		FrameRate = 30;
	}
	else if ((FrameRate == 76) || (FrameRate == 74)) {
		FrameRate = 75;
	}
	MsaConfig->Vtm.FrameRate = FrameRate;
	MsaConfig->Vtm.Timing.HFrontPorch = MsaConfig->Vtm.Timing.HTotal -
			MsaConfig->HStart - MsaConfig->Vtm.Timing.HActive;
	MsaConfig->Vtm.Timing.HBackPorch = MsaConfig->HStart -
			MsaConfig->Vtm.Timing.HSyncWidth;
	MsaConfig->Vtm.Timing.F0PVFrontPorch =
		MsaConfig->Vtm.Timing.F0PVTotal - MsaConfig->VStart -
			MsaConfig->Vtm.Timing.VActive;
	MsaConfig->Vtm.Timing.F0PVBackPorch = MsaConfig->VStart -
			MsaConfig->Vtm.Timing.F0PVSyncWidth;
	MsaConfig->Vtm.Timing.F1VFrontPorch = 0;
	MsaConfig->Vtm.Timing.F1VSyncWidth = 0;
	MsaConfig->Vtm.Timing.F1VBackPorch = 0;
	MsaConfig->Vtm.Timing.F1VTotal = 0;
	VidMode = XVidC_GetVideoModeId(MsaConfig->Vtm.Timing.HActive,
			MsaConfig->Vtm.Timing.VActive,
				MsaConfig->Vtm.FrameRate,
					XVIDC_VF_PROGRESSIVE);
	if (VidMode == XVIDC_VM_NOT_SUPPORTED) {
		MsaConfig->Vtm.VmId = XVIDC_VM_CUSTOM;
		InstancePtr->UsrOpt.VmId = XVIDC_VM_CUSTOM;
	}
	else {
		MsaConfig->Vtm.VmId = XVIDC_VM_CUSTOM;
		InstancePtr->UsrOpt.VmId = XVIDC_VM_CUSTOM;
	}
	InstancePtr->UsrOpt.Bpc = MsaConfig->BitsPerColor;
	XDp_TxCfgMsaUseCustom(InstancePtr->DpPtr, Stream, MsaConfig, TRUE);
}
static void DpTxSs_CalculateMsa ( XDpTxSs * InstancePtr , u8 Stream ) { XDpTxSs_MainStreamAttributes * MsaConfig ; XVidC_VideoMode VidMode ; u32 FrameRate ; u32 ClkFreq ; u32 Ival ; float Fval ; u8 LinkRate ; MsaConfig = & InstancePtr -> DpPtr -> TxInstance . MsaConfig [ Stream - 1 ] ; LinkRate = InstancePtr -> DpPtr -> TxInstance . LinkConfig . LinkRate ; ClkFreq = ( LinkRate * 27 * MsaConfig -> MVid ) / MsaConfig -> NVid ; MsaConfig -> PixelClockHz = ( ( u32 ) ClkFreq ) * 1000000 ; Fval = ( ClkFreq * 1000000.0 ) / ( MsaConfig -> Vtm . Timing . HTotal * MsaConfig -> Vtm . Timing . F0PVTotal ) ; Ival = ( u32 ) Fval ; FrameRate = ( u32 ) ( Fval == ( float ) Ival ) ? Ival : Ival + 1 ; if ( ( FrameRate == 59 ) || ( FrameRate == 61 ) ) { FrameRate = 60 ; } else if ( ( FrameRate == 29 ) || ( FrameRate == 31 ) ) { FrameRate = 30 ; } else if ( ( FrameRate == 76 ) || ( FrameRate == 74 ) ) { FrameRate = 75 ; } MsaConfig -> Vtm . FrameRate = FrameRate ; MsaConfig -> Vtm . Timing . HFrontPorch = MsaConfig -> Vtm . Timing . HTotal - MsaConfig -> HStart - MsaConfig -> Vtm . Timing . HActive ; MsaConfig -> Vtm . Timing . HBackPorch = MsaConfig -> HStart - MsaConfig -> Vtm . Timing . HSyncWidth ; MsaConfig -> Vtm . Timing . F0PVFrontPorch = MsaConfig -> Vtm . Timing . F0PVTotal - MsaConfig -> VStart - MsaConfig -> Vtm . Timing . VActive ; MsaConfig -> Vtm . Timing . F0PVBackPorch = MsaConfig -> VStart - MsaConfig -> Vtm . Timing . F0PVSyncWidth ; MsaConfig -> Vtm . Timing . F1VFrontPorch = 0 ; MsaConfig -> Vtm . Timing . F1VSyncWidth = 0 ; MsaConfig -> Vtm . Timing . F1VBackPorch = 0 ; MsaConfig -> Vtm . Timing . F1VTotal = 0 ; VidMode = XVidC_GetVideoModeId ( MsaConfig -> Vtm . Timing . HActive , MsaConfig -> Vtm . Timing . VActive , MsaConfig -> Vtm . FrameRate , XVIDC_VF_PROGRESSIVE ) ; if ( VidMode == XVIDC_VM_NOT_SUPPORTED ) { MsaConfig -> Vtm . VmId = XVIDC_VM_CUSTOM ; InstancePtr -> UsrOpt . VmId = XVIDC_VM_CUSTOM ; } else { MsaConfig -> Vtm . VmId = XVIDC_VM_CUSTOM ; InstancePtr -> UsrOpt . VmId = XVIDC_VM_CUSTOM ; } InstancePtr -> UsrOpt . Bpc = MsaConfig -> BitsPerColor ; XDp_TxCfgMsaUseCustom ( InstancePtr -> DpPtr , Stream , MsaConfig , TRUE ) ; }
This function computes multi-stream attribute and populates frame rate,
pixel clock and so on.
This function computes multi - stream attribute and populates frame rate pixel clock and so on .
/*Calculate pixel clock in HZ */ /*Calculate frame rate */ /* Round of frame rate */ /* Calculate horizontal front porch */ /* Calculate horizontal back porch */ /* Calculate vertical frame zero front porch */ /* Calculate vertical frame zero back porch */ /* Set frame 1 parameters */ /* Check video mode is present in video common library */ /* Set bits per color */ /* Use custom MSA */