Nvidia NX video core

Hi, by goring thru the kernel source correct me if I am wrong,
tegra_capture_ivc_register_capture_cb registers a call back function to the video core that will run every time when a picture arrived, is there a way for us to print out any information from the call back function for every image received ? And is it possible to do a picture count in the callback function ?
Also Is there a way to reset the video core by using any command or ioctl (I notices that vi_channel_ioctl with the cmd VI_CAPTURE_RESET will do that but how do I call it in the userspace )?

any help will be deeply appreciated thankyou in advance.

Hi,
We would suggest use the existing sample to reproduce the issue you are facing and share the log, so that we can better understand the issue. Please share what your camera type is. If it is Bayer sensor, you may try Argus samples. If it is YUV sensor, you may try 12_camera_v4l2_cuda.

If we can replicate the error, we can investigate further and see if there is certain issue(s) in our kernel driver.

Hi, thanks for the reply, we are using v4l2 driver with 3 gray scale camera and we are facing an issue where the frame rate suddenly drops, and the frame rate is not recovered by resetting the app or the kernel module (imx219) it will only recover by rebooting the kernel, could you shed some light on this issue or how to debug this issue ?
many thanks !

Any kernel error message? Only frame drop but still working well?
Can the v4l2-ctl can reproduce the problem?

hello wenbin.leong,

may I know what’s the scenario or what’s your use-case when the frame rate suddenly drops?

nop no error from kernel, what I found out is the memcpy suddenly takes up alot of time:
after the reboot: 0.002123s ,after the sudden drop: 0.024075s
we are just memcpy from the buffer that is pass in via VIDIOC_QBUF and VIDIOC_DQBUF out to another memory.

we are just doing VIDIOC_QBUF and VIDIOC_DQBUF then memcpy the buffer to another buffer. The memcpy have a sudden increase of time from : after the reboot: 0.002123s ,after the sudden drop: 0.024075s

hello wenbin.leong,

could you please share the code snippets or the github link to demonstrate this memory copy samples.
thanks

As its company policy not to share the whole thing, I will try my best to share what I can:

> static int get_frame(plat_camHndTypeDef *pHnd, struct v4l2_buffer *buf)
> {
>         unsigned int i;
> 
>         switch (pHnd->io)
>         {
>         case IO_METHOD_MMAP:
>                 //printf("get_frame: mmap \n");
>                 CLEAR(*buf);
>                 buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
>                 buf->memory = V4L2_MEMORY_MMAP;
> 
>                 if (-1 == xioctl(pHnd->fd, VIDIOC_DQBUF, buf))
>                 {
>                         switch (errno)
>                         {
>                         case EAGAIN:
>                                 return 0;
> 
>                         case EIO:
>                                 /* Could ignore EIO, see spec. */
>                                 /* fall through */
>                         default:
>                                 errno_exit("VIDIOC_DQBUF");
>                         }
>                 }
>                 assert(buf->index < pHnd->n_buffers);
>                 break;
> 
>         case IO_METHOD_USERPTR:
>         case IO_METHOD_USERPTR_ZC:
>                 CLEAR(*buf);
>                 buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
>                 buf->memory = V4L2_MEMORY_USERPTR;
>                 if (-1 == xioctl(pHnd->fd, VIDIOC_DQBUF, buf))
>                         errno_exit("VIDIOC_QBUF");
>                 break;
> 
>         default:
>                 errno_exit("get_frame: io not handled");
>                 break;
>         }
> 
>         return 1;
> }
> 
> int plat_camDQ(plat_camHndTypeDef *pHnd, struct v4l2_buffer *buf, char **frameData)
> {
>         int ret = 0;
>         if (get_frame(pHnd, buf))
>         {
>                 *frameData = (char *)pHnd->buffers[buf->index].start;
>         }
>         return ret;
> }
> 
>...
>           ret = plat_camDQ(&p_hnd->cam_handle, &buf, &frameDataSrc);
> 			if (buf.flags & V4L2_BUF_FLAG_ERROR)
> 			{
> 				plat_logDebug("XXXXXXXXXXXXXXXXXXXXXXXbuf.flag=0x%x\n", buf.flags);
> 
> 				/* check if we need to skip count */
> 			}
> 			else if (p_hnd->skip_count != 0 && p_hnd->skip_count > p_hnd->current_skip_count)
> 			{
> 				/* we skip this capture */
> 				p_hnd->current_skip_count++;
> 				plat_camEQ(&p_hnd->cam_handle, &buf);
> 			}
> 			else if (ret == 0)
> 			{
>               memcpy(frameDataDst, frameDataSrc, buffer_handle->frame_size); <---- the mem cpy that giv a sudden delay
>...

sorry for the inconvenient I am discussing with my manager to share more.