XilinxProcessorIPLib/drivers/vprocss/src/xvprocss.c
static int SetupModeScalerOnly(XVprocSs *XVprocSsPtr)
{
  u32 vsc_WidthIn, vsc_HeightIn, vsc_HeightOut;
  u32 hsc_HeightIn, hsc_WidthIn, hsc_WidthOut, hsc_ColorFormatIn;
  int status = XST_SUCCESS;

  vsc_WidthIn = vsc_HeightIn = vsc_HeightOut = 0;
  hsc_HeightIn = hsc_WidthIn = hsc_WidthOut = 0;

  if(!XVprocSsPtr->VscalerPtr) {
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_VSCALER, XVPROCSS_EDAT_IPABSENT);
    return(XST_FAILURE);
  }

  if(!XVprocSsPtr->HscalerPtr) {
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_HSCALER, XVPROCSS_EDAT_IPABSENT);
    return(XST_FAILURE);
  }

  /* check if input/output stream configuration is supported */
  status = ValidateScalerOnlyConfig(XVprocSsPtr);

  if(status ==  XST_SUCCESS)
  {
    /* Reset the IP Blocks inside the VPSS */
    XVprocSs_Reset(XVprocSsPtr);

    /* UpScale mode V Scaler is before H Scaler */
    vsc_WidthIn   = XVprocSsPtr->VidIn.Timing.HActive;
    vsc_HeightIn  = XVprocSsPtr->VidIn.Timing.VActive;
    vsc_HeightOut = XVprocSsPtr->VidOut.Timing.VActive;

    hsc_WidthIn  = vsc_WidthIn;
    hsc_HeightIn = vsc_HeightOut;
    hsc_WidthOut = XVprocSsPtr->VidOut.Timing.HActive;
    if (XVprocSsPtr->VidIn.ColorFormatId == XVIDC_CSF_YCRCB_420)
    {
        hsc_ColorFormatIn = XVIDC_CSF_YCRCB_422;
    }
    else
    {
        hsc_ColorFormatIn = XVprocSsPtr->VidIn.ColorFormatId;
    }

    /* Configure scaler to scale input to output resolution */
	XV_VScalerSetup(XVprocSsPtr->VscalerPtr,
                    vsc_WidthIn,
                    vsc_HeightIn,
                    vsc_HeightOut,
                    XVprocSsPtr->VidIn.ColorFormatId);

    XV_HScalerSetup(XVprocSsPtr->HscalerPtr,
                    hsc_HeightIn,
                    hsc_WidthIn,
                    hsc_WidthOut,
                    hsc_ColorFormatIn,
                    XVprocSsPtr->VidOut.ColorFormatId);

    /* Start Scaler sub-cores */
    XV_HScalerStart(XVprocSsPtr->HscalerPtr);
    XV_VScalerStart(XVprocSsPtr->VscalerPtr);

    /* Subsystem Ready to accept input stream - Enable Video Input */
    XVprocSs_EnableBlock(XVprocSsPtr->RstAxisPtr,  GPIO_CH_RESET_SEL, XVPROCSS_RSTMASK_VIDEO_IN);
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_HSCALER, XVPROCSS_EDAT_SETUPOK);
  }
  else
  {
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_HSCALER, XVPROCSS_EDAT_IGNORE);
  }
  return(status);
}
/*****************************************************************************/
/**
* This function configures the video subsystem pipeline for ScalerOnly
* topology of the subsystem
*
* @param  XVprocSsPtr is a pointer to the Subsystem instance to be worked on.
*
* @return XST_SUCCESS if successful else XST_FAILURE
*
* @note If use case is possible the subsystem will configure the sub-cores
*       accordingly else will ignore the request
*
******************************************************************************/
This function configures the video subsystem pipeline for ScalerOnly
topology of the subsystem
This function configures the video subsystem pipeline for ScalerOnly topology of the subsystem
static int SetupModeScalerOnly(XVprocSs *XVprocSsPtr)
{
  u32 vsc_WidthIn, vsc_HeightIn, vsc_HeightOut;
  u32 hsc_HeightIn, hsc_WidthIn, hsc_WidthOut, hsc_ColorFormatIn;
  int status = XST_SUCCESS;
  vsc_WidthIn = vsc_HeightIn = vsc_HeightOut = 0;
  hsc_HeightIn = hsc_WidthIn = hsc_WidthOut = 0;
  if(!XVprocSsPtr->VscalerPtr) {
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_VSCALER, XVPROCSS_EDAT_IPABSENT);
    return(XST_FAILURE);
  }
  if(!XVprocSsPtr->HscalerPtr) {
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_HSCALER, XVPROCSS_EDAT_IPABSENT);
    return(XST_FAILURE);
  }
  status = ValidateScalerOnlyConfig(XVprocSsPtr);
  if(status ==  XST_SUCCESS)
  {
    XVprocSs_Reset(XVprocSsPtr);
    vsc_WidthIn   = XVprocSsPtr->VidIn.Timing.HActive;
    vsc_HeightIn  = XVprocSsPtr->VidIn.Timing.VActive;
    vsc_HeightOut = XVprocSsPtr->VidOut.Timing.VActive;
    hsc_WidthIn  = vsc_WidthIn;
    hsc_HeightIn = vsc_HeightOut;
    hsc_WidthOut = XVprocSsPtr->VidOut.Timing.HActive;
    if (XVprocSsPtr->VidIn.ColorFormatId == XVIDC_CSF_YCRCB_420)
    {
        hsc_ColorFormatIn = XVIDC_CSF_YCRCB_422;
    }
    else
    {
        hsc_ColorFormatIn = XVprocSsPtr->VidIn.ColorFormatId;
    }
	XV_VScalerSetup(XVprocSsPtr->VscalerPtr,
                    vsc_WidthIn,
                    vsc_HeightIn,
                    vsc_HeightOut,
                    XVprocSsPtr->VidIn.ColorFormatId);
    XV_HScalerSetup(XVprocSsPtr->HscalerPtr,
                    hsc_HeightIn,
                    hsc_WidthIn,
                    hsc_WidthOut,
                    hsc_ColorFormatIn,
                    XVprocSsPtr->VidOut.ColorFormatId);
    XV_HScalerStart(XVprocSsPtr->HscalerPtr);
    XV_VScalerStart(XVprocSsPtr->VscalerPtr);
    XVprocSs_EnableBlock(XVprocSsPtr->RstAxisPtr,  GPIO_CH_RESET_SEL, XVPROCSS_RSTMASK_VIDEO_IN);
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_HSCALER, XVPROCSS_EDAT_SETUPOK);
  }
  else
  {
    XVprocSs_LogWrite(XVprocSsPtr, XVPROCSS_EVT_CFG_HSCALER, XVPROCSS_EDAT_IGNORE);
  }
  return(status);
}
static int SetupModeScalerOnly ( XVprocSs * XVprocSsPtr ) { u32 vsc_WidthIn , vsc_HeightIn , vsc_HeightOut ; u32 hsc_HeightIn , hsc_WidthIn , hsc_WidthOut , hsc_ColorFormatIn ; int status = XST_SUCCESS ; vsc_WidthIn = vsc_HeightIn = vsc_HeightOut = 0 ; hsc_HeightIn = hsc_WidthIn = hsc_WidthOut = 0 ; if ( ! XVprocSsPtr -> VscalerPtr ) { XVprocSs_LogWrite ( XVprocSsPtr , XVPROCSS_EVT_CFG_VSCALER , XVPROCSS_EDAT_IPABSENT ) ; return ( XST_FAILURE ) ; } if ( ! XVprocSsPtr -> HscalerPtr ) { XVprocSs_LogWrite ( XVprocSsPtr , XVPROCSS_EVT_CFG_HSCALER , XVPROCSS_EDAT_IPABSENT ) ; return ( XST_FAILURE ) ; } status = ValidateScalerOnlyConfig ( XVprocSsPtr ) ; if ( status == XST_SUCCESS ) { XVprocSs_Reset ( XVprocSsPtr ) ; vsc_WidthIn = XVprocSsPtr -> VidIn . Timing . HActive ; vsc_HeightIn = XVprocSsPtr -> VidIn . Timing . VActive ; vsc_HeightOut = XVprocSsPtr -> VidOut . Timing . VActive ; hsc_WidthIn = vsc_WidthIn ; hsc_HeightIn = vsc_HeightOut ; hsc_WidthOut = XVprocSsPtr -> VidOut . Timing . HActive ; if ( XVprocSsPtr -> VidIn . ColorFormatId == XVIDC_CSF_YCRCB_420 ) { hsc_ColorFormatIn = XVIDC_CSF_YCRCB_422 ; } else { hsc_ColorFormatIn = XVprocSsPtr -> VidIn . ColorFormatId ; } XV_VScalerSetup ( XVprocSsPtr -> VscalerPtr , vsc_WidthIn , vsc_HeightIn , vsc_HeightOut , XVprocSsPtr -> VidIn . ColorFormatId ) ; XV_HScalerSetup ( XVprocSsPtr -> HscalerPtr , hsc_HeightIn , hsc_WidthIn , hsc_WidthOut , hsc_ColorFormatIn , XVprocSsPtr -> VidOut . ColorFormatId ) ; XV_HScalerStart ( XVprocSsPtr -> HscalerPtr ) ; XV_VScalerStart ( XVprocSsPtr -> VscalerPtr ) ; XVprocSs_EnableBlock ( XVprocSsPtr -> RstAxisPtr , GPIO_CH_RESET_SEL , XVPROCSS_RSTMASK_VIDEO_IN ) ; XVprocSs_LogWrite ( XVprocSsPtr , XVPROCSS_EVT_CFG_HSCALER , XVPROCSS_EDAT_SETUPOK ) ; } else { XVprocSs_LogWrite ( XVprocSsPtr , XVPROCSS_EVT_CFG_HSCALER , XVPROCSS_EDAT_IGNORE ) ; } return ( status ) ; }
This function configures the video subsystem pipeline for ScalerOnly
topology of the subsystem
This function configures the video subsystem pipeline for ScalerOnly topology of the subsystem
/* check if input/output stream configuration is supported */ /* Reset the IP Blocks inside the VPSS */ /* UpScale mode V Scaler is before H Scaler */ /* Configure scaler to scale input to output resolution */ /* Start Scaler sub-cores */ /* Subsystem Ready to accept input stream - Enable Video Input */