V4l2 DMA extension support for opengl (EGL_LINUX_DMA_BUF_EXT) is not working

we are trying to capture camera frames (Resolution: 1280x960, UYVY format) using v4l2 and use it in opengl application for further processing,
so to avoid copy between v4l2 and opengl buffers we are using DMA to share the frame data on GPU / opengl textures.

A] Run the application on Ubuntu 20.04 :
encountered issues at eglCreateImageKHR and the error code returned is 0x300c

B] Run the application on Ubuntu 20.04 :
encountered issues at glEGLImageTargetTexture2DOES and the error code returned is 0x0502

This is issue looks like some DMA extension support for opengl driver maybe.

1) v4l2 attributes used : + API

reqbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
reqbuf.memory = V4L2_MEMORY_MMAP;
reqbuf.count = 32;
int res;
res = ioctl(_Fd, VIDIOC_REQBUFS, &reqbuf);

2) EGL imagekhr api + attributes

static EGLint fixedAttribs[11] = {
EGL_WIDTH, (EGLint)_FrameWidth_u32/2,
EGL_HEIGHT, (EGLint)_FrameHeight_1MP_u32,
EGL_LINUX_DRM_FOURCC_EXT, DRM_FORMAT_ARGB8888,
EGL_DMA_BUF_PLANE0_PITCH_EXT, (EGLint)_FrameWidth_u32 * 2,
EGL_NONE
};

eglCreateImageKHR(display, EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0, attrib);

So could you please let use know if DAM mem buffer is accessible which uses opengl via EGL framework

OR any solution/modification needed in the attributes .

Hi,
This approach is not validated and may not work. Would suggest check the sample:

/usr/src/jetson_multimedia_api/samples/12_v4l2_camera_cuda

It demonstrates capturing frame data into NvBufsurface and map to EglImage.

As per the suggestion, we compiled and ran the “12_v4l2_camera_cuda” sample on JetPack R36, and it is working correctly.
However, when attempting to use NVIDIA buffer APIs in our OpenGL-based application, we encounter the following linker error:
undefined reference to NvBufSurf::NvAllocate(NvBufSurf::NvCommonAllocateParam, unsigned int, int)**

We have already linked the libraries “-lnvbufsurface” and “-lnvbuf_utils” in CMakeLists.txt.

The same API works as expected in our CUDA-based application on the same Jetson device, but fails during linking in the OpenGL application.

Could you please advise on how to resolve this issue or clarify if additional libraries or dependencies are required for JetPack R36?

Hi,
NvBufSurf::NvAllocate() is in

/usr/src/jetson_multimedia_api/samples/common/classes/NvBufSurface.cpp

You may refer to it and call directly NvBufSurfaceAllocate().

And -lnvbuf_utils is not required. It is NvBuffer APIs which are deprecated.

We are using glEGLImageTargetTexture2DOES API for attaching EGL image created by NvBufSurfaceEglImage(As you suggested) on the GL_TEXTURE_2D.
EGL image has been created successfully, However getting error of Invalid operation(errorcode: 0x502) with glEGLImageTargetTexture2DOES. Please suggest advise on how to resolve this issue.

Hi,
Please refer to how glEGLImageTargetTexture2DOES() is called in

/usr/src/jetson_multimedia_api/samples/common/classes/NvEglRenderer.cpp

It is supposed to work if you follow the sample code.

In our application we are using compute shader for pixel processing and as as per my understanding compute shader is capable to work with GL_TEXTURE_2D target, But the application reference which you have mentioned are using GL_TEXTURE_EXTERNAL_OES as a target. So, we wanted to load texture image in compute shader by attaching EGL image texture (EGL image is created from V4L2 DMAbuf). Could you please share further steps to investigate as extension support is vendor specific(EGL and OPENGL drivers).

Kindly share your feedback on above query. we are looking forward to hearing from you.

Hi,
Since Jetson is an.embeddes system, OpenGL is not fully supported. These function calls may not work. Would suggest use NvBufSurface APIs and EGL functions.

we are using OPENGLES 3.0 with EGL and same api / formats we have confirmed on other embedded platforms like TI.

We need to use a compute shader with GL_TEXTURE_2D as the texture target. However, in NvEglRenderer.cpp, the texture is currently created with the target GL_TEXTURE_EXTERNAL_OES, as shown in the attached screenshot.
Screenshot from 2025-06-03 14-53-32

Could you please suggest a solution to enable compute shader compatibility in this scenario?

Hi,
This may not be supported on Jetson platforms. We have reference samples in

/usr/src/nvidia/graphics_demos

Please check if either sample can be run to reproduce the issue. If yes, please share the steps. We will set up developer kit and check.

Hello Team,

Find the basic work flow of our application.

To understand better attaching the code here,
CameraApp_ComputeShader.zip (6.2 KB)

We have run above application successfully on another embedded platform but for NVIDIA Jetson AGX Orin it is giving error 0x502 to the function glEGLImageTargetTexture2DOES().

Can you please check above and suggest the changes required.

Hi,
Is the sample doing UYVY to NV12 conversion? If yes, we suggest call NvBufSurfTransform() for the conversion. It shifts the conversion to hardware converter and can avoid this invalid operation.

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