performance of V4L2_MEMORY_MMAP buffer memcpy

We have developed soc camera based driver for OV4689 on jetson tk1 board using L4T 21.4. We are able to capture images (of 4MB size) from sensor at 90FPS. But when we try to copy image data from mmap buffer, it takes 17ms time to copy around 4MB of data.

How to improve memcpy performance of mmap buffer ?

I have same problem. https://devtalk.nvidia.com/default/topic/947488/jetson-tk1/slow-copy-memcpy-26mb-190ms-it-is-normal-bandwidth-/

I have speedup memcpy with openmp parallel for, but the question is why so slow copy.

hi vsw,

thanks for reply.

in my case memcpy performance reduces with mmap buffer only.

if i allocate buffer in user space and try to copy 4MB data from that then it takes around 3ms.

so issue seems to be with mmap buffer only. memcpy operation takes more time if source buffer is mmaped buffer.

I am using v4l2 with mmap memory too. My problem comes from there.
I made test again:

  • memcpy from userspace pointer to userspace pointer is about 33ms per 26mb
  • memcpy from userspace pointer to pinned pointer is about 33ms per 26mb
  • memcpy from mmap v4l pointer to pinned is about 200ms per 26mb

So mmap is slow?!

I found answer and have explaned here: https://devtalk.nvidia.com/default/topic/947488/jetson-tk1/slow-copy-memcpy-26mb-190ms-it-is-normal-bandwidth-/?offset=7#4921965

Thanks.

i used memalign in my application and user pointer started working but somehow data copy from
buf.m.userptr fails. see below code snippet


ioctl (fd_v4l, VIDIOC_DQBUF, &buf)
memcpy(test_buff, buf.m.userptr, buf.length);
if ( memcmp( test_buff, buf.m.userptr, buf.length) )
{
printf("error in memcpy);
}

memcmp fails.