Hi all,
I'm capturing images from a MIPI camera on the i.MX8MP using a GStreamer pipeline. My camera driver uses the ISI and not the ISP.
I use a v4l2src element to grab the images followed by a custom element that does some image transformation:
gst-launch-1.0 v4l2src device=/dev/video1 io-mode=mmap ! mytransformelement ! ...
For testing, the custom GStreamer element just maps the buffer that it receives, reads a subset of the pixel values and writes them to an output buffer.
Now I am facing the problem that the performance is poor. Precisely, the read accesses to the buffer that I receive from v4l2src is very slow s.t. it takes ~500ms to just read the single pixels of a 12MP grayscale image without any further processing. The memory access pattern does not influence this result.
I did some experiments / research and figured out that this behavior is caused by the fact that the CPU access to the DMA-buffer that comes from the camera is not cached (as stated here).
If I do a copy of the buffer using memcpy(), the read operations are cached and are much faster. However, the memcpy itself takes ~200ms s.t. this is not an option.
I already tried to use different io-mode=dmabuf instead of mmap with the same results. Using userptr mode seems to be not supported on the i.MX8.
My questions are:
- Why are the read accesses to the v4l2-buffer not cached?
- Is there a way to change the memory allocation / mapping to allow cached access to the buffer?
- Is the v4l2 buffer mode userptr really not supported on the i.MX8MP?
Thank you for your help