CUDA/OpenGL interop with EGLStream causes OpenGL out-of-memory error

Hi,

I am trying to use an EGLStream to send images from CUDA to OpenGL. Everything is “working” as expected except that I am not able to read from the external texture in the fragment shader. When I enable debug output in OpenGL I get the following error when I am trying to access the external texture in the fragment shader:

GL CALLBACK: ** GL ERROR ** type = 0x824c, severity = 0x9146, message = GL_OUT_OF_MEMORY error generated. Failed to allocate memory for texture.

System config:

  • OS: Debian 9
  • GPU: Quadro P4000
  • Driver: 396.54
  • CUDA: 9.2

My app starts two threads which are performing the tasks in the following order:

OpenGL thread:

  • Create X11 window
  • Create EGLContext with window as surface
  • Create EGLStream
  • Create external texture and register as consumer
  • Setup other OpenGL stuff (shader, vertex data)
  • Start CUDA thread
  • Wait for new frame in stream
  • Aquire frame
  • Draw frame to window
  • Release frame
  • Synchronize CUDA thread

CUDA thread:

  • Connect to EGLStream as producer
  • Create CUDA surface (RGBA8)
  • Fill surface with solid color
  • Present surface to EGLStream
  • Wait for returning frame
  • Cleanup

The “Draw frame to window” step always fails with the previously mentioned error message and the CUDA thread never receives the frame returned by the OpenGL thread.

Is it possible to use an EGLStream to send images from CUDA to OpenGL or do I have to change somthing in the setup of the app?

I would be really happy about some feedback.
nvidia-bug-report.log.gz (120 KB)