DMA Buf import to Vulkan

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

DMA Buf import to Vulkan

4,265 Views
AB22
Contributor III

I am using an i.MX8M Plus with a MIPI camera. I am writing a compute shader in Vulkan to do video processing. I have a DMA buffer setup which receives the camera frames using V4L2 and the DMA-buf heap protocol. The DMA buffer is in cma-uncached memory. I can memory map this buffer and it appears to be functioning correctly. When I pass the file descriptor to Vulkan, I am unable to get the memory to import. My understanding is that the CPU and GPU share memory so what I am attempting should be possible. Is this correct? Vulkan validation layers do not indicate any problems but the frame data is not imported into my vkBuffer. Any suggestions would be appreciated.

0 Kudos
Reply
3 Replies

4,252 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @AB22 

I think you may need more debug steps about the data handling process.

1.Make sure the V4L2 driver is working as your want, that frame is stored in memory correctly.

2. I can memory map this buffer and it appears to be functioning correctly

--> Once you check the step1, then check the buffer after mapped.

3.When I pass the file descriptor to Vulkan, I am unable to get the memory to import

-->Firstly, verify dma-buf-import not using VULKAN API. This step is to check if you can dump frame with dma-buf framework.

 

Best Regards

Zhiming

0 Kudos
Reply

4,247 Views
AB22
Contributor III

Hi @Zhiming_Liu 

  Thank you for responding. I should elaborate on my testing.

1. We have used the V4L2 driver with this MIPI camera extensively. 

2. After using mmap() with reference to the dma-buf file descriptor, I can memcpy and average a portion of the dma-buf and the values change as I adjust the amount of light reaching the camera.

I will attempt to use the user-space dma-buf commands to import the dma-buf without Vulkan as you suggest.

0 Kudos
Reply

4,243 Views
AB22
Contributor III

Hi @Zhiming_Liu 

Based on my reading of:

https://docs.kernel.org/driver-api/dma-buf.html

In the section entitled, "CPU Access to DMA Buffer Objects". I believe I am correct in using mmap to look at the dma-buf contents. I don't see another user-space command for this purpose. Is there one I am missing?

0 Kudos
Reply