enum v4l2_memory {
V4L2_MEMORY_MMAP = 1,
V4L2_MEMORY_USERPTR = 2,
V4L2_MEMORY_OVERLAY = 3,
V4L2_MEMORY_DMABUF = 4,
};
Which is one of the fastest and efficient methods for video streaming without any frame drops.
Userptr, mmap and DMABUF are all methods in order to avoid wasted CPU cycles caused by copying memory (zero-copy), but each have different usecases in which they are useful. An attempt at a simplistic comparison:
Userpointer
MMAP
Method by which the memory is allocated by the driver/in kernel space, and is mapped to the user memory space without any copies. This means the memory can point to DMA-memory (which was allocated in kernel space)
This works well for receiving frames, or sending frames, but in a pipeline where the same frames should be passed through multiple hardware devices (eg capture + encoder + output), only one driver can allocate the buffers. Letting all the drivers allocate their own memory requires userspace to still copy between them. Combining MMAP with a userpointer works for a single receive-send pipeline, but this breaks down further if multiple elements in a chain are needed.
DMABUF
The guys at pengutronix have a nice presentation about this, where these concepts are visualized: https://elinux.org/images/b/b0/OSELAS.Presentation-DMABUF-migration.pdf
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.