We are attempting to share DMA buffers between two separate processes, but can’t quite get it to work.
In the first process, we are creating a DMA buffer using NvBufferCreateEx()
. Once the buffer has been created and filled with our data, we pass the file descriptor returned from NvBufferCreateEx()
over to another process.
In the second process, we attempt to call NvBufferTransform()
(with the file descriptor received from the first process as the src) to transform the buffer into different DMA buffer, but we get the following error:
nvbuf_utils: dmabuf_fd 102 mapped entry NOT found
nvbuf_utils: Can not get HW buffer from FD... Exiting...
NvBufferGetParams failed for src_dmabuf_fd
nvbuffer_transform Failed
So it seems NvBufferTransform()
cannot find the DMA buffer for some reason.
Interestingly, if we don’t try to use NvBufferTransform()
at all, and instead just use mmap on the file descriptor, we can access our data, so we know that the file descriptor passed to the second process is valid. But ultimately we want the data to remain in a DMA buffer, so we don’t really want to use mmap to access the data, which is why we want to use NvBufferTransform()
.
Are there anything wrong with this approach? Or are there any suggestions/examples/documentation on how to share DMA buffers between processes? Or anything else that could be going wrong here?