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.

VPSS V4L2 driver crashing with timeout

Hi all,

I'm using a DM816x board, and I'm experiencing an issue doing the below steps:

1) Using Gstreamer to start a playback including the decoder, the deiscaler and the HD output

2) Starting an application which is doing several V4L2_BUF_TYPE_VIDEO_OVERLAY ioctls to the video device in order to move the video position on the screen.

After 1 hour the playback crashes with a kernel dump due to a v4l2 timeout when trying to queue a buffer in the M3.

Has someone experienced a similar problem? Any advice or comment about the issue?

Thanks in advance.

  • Hello,

    What is the EZSDK version that you are using.
    What is the pipeline that you are using?

    BR
    Margarita
  • Hi,

    1) EZSDK version 5.05.02.00

    2) The pipeline looks like:

    filesrc location= test.m2t ! tsdemux ! queue ! h264parse config-interval=1 ! "video/x-h264,stream-format=(string)byte-stream" ! omx_h264dec input-buffers=4 output-buffers=10 peer-alloc=false ! perf ! omx_mdeiscaler peer-alloc=false input-buffers=10 framerate-divisor=2 ! v4l2sink device=/dev/video1 sync=true async=false enable-last-buff
    er=false qos=false name=vsink


    test.m2t is a H264 1080i video.


    Also, we are doing several

    fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
    ret = ioctl(fd, VIDIOC_G_FMT, &fmt);

    and

    ret = ioctl(fd, VIDIOC_S_FMT, &fmt);

    every second, inside a custom application, and that is causing the issue after some minutes running.

    CarlosR.
  • HI Margarita, 

        Thanks for your help on this issue, Carlos works with RidgeRun and we are working together to solve this issue. During the project we have solved a lot of stability issues at kernel/GStreamer/OMX/M3/Codecs level  and now the system behaves well. However, this random problem that appears when stressing the V4L2 driver is causing us problems and your help will be pretty useful. I think two things might be happening:

    a) V4L2 driver doesn't have enough mutex to protect the VPSS and a crash happens

    b) The VPSS code has a bug and it crashes. Not sure if the message sent by the kernel gets corrupted at some point and the VPSS gets wrong information or if the VPSS gets the information but internally a pointer gets corrupted (We saw that in the past). 

    In order to check if the problem is b) we are enabling the syslink debug and also we will start debugging the VPSS driver (we have the Overlay code). Could you check internally if you have information about a) or b) and if you can reproduce the issue? 

    Carlos will upload the test application.

    Thanks,
    -David

  • Hello David,

    There is issues in EZSDK, when the DEI is connected after the decoder and one more in omx_h264dec when the video is interlaced and the height is not multiple of 16.
    Have you already applied these patches?

    BR
    Margarita
  • Hi Margarita,

       Not sure, could you provide the link to the patches?

    -David

  • Hello David,

    There is no link to the patches.
    One is in the gstreamer omx_h264dec element.
    The second one is in overlay package in omx_vfpc.c file.

    BR
    Margarita
  • Hi Margarita, 

        Thanks for your help. I will be happy to give it a try to the patches. I am still not sure if this might be related to the timeout issue that we see in V4L2 when the driver is stressed but I am happy to try it. Do you know if you have more patches to apply on top of V4L2 to give more stability?

    -David

  • Hello David,

    I am sorry for the delay. However here is the patch which is in the overlay package. The both dei's outputs should be connected. You could fakesink which one you do not use. I am not sure if this will solve your problem but you could give a try.

    diff --git a/component-sources/omx/src/ti/omx/comp/vfpc/src/omx_vfpc.c b/component-sources/omx/src/ti/omx/comp/vfpc/src/omx_vfpc_mod.c
    old mode 100644
    new mode 100755
    index 0f6c9b4..69c00fd
    --- a/component-sources/omx/src/ti/omx/comp/vfpc/src/omx_vfpc.c
    +++ b/component-sources/omx/src/ti/omx/comp/vfpc/src/omx_vfpc_mod.c
    @@ -596,7 +596,7 @@ OMX_ERRORTYPE OMX_TI_VFPC_SetParameter ( OMX_HANDLETYPE hComponent,
         				                         nParamIndex,
         				                         pParamStruct);
         		}    		
    -    	}
    +    	} 
         	else
         	{
         	  eError = OMX_BASE_SetParameter(hComponent, 
    @@ -604,7 +604,7 @@ OMX_ERRORTYPE OMX_TI_VFPC_SetParameter ( OMX_HANDLETYPE hComponent,
         			                         pParamStruct);
         	}
         	break;
    -    }
    +    }  
           
         /* Redirect to "OMX_BASE_SetParameter" to handle standrad indexes */
         default:
    @@ -777,7 +777,7 @@ OMX_ERRORTYPE OMX_TI_VFPC_SetConfig ( OMX_HANDLETYPE hComponent,
               pVfpcComPvt->bFrameRateControlType = OMX_FALSE;
             }
             break;
    -      }
    +      } 
           
         case OMX_TI_IndexConfigSubSamplingFactor:
           {
    @@ -786,7 +786,7 @@ OMX_ERRORTYPE OMX_TI_VFPC_SetConfig ( OMX_HANDLETYPE hComponent,
                      (OMX_CONFIG_SUBSAMPLING_FACTOR *) pConfigData;
             for(i = 0; i < OMX_VFPC_MAX_NUM_OUTPUT_FRAMES_PER_PROCESS; i++) {
               pVfpcComPvt->sDrvProperties.auOutputSubSampleFactor[i] =
    -                                      pSubSamp->nSubSamplingFactor[i];
    +                                      pSubSamp->nSubSamplingFactor;
             }
             break;
           }
    @@ -2001,7 +2001,7 @@ static
           eError =
               pVfpcComPvt->fpDioGetCount ( hComponent,
                                            auPortIndex[i], &( auQueuedBufCnt[i] ) );
    -      Log_print3(Diags_USER4,"%s port %d bufcount %d",(xdc_IArg)OMX_UTL_TRACE_MODULE_NAME,auPortIndex[i],auQueuedBufCnt[i]);
    +     Log_print3(Diags_USER4,"%s port %d bufcount %d",(xdc_IArg)OMX_UTL_TRACE_MODULE_NAME,auPortIndex[i],auQueuedBufCnt[i]);
           if(pVfpcComPvt->bFrameRateControlType == OMX_TRUE)
           {
             if(OMX_DirInput == eDir)
    @@ -2025,7 +2025,7 @@ static
                      auQueuedBufCnt[i]--;            
                   }
             }
    -      }
    +      } 
           if (OMX_TI_WarningEosReceived != eError)
           {
             /*To suppress EOS warnings*/
    @@ -2114,8 +2114,8 @@ static
           OMX_UTL_TRACE_FUNCTION_MSG_LEVEL2 ("VFPC:Get Buffer @ i/o port");
           nQueuedBufCnt = 0;
           eError =
    -          pVfpcComPvt->fpDioGetCount ( hComponent,
    -                                       auPortIndex[i], &nQueuedBufCnt );
    +         pVfpcComPvt->fpDioGetCount ( hComponent,
    +                                      auPortIndex[i], &nQueuedBufCnt );
           if(nQueuedBufCnt) {  
           Log_print2(Diags_USER4,"%s fpDioDequeue for port %d",(xdc_IArg)OMX_UTL_TRACE_MODULE_NAME,auPortIndex[i]);
           eError =
    @@ -2820,8 +2820,6 @@ static
     
       OMX_ERRORTYPE eError = OMX_ErrorNone;
     
    -  OMX_U32 nOutputPortsDisabled = 0;
    -
       *pReadyChannelCount = 0;
       for ( i = 0; i < pVfpcComPvt->nMaxNumChannelsPerHandle; i++ ) {
         omxVfpcDrvChannelListCtx_t *pChannelCtx =
    @@ -2841,7 +2839,6 @@ static
           }
         }
         if ( OMX_TRUE == bChannelReady ) {
    -      nOutputPortsDisabled = 0;
           for ( j = 0; j < pDrvProp->nNumOutputPerProcess; j++ ) {
             OMX_U32 nPortIndex, nPortAryIndex;
     
    @@ -2849,14 +2846,11 @@ static
             nPortAryIndex = nPortIndex - OMX_VFPC_OUTPUT_PORT_START_INDEX;
             if (( auOutBufCnt[nPortAryIndex] < 1 ) && 
                 (OMX_FALSE == pChannelCtx->outSrc[j].bDiscardBuffer)) {
    -          nOutputPortsDisabled++;
    +          bChannelReady = OMX_FALSE; 
    +          break;					 
             }
           /* for (j = 0; j < pDrvProp->nNumOutputPerProcess; j++) */
           }
    -      if(nOutputPortsDisabled == pDrvProp->nNumOutputPerProcess)
    -       {
    -        bChannelReady = OMX_FALSE;
    -       }
         /* end of if (OMX_TRUE == bChannelReady) */
         }
         if ( OMX_TRUE == bChannelReady ) {
    @@ -2918,8 +2912,6 @@ static
     
       OMX_BOOL bChannelReturnBuffer = OMX_FALSE;
     
    -  OMX_U32 nOutputPortsDisabled = 0;
    -
       OMX_U32 nInPortIx, nCount;
     
       OMX_U32 nOutPortIx;
    @@ -2971,17 +2963,12 @@ static
               bChannelActive = OMX_FALSE;
             }
           }
    -      nOutputPortsDisabled = 0;
           for ( j = 0; j < pVfpcComPvt->sDrvProperties.nNumOutputPerProcess; j++ ) {  
             nOutPortIx = pVfpcComPvt->sOmxVfpcDrvChannelListCtx[i].outSrc[j].nPortIndex;
             if ( OMX_FALSE == pVfpcComPvt->pPortdefs[nOutPortIx]->bEnabled ) {
    -          nOutputPortsDisabled++;
    +		bChannelActive = OMX_FALSE; 
             } 
           }
    -      if( nOutputPortsDisabled == pVfpcComPvt->sDrvProperties.nNumOutputPerProcess)
    -       {
    -         bChannelActive = OMX_FALSE;
    -      }
           if ( OMX_TRUE == bChannelActive ) {   
             auChannelList[pVfpcComPvt->nChannelCount] = pVfpcComPvt->nChannelCount;
             pVfpcComPvt->nChannelCount++;
    @@ -3116,17 +3103,14 @@ static
             for ( j = 0; j < pVfpcComPvt->sDrvProperties.nNumCurInputBufPerProcess; j++ ) {
               nInPortIx = pVfpcComPvt->sOmxVfpcDrvChannelListCtx[i].inSrc[j].nPortIndex;
               bChannelReturnBuffer = OMX_FALSE;
    -          nOutputPortsDisabled = 0;
               for ( k = 0; k < pVfpcComPvt->sDrvProperties.nNumOutputPerProcess; k++ ) {
                 nOutPortIx = pVfpcComPvt->sOmxVfpcDrvChannelListCtx[i].outSrc[k].nPortIndex;
                 if  ( pVfpcComPvt->pPortdefs[nOutPortIx]->bEnabled == OMX_FALSE ){
    -              nOutputPortsDisabled++;
    -            }
    +				
    +				bChannelReturnBuffer = OMX_TRUE;
    +				break;
                 }
               /* Return input buffer only if all output ports are disabled */
    -          if(nOutputPortsDisabled == pVfpcComPvt->sDrvProperties.nNumOutputPerProcess)
    -           {
    -            bChannelReturnBuffer = OMX_TRUE;
               }
               if  ( (bChannelReturnBuffer == OMX_TRUE) &&
                     (pVfpcComPvt->pPortdefs[nInPortIx]->bEnabled == OMX_TRUE) ){
    

    Regarding the v4l2 since I know we do not have such patches.

    BR

    Margarita