cuGraphicsEGLRegisterImage and NvBufferColorFormat_GRAY8

Previously GRAY8 NvBuffers were not supported. Since my Disparity pipeline produces a grayscale image, I am forced to do an extra conversion from GRAY8->ABGR32 so that I can wrap the result it in an NvBuffer again.

However I noticed that NvBufferColorFormat_GRAY8 was added as an option to nvbuf_utils.h which made me think it was now supported. However if you try to create and register a GRAY8 frame using cuGraphicsEGLRegisterImage it fails with CUDA_ERROR_NOT_SUPPORTED.

Is there any workaround to have a cuda kernel write data into a GRAY8 nvbuffer? I would love to avoid the extra conversion step if possible.

Hi,

Thanks for your question.

Based on our document, there is no CUDA_ERROR_NOT_SUPPORTED return type in the cuGraphicsEGLRegisterImage.
https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__EGL.html#group__CUDA__EGL_1g9f9b026d175238be6f6e79048d6879c5

Would you mind to share a simple reproducible source so we can check it directly?
Thanks.

Hi,
The supported formats are listed in
https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__TYPES.html#group__CUDA__TYPES_1g38337000e43e400e77ad36c7e197a9f2

GRAY8 is not supported. Suggest you convert to valid format(such as RGBA) through NvBufferTransfrom().

Thanks @DaneLLL. Is there any plan to add support for GRAY8 to avoid the extra conversion?

hi,
We don’t have plan to support GRAY8 in CUeglColorFormat. A substitute is to use CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR and fill the UV plane with 0x80.

1 Like