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.

DM385 : IPNC usecase to send and display YUV frame from A8 to VPSS

Hi,

I am trying to read YUV frames from USB camera and display on the screen through VPSS. I have written one custom link to read the data from USB camera and the chain looks as below, ( I modified the capturedisplay use case to validate my test case)

V4L2Link -> ipcFramesOut (A8) -> ipcFramesIn (VPSS) -> display

Once I start the usecase, i could able to see the video till 1000 frames and getting assert in the following place "IpcFramesOutLink_processFrameBufs()

{

      .......................

          status =^M
                OSA_queGet(&pObj->listElemQue, (Int32 *) & pListElem,^M
                           OSA_TIMEOUT_NONE);^M
            OSA_assert (status == OSA_SOK)^M

         ...........

}

when we explored, we found that there is no valid buffers from the emptylist from the function and causing the issue,

IpcFramesOutLink_releaseFrameBufs()

{

....

"pListElem = ListMP_getHead(pObj->listMPInHndl);

if (pListElem != NULL) { ... }

...

}

I have attached our usecase for your reference. Any help would make us move further.

Note : Directly we  are calling the "IpcFramesOutLink_putFullVideoFrames" and "IpcFramesOutLink_getEmptyVideoFrames" to send and receive the buffers from V4L2 link to ipcFramesOut link.

6574.v4l2_capturedisplay.c
/** ==================================================================
 *  @file   multich_Stream_CaptureDisplay.c
 *
 *  @path    ipnc_mcfw/mcfw/src_linux/mcfw_api/usecases/
 *
 *  @desc   This  File contains.
 * ===================================================================
 *  Copyright (c) Texas Instruments Inc 2011, 2012
 *
 *  Use of this software is controlled by the terms and conditions found
 *  in the license agreement under which this software has been supplied
 * ===================================================================*/

/*------------------------------ TRIPLE OUT <1080p + D1 + MJPEG> ----------------------------------

                                    Capture
								 RSZA     RSZB
                               1080P60    D130
                              (YUV420)  (YUV420)
                                  |          |
                             (0)-DUP0-(1)   (0)-DUP1-(1)
                              |        |    |         |
                      HDMI DISPLAY  NULL1  TVOUT      NULL0

------------------------------------------------------------------------------------------*/

#include "mcfw/src_linux/mcfw_api/usecases/multich_common.h"
#include "mcfw/src_linux/mcfw_api/usecases/multich_ipcbits.h"
#include "demos/mcfw_api_demos/multich_usecase/ti_mcfw_ipnc_main.h"

/* =============================================================================
 * Externs
 * ============================================================================= */

/* =============================================================================
 * Use case code
 * ============================================================================= */
#define NUM_DUP_LINK           (3)
#define HDMIDIS_DUP_IDX        (0)
#define TVOUT_DUP_IDX          (1)
#define RAW_DUP_IDX            (2)


/* ===================================================================
 *  @func     MultiCh_createStreamCaptureDisplay
 *
 *  @desc     Function does the following
 *
 *  @modif    This function modifies the following structures
 *
 *  @inputs   This function takes the following inputs
 *            <argument name>
 *            Description of usage
 *            <argument name>
 *            Description of usage
 *
 *  @outputs  <argument name>
 *            Description of usage
 *
 *  @return   Return value of this function if any
 *  ==================================================================
 */
UInt32 gIpcFramesOutHLOSId;
UInt32 gIpcFramesInVpssId;
UInt32 gDisplayId;
UInt32 gMergeId;



Void v4l2_createStreamCaptureDisplay()
{

	//v4l2camLink_CreateParams v4l2cameraHostrm;              //HOST-A8---------->
	//IpcBitsOutLinkHLOS_CreateParams ipcFramesOutHostPrm;              //HOST-A8---------->
	//IpcBitsInLinkRTOS_CreateParams  ipcFramesInVpssPrm;               //---------->VPSS-M3

        IpcFramesOutLinkHLOS_CreateParams  ipcFramesOutHostPrm;
        IpcFramesInLinkRTOS_CreateParams   ipcFramesInVpssPrm;
	//SwMsLink_CreateParams           swMsPrm;

	DisplayLink_CreateParams        displayPrm;

	//Int32 status;


	//////////////////////////////////////////////////////////////


	OSA_printf("\n********** raviraj UVC - display usecase ********\n");

	//gVdisModuleContext.ipcFramesOutHostId		 = SYSTEM_HOST_LINK_ID_IPC_FRAMES_OUT_0;
	//gVdisModuleContext.ipcFramesInVpssFromHostId = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_IN_0;


	/* IPC structures init */
	MULTICH_INIT_STRUCT(IpcFramesOutLinkHLOS_CreateParams,ipcFramesOutHostPrm);
	MULTICH_INIT_STRUCT(IpcFramesInLinkRTOS_CreateParams,ipcFramesInVpssPrm);

	OSA_printf("\n********** UVC - display usecase ********\n");
	MultiCh_detectBoard();

	System_linkControl(SYSTEM_LINK_ID_M3VPSS,SYSTEM_M3VPSS_CMD_RESET_VIDEO_DEVICES, NULL, 0, TRUE);

	/* Link IDs */
	OSA_printf("raviraj : CREATING LINK ID'S\n");
	gIpcFramesOutHLOSId = SYSTEM_HOST_LINK_ID_IPC_FRAMES_OUT_0;
	gIpcFramesInVpssId      = SYSTEM_VPSS_LINK_ID_IPC_FRAMES_IN_0;
	//gSwMsId           = SYSTEM_LINK_ID_SW_MS_MULTI_INST_0;
	gDisplayId        = SYSTEM_LINK_ID_DISPLAY_0;

	/* IPC BITS OUT HLOS Link */
	OSA_printf("raviraj : SETTING A8 LINK TO VPSS LINK\n");


	ipcFramesOutHostPrm.baseCreateParams.inQueParams.prevLinkQueId      = 0;
	ipcFramesOutHostPrm.baseCreateParams.numOutQue                      = 1;
	ipcFramesOutHostPrm.baseCreateParams.inputFrameRate                 = 10;//30 
	ipcFramesOutHostPrm.baseCreateParams.outputFrameRate                = 10;//30 
	ipcFramesOutHostPrm.baseCreateParams.outQueParams[0].nextLink 	    = gIpcFramesInVpssId;
	ipcFramesOutHostPrm.baseCreateParams.notifyNextLink                 = FALSE; // SARA TRUE
	ipcFramesOutHostPrm.baseCreateParams.notifyPrevLink                 = FALSE;
	ipcFramesOutHostPrm.baseCreateParams.noNotifyMode                   = TRUE ; // SARA FALSE


	ipcFramesOutHostPrm.inQueInfo.numCh                                 = 1;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].startX                      = 0;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].startY                      = 0;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].height                      = 480;//640;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].width                       = 640;//480;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].pitch[0]                    = 1280;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].pitch[1]                    = 1280;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].pitch[2]                    = 1280;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].bufType                     = SYSTEM_BUF_TYPE_VIDFRAME;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].codingformat                = -1;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].memType                     = SYSTEM_MT_NONTILEDMEM;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].dataFormat                  = SYSTEM_DF_YUV422I_YUYV;
	ipcFramesOutHostPrm.inQueInfo.chInfo[0].scanFormat                  = SYSTEM_SF_PROGRESSIVE;//SYSTEM_SF_INTERLACED;//


	ipcFramesInVpssPrm.baseCreateParams.inQueParams.prevLinkId      = gIpcFramesOutHLOSId;
	ipcFramesInVpssPrm.baseCreateParams.inQueParams.prevLinkQueId   = 0;
	ipcFramesInVpssPrm.baseCreateParams.inputFrameRate              = 10;//30;
	ipcFramesInVpssPrm.baseCreateParams.noNotifyMode                = TRUE;
	ipcFramesInVpssPrm.baseCreateParams.notifyNextLink              = TRUE;
	ipcFramesInVpssPrm.baseCreateParams.notifyPrevLink              = FALSE  ; // TRUE;
	ipcFramesInVpssPrm.baseCreateParams.numOutQue                   = 1;
	ipcFramesInVpssPrm.baseCreateParams.outQueParams[0].nextLink    = gDisplayId;
	ipcFramesInVpssPrm.baseCreateParams.outputFrameRate             = 10;//30;


	/* DISPLAY Link */
	MULTICH_INIT_STRUCT(DisplayLink_CreateParams,displayPrm);

	//displayPrm.inQueParams[0].prevLinkId    = gSwMsId;
	displayPrm.inQueParams[0].prevLinkId    = gIpcFramesInVpssId;
	displayPrm.inQueParams[0].prevLinkQueId = 0;
	displayPrm.displayRes                   = gVdisModuleContext.vdisConfig.deviceParams[VDIS_DEV_HDMI].resolution;
	displayPrm.displayId                    = DISPLAY_LINK_DISPLAY_SC2;

	displayPrm.numInputQueues               = 1;
	displayPrm.activeQueue                  = 0;
	displayPrm.forceFieldSeparatedInputMode = FALSE;


	/* Link creation */

	System_linkCreate(SYSTEM_HOST_LINK_ID_V4L2,NULL,0);

	System_linkCreate(gIpcFramesOutHLOSId,&ipcFramesOutHostPrm,sizeof(ipcFramesOutHostPrm));
	System_linkCreate(gIpcFramesInVpssId,&ipcFramesInVpssPrm,sizeof(ipcFramesInVpssPrm));

	//System_linkCreate(gSwMsId,&swMsPrm,sizeof(SwMsLink_CreateParams));
	//OSA_printf("raviraj ::: MOSAIC  : SW MOSAIC LINK CREATED\n");

	System_linkCreate(gDisplayId,&displayPrm,sizeof(DisplayLink_CreateParams));
	OSA_printf("raviraj : DISPLAY LINK CREATED\n");
	OSA_printf("raviraj : USECASE SETUP DONE\n");


}

/* ===================================================================
 *  @func     MultiCh_deleteStreamCaptureDisplay
 *
 *  @desc     Function does the following
 *
 *  @modif    This function modifies the following structures
 *
 *  @inputs   This function takes the following inputs
 *            <argument name>
 *            Description of usage
 *            <argument name>
 *            Description of usage
 *
 *  @outputs  <argument name>
 *            Description of usage
 *
 *  @return   Return value of this function if any
 *  ==================================================================
 */
Void v4l2_deleteStreamCaptureDisplay()
{

	System_linkDelete(gDisplayId);
	//	System_linkDelete(gSwMsId);
	System_linkDelete(gMergeId);
	System_linkDelete(gIpcFramesInVpssId);
	System_linkDelete(gIpcFramesOutHLOSId);

	/* Print the HWI, SWI and all tasks load */
	/* Reset the accumulated timer ticks */
	MultiCh_prfLoadCalcEnable(FALSE, TRUE, FALSE);

}