I have implemented a new v4l2 sensor driver and all is working fine except when using USERPTR mode with buffers allocated using posix_memalign(buffer, getpagesize(), buffer_size).
The problem I’m seeing appears to be a caching issue. The first N buffers are captured fine (N is the number of buffers sent in via VIDIOC_REQBUFS). After these N buffers are captured (they are recycled by just calling VIDIOC_QBUF with the previous index), the new captures start to have “lines” of 64 bytes of data that appear to be corruption (actually data from previous acquisition).
If I use MMAP or USERPTR (with PINNED memory) there is no such corruption.
Any help would be appreciated.