Implentation rDMA in a gstreamer plugin


I already created a plugin for a frame grabber card and I want to include rDMA to GPU into it. I was looking at the code of clara-holoscan-gstnvvideotestsrc to get an idea how to do this task.

I see they are using gstnvdsbufferpool.h and nvbufsurface.h to implement this functionality, so i based my code on this example.
So far it looks like this to create a buffer pool of the size of nvbufSurface object. As i understand, this object will point to the actual memory on GPU.


My question is : I can’t see where i can define the size of the actual buffer on the GPU. It’s not clear in the code from the example gstnvvideotestsrc. If you could point me in the right direction, I would really appreciate it.

Thank you!

The size of the allocated GPU buffers is determined internally by the gst_nvds_buffer_pool based on the buffer width and height specified in the caps (m_caps) that were provided to gst_buffer_pool_config_set_params. While you don’t explicitly set the buffer size, it can be retrieved from a buffer that has been allocated by this pool from the dataSize field in the mapped NvBufSurfaceParams.

thank you for the answer.

I have another question regarding how to write in GPU memory.

I understand from the function :
Function gst_buffer_pool_acquire_buffer

I can get a buffer that contain a NvBufSurface and from this, as I understand, I could access the data
with surf->surface[0].dataPtr

So i’m wondering if i write at the location pointed by this pointer, would it be directly on the GPU? is it the right way of doing things?

thank you!