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:
Thank you for your help
Solved! Go to Solution.
I solved the problem by backporting this Linux Kernel commit to the kernel on the i.MX8MP. It uses the non-contiguous memory API and allows the v4l2 buffers to be cached.
By doing so, I get the expected performance when reading the frame buffers from the cameras.
I solved the problem by backporting this Linux Kernel commit to the kernel on the i.MX8MP. It uses the non-contiguous memory API and allows the v4l2 buffers to be cached.
By doing so, I get the expected performance when reading the frame buffers from the cameras.
userptr mode is not supported.