Differences between userptr and MMAP in v4l2 capture

Source: Internet
Author: User

The video application can apply for a buffer from the v4l2 driver in two ways.

1. userptr, as the name implies, refers to the user space pointer. the application layer allocates the required memory space and passes it to the v4l2 driver layer as a pointer, the v4l2 driver saves the content of capture to the space indicated by the pointer.

In general, the application layer needs to ensure that the memory space is physically consecutive (the IPU processing unit is required), and the Android system can use the pmem driver to allocate large contiguous physical memory. The application layer is responsible for releasing the applied pmem memory when it is not needed.

2. In MMAP mode and memory ing mode, the app calls vidioc_reqbufs IOCTL to allocate the device buffers. The parameter identifies the required quantity and type. This IOCTL can also be used to change the data of buffers and release the allocated memory. Of course, this memory space is also continuous. Before the application space can access these physical addresses, you must call the MMAP function to map these physical spaces to your virtual address space.

The virtual address space is released through the munmap function, while the physical memory is released through vidioc_reqbufs (set the Buf count parameter to (0 )), the release of physical memory is specific, and MX51 v4l2 is released when the device is disabled.

Therefore, both applications apply for continuous physical memory, but the application and release methods are different.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.