Accessing the DMA buffer from cuda kernel without the use of EGL image


Using the I can create a dma buffer generated using NvBufferCreateEx so the v4l2 driver can use to capture images. Now if I wanted to access this data in cuda kernel the provided sample uses egl image to do so, is it possible to access the dma buffer pointer without the use of EGL image.

This is the same question as the accepted answer doesn’t confirm if that’s possible without the use EGL.

The case is not supported. For accessing DAM buffer(NvBuffer), it has to be mapped to EGLImage and then get CUDA pointer. If using DAM buffer is not a hard requirement in you ruse-case, you can allocate CUDA buffer for capturing frame data. This is demonstrated in


Thank you for your reply,

I saw the sample provided which uses the MMAP and UserPtr memory methods.
Since I want to reduce the memory copy from the driver image capture to Cuda kernels, I am opting to use the DAM buffer.
Do you think, It’s better to use DMA method rather than using MMAP then copy the memory to Gpu space ?
if that’s the case, is it possible to create EGLImageKHR without a Egldisplay using : NvEGLImageFromFd(NULL, DMA_buf_fd);

Not sure if setting to NULL works. But if there’s no display output, setting to EGL_NO_DISPLAYshall work fine.

1 Like

Hello @DaneLLL

Thank you for your response, I was wondering if you have any idea why I get the following error : “nvbuf_utils: dmabuf_fd 0 mapped entry NOT found” in “egl_image = NvEGLImageFromFd(EGL_NO_DISPLAY, buf_fd);”

P.S : The Buf_fd corresponds to one of the camera buffers (NvBufferTag_CAMERA) and not a renderer buffer like the one used in 12_camera_v4l2_cuda example.

Do you run in headless mode? It shall work when export DISPLAY=:0 is not set.

How do you run the 12_camera_v4l2_cuda in headless mode ?
and if I run this sample when export DISPLAY=:0 is not set I get the same error of my current code :
nvbuf_utils: dmabuf_fd 0 mapped entry NOT found and nvbuf_utils: Can not get HW buffer from FD ... Exiting...

Any ideas ?

Default 12_camera_v4l2_cuda cannot run in headless mode. Please remove NvEglRenderer and try.

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