This post shows a way to use the g2d physical contiguous memory for the ISI to using userptr, this buffer will handled by openCL directly, without memcpy.
This demo works on: i.MX8MP L6.1.36, It should be noted that only ISI can support userptr, ISP does not support userptr.
In NXP default BSP release, the camera application only support mmap, It maps buffers from kernel space to the user space, you need to memcpy these buffers for future use:
We can make some change to use the userptr to avoid this memcpy, the 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.
1. Firstly, ISI driver removed userptr to avoid non-continuous memory, we need to revert this change first:
2. Revert get_vaddr_frames function, patch as attached.
3. Change your application, sample application is attached, it creates g2d physical contiguous memory with g2d_alloc, and set uncached memory with this flag CL_MEM_USE_UNCACHED_HOST_MEMORY_VIV.