eglInitialize fails with DRM KMS

Hi, I’m trying to port an existing application to the Jetson Xavier AGX. It currently works in KMS mode. First I tried using tegra-ugm:

# Stop X xerver
sudo service gdm stop; 
sudo ln -sf /usr/lib/aarch64-linux-gnu/tegra/ /usr/lib/aarch64-linux-gnu/
sudo modprobe tegra-udrm modeset=1

I am able to open the gdm device, but eglInitialize fails. I also tried the method with drmOpen (which is what nvrenderer.cpp uses), but eglInitialize fails on that as well.

Please refer to steps in

If you don’t run Westson, the commands are not required:

$ sudo ln -sf /usr/lib/aarch64-linux-gnu/tegra/ /usr/lib/aarch64-linux-gnu/
$ sudo modprobe tegra-udrm modeset=1

I’m unsure if the steps are related. For example I’m trying to run kmscube (Debian -- Details of package kmscube in buster) which fails even with those commands.

Please check if you can run


Jetson Linux API Reference: 08_video_dec_drm (Direct Rendering Manager) | NVIDIA Docs

This is the DRM sample we verify in each release. Suggest you give it a try and develop your usecase based on it.

Ok, so it sounds like using EGL+drm just isn’t supported? I’ve seen that sample and it doesn’t address my issue as the sample doesn’t use EGL.

Not sure if EGL APIs work, but the following demo code works:

    if (ctx->enable_cuda)
        /* Create EGLImage from dmabuf fd */
        ctx->egl_image = NvEGLImageFromFd(ctx->egl_display, fd);
        if (ctx->egl_image == NULL)
            ERROR_RETURN("Failed to map dmabuf fd (0x%X) to EGLImage",

        /* Pass this buffer hooked on this egl_image to CUDA for
           CUDA processing - draw a rectangle on the frame */

        /* Destroy EGLImage */
        NvDestroyEGLImage(ctx->egl_display, ctx->egl_image);
        ctx->egl_image = NULL;

Doing CUDA post processing should work fine.