Is NvBufferMemSyncForCpu() and NvBufferMemSyncForDevice() nessesary for the V4L2_MEMORY_MMAP buffer type?
From my own experience, I tried to add hardware encoding on the Jetson Tx2 via v4l2_m2m into FFmpeg.
I found that calling NvBufferMemSyncForDevice() was required before queuing the output buffers with the VIDIOC_QBUF ioctl call. If I didn’t include the NvBufferMemSyncForDevice() function the compressed video had artifacts.
Please check the option ‘-c Enable demonstration of CPU processing’ in 10_camera_recording.
If you need to write NvBuffer via CPU, you need to call NvBufferMemSyncForCpu() before the write, and NvBufferMemSyncForDevice() after the write.