Hello fellow nvidia developers,
I have read the amazing documentations of “Deepstream”, “CUDA for Tegra” and “Gstreamer” but failed to grasp the key concepts of shared SoC DRAM management. As far as I understand even if the memory is the same Hardware-wise, the cache usage and addressing differs between Device Memory, Pageable Host Memory, Pinned Memory, Unified Memory and Surface Array . I get that I should choose the memory type according to the process device, for example; Surface Array for Jetson iGPU operations. Please correct me if I am wrong so far.
So with these in mind I am trying to write a custom plugin for Deepstream and while inspecting the provided gst-dsexample I have failed to understand which type of memory does GstBuffer uses initially. Also I want to process frames on iGPU using OpenVX and I know OpenVX works on GPU but since I don’t know the initial memory type, I am clueless on how to pass frame data.
So basically my questions are : How to pass frame from GstBuffer to vximage while maximizing performance on iGPU? Do I need to use an EglImage instance or is an NvBufSurface instance?
I have also noticed concept of Zero-copy but I don’t know if that can be applied here.
Thanks in advance. :^)
Hi,
We don’t have experience of using vximage. Is it a CUDA buffer? If yes, you may refer to the sample code:
It demonstrates calling NvBufSurfaceMapEglImage() to get EglImage and cuGraphicsEGLRegisterImage(), cuGraphicsResourceGetMappedEglFrame to get CUDA pointer. If vximage is CUDA buffer, you can move data through the pointer.
I get “0” from status values which indicates everything is OK but when I try to manipulate data using openvx functions I get segmentation error. I suspect it is because I am failing to Map the Gstbuffer data to a NvBufSurface instance as a read/write buffer accessible by GPU. Is it because I don’t use EglImage ? Or am I doing everything wrong?
Hello @DaneLLL ,
thank you for your time, I have figured it out thanks to one of your older posts. For those who come across the same issue here is the proper way to create vxImage from NvBufSurface.
First comes the convertion from NvBufSurface to EGLImage. Original code is from DaneLLL’s older post