[i.MX8MP] Using userptr on i.MX8MP ISI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[i.MX8MP] Using userptr on i.MX8MP ISI

[i.MX8MP] Using userptr on i.MX8MP ISI

 

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:

TonyLiao_suzhou_0-1707024714237.png

 


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.

TonyLiao_suzhou_1-1707024732446.png

 


 

Solution

 

1. Firstly, ISI driver removed userptr to avoid non-continuous memory, we need to revert this change first:

LF-3334-06: media: isi: remove userptr io mode for ISI capture driver · nxp-imx/linux-imx@10b125f · ...

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.

 

 

Attachments
No ratings
Version history
Last update:
‎02-03-2024 10:32 PM
Updated by: