cuEGLStreamProducerPresentFrame throws 999 error after 64 frames


I’m seeing a weird error calling cuEGLStreamProducerPresentFrame after between 64 - 108 frames (it varies quite a bit). It returns a 999 unknown error, and causes an EGL debug message to be logged:

EGL_BAD_PARAMETER error: In EGL Access Table::stream2.producer.bufferRegister: Invalid buffer handle

Before my call to PresentFrame, I’m calling cuEGLStreamProducerReturnFrame until it returns CUDA_ERROR_LAUNCH_TIMEOUT. On the EGL side, I do both an eglStreamAcquireImageNV and eglStreamReleaseImageNV, which both report that they were successful.

It feels like there’s something I’m not releasing, but I believe I’ve accounted for everything.

There are some other threads on a similar error, such as this, but the underlying issue wasn’t mentioned.

Thanks & Regards

I got to the bottom of this. A new EGLimage is created (and the corresponding ADD_IMAGE event sent to the stream) for each new buffer/cuArray that you present. I was creating a new buffer each frame then freeing it.

I changed the code to reuse the buffer that was returned (or created a new one if enough frames hadn’t been returned yet) and the issue went away.

I still can’t see a way to get the REMOVE_IMAGE event sent to the stream.