Trying to access DMA buffer with CUDA but getting 999 error (Unknown) in cuGraphicsEGLRegisterImage

I have YUV420 pitch-layout NvBuffers coming in, which I need to access with CUDA to draw an overlay. I followed 02_video_dec_cuda sample from jetson_multimedia_api and first, get an EGL image from fd, which succeeds. However, cuGraphicsEGLRegisterImage reports error 999, and I’m not sure why?
The buffer is created like this:

    createFmt.layout = NvBufferLayout_Pitch;
    createFmt.payloadType = NvBufferPayload_SurfArray;
    createFmt.colorFormat = NvBufferColorFormat_YUV420;
    createFmt.nvbuf_tag = NvBufferTag_NONE;

and NvBufferMem_Read_Write memory mapping flag.

EGL image is retrieve as (does not fail):

auto eglImage = NvEGLImageFromFd(EGL_NO_DISPLAY, dmaBufFd);

Why CUDA fails to register EGL image?
Is there a way to avoid using EGL images altogether (I’ve seen posts like this and this, but maybe there’s an update on this)?

Runtime devices:

  • main – Jetson Xavier Jetpack 4.4 L4T 32.4.3 (cuda 10.2)
  • also getting same error on: Jetpack 5.1.1 L4T 35.3.1 (cuda 11.4)

Hi,

02_video_dec_cuda doesn’t contain cuGraphicsEGLRegisterImage.
Do you use the sample or a custom one?

Does the default 02_video_dec_cuda meet your use case?

Thanks.

No, it doesn’t.
The cuGraphicsEGLRegisterImage call is in NvCudaProc.cpp inside Handle_EGLImage function.

Is there any other way to access buffers in CUDA without using EGL? Why does it have to go through EGL?

Hi,

You can find the info below:
https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__EGL.html#group__CUDA__EGL_1g9f9b026d175238be6f6e79048d6879c5

Registers the EGLImageKHR is a way to get a GPU buffer pointer.
To check further, could you share a reproducible source with us?

Thanks.

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