Undocumented return value.

The cuGraphicsEGLRegisterImage is returning an error value of 1 (CUDA_ERROR_INVALID_VALUE). Referring to the docs [1], such an error value is not listed. Anyone knows what it could mean here?

The values I’m sending look completely sane:

static void Process_EGLImage(const char *src, EGLImageKHR image)
{
  CUgraphicsResource pResource = NULL;
  status = cuGraphicsEGLRegisterImage(&pResource, image,
                                      CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
  if (status != CUDA_SUCCESS) {
    printf("cuGraphicsEGLRegisterImage failed: %d, cuda process stop\n", status);
    exit(1);
  }
  // :
}

The image parameter passed to the function was created by the NvEGLImageFromFd function and checked before being passed.

[1]: https://docs.nvidia.com/cuda/archive/9.0/cuda-driver-api/group__CUDA__EGL.html#group__CUDA__EGL_1g9f9b026d175238be6f6e79048d6879c5

Perhaps I’d better answer my own question, just in case this is helpful to someone else. The EGLImage I was using was created from an NvBuffer (using NvEGLImageFromFd). The NvBuffer’s color format was NvBufferColorFormat_XRGB32, which for some reason did not work. Switching to NvBufferColorFormat_ARGB32 fixed the issue for me.

1 Like