Jetson Xavier NX tegra_udrm driver DRIVER_MODESET feature

Hello,

We have Jetson Xavier NX board that has tegra_udrm(CONFIG_DRM_TEGRA_UDRM=m from kernel config) driver which does not have DRIVER_MODESET feature.For that reason we can not use most of the functions from drm ioctl api for primary node.Is there any specific reason not to have the DRIVER_MODESET feature for tegra_udrm? Also with current driver implementation, we have only access to render nodes which has limited functions and our goal is to copy an application frame buffer by using DRM_IOCTL_MODE_GETRESOURCES ioctl and DRM_IOCTL_MODE_GETFB calls, from one process to another process by using DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl.

Could you please give me some idea how to proceed with that ?
Regards

Hi,
We have a sample for DRM function, please take a look at

After the installation, you will see it in

/usr/src/jetson_multimedia_api/samples/08_video_dec_drm/

Please try to run it first and see if you can start the development based on it.

Hello,

Thanks for the example.I also implemented similar example by using libdrm api functions.The example that you share contains api that needs modesetting, I guess for example, for drmModeGetResources. And My driver is tegra_udrm which is not supporting modesetting functions such as drmModeGetResources etc.

In my kernel .config file CONFIG_DRM_TEGRA is not set and CONFIG_DRM_TEGRA_UDRM=m is set.So I tried to activate CONFIG_DRM_TEGRA to have modesetting capabilities since that driver has DRIVER_MODESET feature but can not have a successfull build.

So To sum up , It seems to me it is not possible to run the example application you provided because of not having modesetting feature on tegra-udrm driver.

The following is the version from drmGetVersion() function :

Version: 0.0.0
Name: tegra-udrm
Date: 20182809
Description: Kernel DRM support for user mode DRM driver on NVIDIA Tegra Soc

and dmesg:
[ 8.040811] [drm] Initialized tegra-udrm 0.0.0 20182809 on minor 0

So Should I activate some other kernel config or sth else to use drm ioctl functions which require modesetting ? Or Am I missing some point ?

Regards

Hello,

From tegra_udrm_drv.c file , I have observed that libdrm_nvdc should handle which drm APIs to be supported.So It seems to me it is designed to replace libdrm apis by nvidia and I have to use these api to use drm functions which means I do not have the possibility to use DRM_IOCTL_MODE_GETRESOURCES,DRM_IOCTL_MODE_GETFB etc ioctl calls.

Also I did not observe any GEM_CREATE function inside tegra_udrm_drv. So Is there any way to implement such a functionality to create a handle ?

Regards

Hello Again,

I think DRM_IOCTL_TEGRA_GEM_CREATE through drmioctl function should be used for gem_create.

Regards

Hi,
Are you able to adapt your application based on the 08 sample? Or you must use tegra_udrm?

Hello,

I can use drm functions from libdrm_nvdc so do not have to use tegra_udrm. I will try to check and let you know .

Regards

Hi,

May thanks. Since it is the one enabled by default and verified in each release, would be great if you can base on it for development.

Hello,

I tried to implement a small example executable to get resources such as crtc,encoder and tried to get plane resources in order to reach frame buffer of planes.

So I added drmSetClientCap(fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1); to reach all planes.I currently reach 8 planes(overlay and primary planes) and when I dump frame buffer id , it shows me 0 which means there is no frame buffer that is attached to any plane.

In fact, I was expecting to reach wayland compositor’s frame buffer since I run a simple qt application by exporting QT_QPA_PLATFORM=wayland on jetson xavier nx board and then would export the frame buffer by using dma_buf from drmPrimeHandleToFD function to another process.

Is there any idea what might I missed ?

Regards

Hi,
The sample is to render directly through libDRM. Does not work with X11 or Wayland being enabled.

For running QT, there is information in the posts:
PySide2 (Qt for python) installation on Jetson Xavier
Jetson Nano and Qt5

FYR. It works in QT_QPA_PLATFORM=eglfs. Not sure whether it works the same with Wayland.

Hello,

I think there is a misunderstanding here, let me explain it better.So Currently I can run Qt on wayland on jetson xavier nx without any issue by exporting QT_QPA_PLATFORM=wayland. So I created a simple example application on qt and while running the qt application on board, I am trying to reach qt application’s framebuffer in order to export it by using dma_buf from drmPrimeHandleToFD function to another process.

So In order to reach qt application’s framebuffer, I implemented another application to get resources such as crtc,encoder and tried to get plane resources in order to reach frame buffer of planes by using libDRM functions and was expecting to reach it but can not reach qt application’s framebuffer.

Do you have any idea what I am missing here ?
Regards

Hi,
Looks like you are trying to get framebuffer which is being used by Wayland. We have discussion with our team and it looks impossible due to security concern. Not sure if QT supports it. Probably you can go to QT forum to get further assistance.

Hello,

So I think it is a bit weird because as far as I know wayland also uses similar drm apis and In general, I was thinking to create a generic api by using libdrm since it is using a generic kernel drm ioctl apis. If I develop similar application on Android, Qt whatever, I will have this problem and need to find apis in QT,Android etc.

I did further investigation and it seems to me what I need to do is to get existing struct gbm_device that is created by qt application from using gbm_create_device(int fd) function.Currently I could not find an api on QT to reach this gbm_device.

I will ask the question to QT forums as well.

Thanks and Regards

Hello,

There is also one more issue that I observed. I created a dumb buffer successfully with drmModeAddFB function and pass frame buffer id to drmModeSetCrtc function.When I dump the value of crtc->buffer_id , I see 0 instead of created dumb buffer id.

Also, I tried to check default crtc frame buffer id when qt app is active as the following:

drmModeCrtcPtr crtc = drmModeGetCrtc(fd, encoder->crtc_id);
    printf("\n###crtc->buffer_id %d\n",crtc->buffer_id);

It also returns 0.

Can It be a bug or Do I miss something?

And In libdrm there is drmModeGetFB function to get frame buffer ptr which is not implemented in libdrm_nvdc.Is there any specific reason for this ?

Regards

Hello,

From qt application, I have reached to EGLDisplay by using QPlatformNativeInterface and then used eglInitialize to see the egl version which has 1.5.
After that I tried to get existing EGLContext by using eglGetCurrentContext which returns EGL_NO_CONTEXT since after doing this, I would get EGLSurface from eglGetCurrentSurface(EGL_READ) to reach framebuffers.it is also failing with EGL_NO_SURFACE error because there is no egl context.

Do you have any idea why eglGetCurrentContext is returning EGL_NO_CONTEXT error ?

Regards