This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: DSS writeback issues

Part Number: TDA4VM


Dear experts,

I want to use DSS for color conversion and scale,  firstly i did a simple test: convert nv12(1920*1280) to nv21(1920*1280) with wb pipline, 

but i didn't get the correct image. Please help me to confirm the init params correct?

Thank

    int32_t retVal = FVID2_SOK;
    uint32_t loopCnt, pipeIdx, planeIdx, layerIdx;
    M2MApp_InstParams *instObj;
    SemaphoreP_Params semParams;
    Dss_DispParams *dispParams;
    CSL_DssWbPipeCfg *wbPipeCfg;
    M2MApp_AppObj *appObj = &gM2MAppObj;
    Dss_DctrlOverlayParams *ovrParams;
    Dss_DctrlOverlayLayerParams *layerParams;

    appObj->numInst            = APP_DSS_M2M_CH_NUM;
    appObj->numFramesToConvert = APP_DSS_M2M_FRAMES_WB;
    appObj->numFramesWb        = 0U;
    for (loopCnt = 0U ; loopCnt < appObj->numInst ; loopCnt++)
    {
        instObj                     = &appObj->instParams[loopCnt];
        instObj->instIdx            = loopCnt;
        instObj->appObj             = appObj;
        Dss_m2mCreateParamsInit(&instObj->createParams);
        Fvid2CbParams_init(&instObj->cbParams);
        instObj->cbParams.cbFxn         = &App_pipeCbFxn;
        instObj->cbParams.appData       = instObj;
        instObj->numPipe                = APP_DSS_M2M_DSS_PIPE_NUM;
        instObj->createParams.numPipe   = APP_DSS_M2M_DSS_PIPE_NUM;
        instObj->createParams.overlayId = APP_DSS_M2M_DSS_OVERLAY_ID;
        /* Initialize Display pipeline parameters */
        for (pipeIdx = 0U ; pipeIdx < APP_DSS_M2M_DSS_PIPE_NUM ; pipeIdx++)
        {
            instObj->createParams.pipeId[pipeIdx] = APP_DSS_M2M_DSS_PIPE_ID;
            instObj->pipeCfg[pipeIdx].pipeId      = APP_DSS_M2M_DSS_PIPE_ID;
            instObj->mFlagCfg[pipeIdx].pipeId     = APP_DSS_M2M_DSS_PIPE_ID;
            instObj->cscCfg[pipeIdx].pipeId       = APP_DSS_M2M_DSS_PIPE_ID;
            dispParams = &instObj->pipeCfg[pipeIdx].cfgParams;
            Dss_dispParamsInit(dispParams);
			dispParams->pipeCfg.inFmt.scanFormat  = FVID2_SF_PROGRESSIVE;
            dispParams->pipeCfg.pipeType = CSL_DSS_VID_PIPE_TYPE_VID;
            dispParams->pipeCfg.inFmt.width = 1920;//APP_DSS_M2M_IN_FRAME_WIDTH;
            dispParams->pipeCfg.inFmt.height = 1280;//APP_DSS_M2M_IN_FRAME_HEIGHT;
            for(planeIdx = 0U ; planeIdx < FVID2_MAX_PLANES; planeIdx++)
            {
                dispParams->pipeCfg.inFmt.pitch[planeIdx] = 1920;//APP_DSS_M2M_IN_FRAME_WIDTH;//APP_DSS_M2M_IN_FRAME_PITCH;
            }
            dispParams->pipeCfg.inFmt.dataFormat  = FVID2_DF_YUV420SP_UV;//APP_DSS_M2M_IN_FRAME_FORMAT;
            dispParams->pipeCfg.outWidth          = 1920;//APP_DSS_M2M_IN_FRAME_WIDTH;
            dispParams->pipeCfg.outHeight         = 1280;//APP_DSS_M2M_IN_FRAME_HEIGHT;
            dispParams->pipeCfg.scEnable          = FALSE;
            dispParams->alphaCfg.globalAlpha      = 0xFFU;
            dispParams->alphaCfg.preMultiplyAlpha = FALSE;
            dispParams->layerPos.startX           = 0U;
            dispParams->layerPos.startY           = 0U;

			/* add */
			//dispParams->pipeCfg.inFmt.ccsFormat  = FVID2_CCSF_BITS12_PACKED;

            Dss_dispPipeMflagParamsInit(&instObj->mFlagCfg[pipeIdx].mFlagCfg);

            CSL_dssCscCoeffInit(&instObj->cscCfg[pipeIdx].csc);
        }
        /* Initialize WB pipeline parameters */
        Dss_m2mPipeCfgParamsInit(&instObj->wbCfg);
        wbPipeCfg = &instObj->wbCfg.pipeCfg;
        /* Dont' need to set dataFormat as this is fixed to 'FVID2_DF_ARGB48_12121212'
           and is set in 'Dss_m2mPipeCfgParamsInit()' */
        //wbPipeCfg->inFmt.dataFormat  = FVID2_DF_YUV420SP_UV;
        wbPipeCfg->inFmt.width       = 1920;//APP_DSS_M2M_IN_FRAME_WIDTH;
        wbPipeCfg->inFmt.height      = 1280;//APP_DSS_M2M_IN_FRAME_HEIGHT;
        wbPipeCfg->outFmt.width      = 1920;//APP_DSS_M2M_OUT_FRAME_WIDTH;
        wbPipeCfg->outFmt.height     = 1280;//APP_DSS_M2M_OUT_FRAME_HEIGHT;
        wbPipeCfg->outFmt.dataFormat = FVID2_DF_YUV420SP_VU;//APP_DSS_M2M_OUT_FRAME_FORMAT;
        wbPipeCfg->outFmt.ccsFormat  = FVID2_CCSF_BITS8_PACKED;
        /* add */
        //wbPipeCfg->outFmt.ccsFormat  = FVID2_CCSF_BITS12_PACKED;
        wbPipeCfg->inPos.startX      = 0U;
        wbPipeCfg->inPos.startY      = 0U;
		wbPipeCfg->cscRange			 = CSL_DSS_CSC_RANGE_FULL;

		wbPipeCfg->inFmt.scanFormat  = FVID2_SF_PROGRESSIVE;

		//wbPipeCfg->inFmt.ccsFormat   = FVID2_CCSF_BITS32_PACKED;
        //wbPipeCfg->scEnable = TRUE;
        for(planeIdx = 0U ; planeIdx < FVID2_MAX_PLANES; planeIdx++)
        {
         	wbPipeCfg->inFmt.pitch[planeIdx] = 1920*6;//APP_DSS_M2M_IN_FRAME_WIDTH*6;
            wbPipeCfg->outFmt.pitch[planeIdx] = 1920;//APP_DSS_M2M_IN_FRAME_WIDTH;//APP_DSS_M2M_OUT_FRAME_PITCH;
        }
        CSL_dssWbPipeDmaCfgInit(&instObj->wbDmaCfg);
        Dss_m2mMFlagParamsInit(&instObj->wbMflagCfg);
        CSL_dssCscCoeffInit(&instObj->wbCscCfg);
        Dss_m2mStatusInit(&instObj->wbStatus);

		/* add */
		instObj->wbCscCfg.cscRange = CSL_DSS_CSC_RANGE_FULL;

        /* Initialize Display overlay parameters */
        ovrParams = &instObj->ovrCfg;
        Dss_dctrlOverlayParamsInit(ovrParams);
        ovrParams->overlayId = APP_DSS_M2M_DSS_OVERLAY_ID;
        ovrParams->colorbarEnable = FALSE;
        ovrParams->overlayCfg.colorKeyEnable = FALSE;
        ovrParams->overlayCfg.colorKeySel = CSL_DSS_OVERLAY_TRANS_COLOR_DEST;
        ovrParams->overlayCfg.backGroundColor = 0xc8c800U;

        layerParams = &instObj->layerCfg;
        Dss_dctrlOverlayLayerParamsInit(layerParams);
        layerParams->overlayId = APP_DSS_M2M_DSS_OVERLAY_ID;
        /* Set all layer to invalid first and then update only used ones */
        for(layerIdx = 0U ; layerIdx < CSL_DSS_VID_PIPE_ID_MAX ; layerIdx++)
        {
            layerParams->pipeLayerNum[layerIdx] = CSL_DSS_OVERLAY_LAYER_INVALID;
        }
        layerParams->pipeLayerNum[instObj->createParams.pipeId[0U]] =
                                                    CSL_DSS_OVERLAY_LAYER_NUM_0;
        if(APP_DSS_M2M_DSS_PIPE_NUM > 1U)
        {
            for(layerIdx = 1U ; layerIdx < APP_DSS_M2M_DSS_PIPE_NUM ; layerIdx++)
            {
                layerParams->pipeLayerNum[instObj->createParams.pipeId[0U]] = layerIdx;
            }
        }
        Dss_dctrlGlobalDssParamsInit(&instObj->globalParams);

        /* Create sync semaphore */
        /* Allocate instance semaphore */
        SemaphoreP_Params_init(&semParams);
        semParams.mode   = SemaphoreP_Mode_BINARY;
        instObj->syncSem = SemaphoreP_create(0U, &semParams);
        if (instObj->syncSem == NULL)
        {
            retVal = FVID2_EFAIL;
            OSA_INFO(DRIVER_MOULDE_ISP, "\nERROR: Semaphore create failed!!!\n");
        }

  • Hi,

    I really doubt that the NV21 format is supported. In the current driver, when it gets the unsupported format, it selects default ARGB format. This is why you are getting incorrect output.

    Can you please check the DSS specs and confirm its support?

    Regards,

    Brijesh

  • Hi, Brijesh

    I try to set wb pipline inFmt.dataFormat  = FVID2_DF_YUV420SP_UV, the error as follow:

    src/drv/m2m/dss_m2mApi.c @ Line 802: 

    Programming Failed: DSS Pipe/Disp/WB Pipe

    After checked the DSS specs, I found this in csl_dssWbPipe.c:

    int32_t CSL_dssWbPipeSetConfig(CSL_dss_wbRegs *wbRegs,
                                   const CSL_DssWbPipeCfg *wbCfg)
    {
        int32_t retVal = CSL_PASS;
        int32_t isInDataFmtRgb = FALSE;
        int32_t isOutDataFmtYuv = FALSE;
        int32_t isOutDataFmtRgb = FALSE;
        uint32_t dssFmt, verticalTaps;
        uint32_t scalerVal = CSL_DSS_WB_PIPE_SC_DISABLED;
        const CSL_DssWbPipeScalerCoeff *hCoeff, *vCoeff;
        const CSL_DssWbPipeScalerCoeff *hChromaCoeff, *vChromaCoeff;
        uint32_t rowInc = 0U, rowIncUV = 0U;
        uint32_t chromaInWidth, chromaInHeight;
        uint32_t chromaOutWidth, chromaOutHeight;
    
        /* Check if input format is ARGB48 */
        isInDataFmtRgb = Fvid2_isDataFmtRgb(wbCfg->inFmt.dataFormat);
        if(FALSE == isInDataFmtRgb)
        {
            retVal = CSL_EBADARGS;
        }
        ...
        ...

    so, I think NV12 format is not supported, it should be ARGB48 format.

    Can you help me do a test that convert nv12 to nv21 with wb pipline?

    thanks.

  • Hello chunlink sun,

    This condition check is for input format for the WB path. Input comes from the overlay output, which is in ARGB format, so this condition check is ok.

    Could you please help me understand how you are checking nv12 to nv12 output format? Are you using OpenVX node or directly driver interface? 

    If you are using driver interface, can you please refer to ti-processor-sdk-rtos-j721e-evm-07_03_00_07\pdk_jacinto_07_03_00_29\packages\ti\drv\dss\examples\dss_m2m_test\dss_m2m_test_cfg.h file? In this file, you can find configuration/settings for YUV422 to YUV420 conversion.. Can you try changing input format to YUV420 here?

    Regards,

    Brijesh

  • Hi, Brijesh

    Now I have successfully implemented the scaling(nv12->1/2 nv12), and I confirm that nv21 is not supported for the wb output. 

    thanks