How to access the NvBufSurface GPU pointer in Python?

• Hardware Platform (Jetson / GPU) : dGPU
• DeepStream Version: 7.0

Hi,

I am configuring a DeepStream pipeline in Python to process multiple video stream.

I added a probe on the src pad of nvosdretrieve the frame. but I have a couple of challenges

I would like to keep the buffer in NV12 and map the frames directly to GPU memory so they can be rendered to the screen using OpenGL.

I was reviewing the deepstream python api documentation, and see the following:

pyds.get_nvds_buf_surface maps the buffer to CPU and only supports RGBA

pyds.get_nvds_buf_surface_gpu return a pointer to the GPU buffer, but it only supports X86 and RGBA format.

I found the following information in other forum posts:

From my own research I figured out that surface->surfaceList[i].dataPtr can be used on dGPU, while on Tegra you have to chain NvBufSurfaceMapEglImage and cuGraphicsResourceGetMappedEglFrame like described here.

My question is how to retrieve an NvBufSurface in a pad probe function using DeepStream Python, and then access the surfaceList as well as the corresponding GPU pointer from it. Are there any relevant examples or function available?

Thank you!

Regarding “be rendered to the screen using OpenGL.”, why not use DeepStream rendering plugin?
Curretly, In python code, only one function of accessing NvBufSurface GPU memory is get_nvds_buf_surface_gpu, but it only supports RGBA format, as commenting in the code.

Thank you for the clarification. This resolves my question.

I am building a PyQt application that uses DeepStream for video streaming and renders the frame in QOpenGLWidget (Qt Widget),which requires access to the NvBufSurface.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.