DRM support

Is there a way to activate the nouveau kernel module, or another kernel module that adds DRM (direct rendering manager) support? I want to use a Wayland compositor and/or write my own code that uses DRM to write to the display directly.

Hi william01110111,

Tegra does not support wayland yet because it actually does not have DRM-KMS in kernel. May I ask what is your purpose for using wayland?

We are developing a Wayland compositor for the interface of the system we are building. An X11 window manager, even a compositing one, would be too limited for our needs, and wouldn’t be future-proof. Is there any plans to support DRM-KMS in the near future? Ubuntu will soon switch to Wayland by default (at 17.10 if I’m not mistaken), and after that, X will slowly start being phased out. It’s probably a good idea to start the switch to Wayland sooner rather then later.

Are you going to support arbitrary linux applications?
If not, you could probably build an even nicer GUI for your system using pure OpenGL and your own design.

Yes, the plan is to support arbitrary Linux apps. Besides, we would have to write to a display one way or another and DRM is the most straight forward way to do it. I suppose I could spin up an X server without a WM and render full screen to that, but that would not be efficient, elegant or compatible with most Wayland compositor libraries.

Well, if you’re going to double down on Wayland specifically, then it seems you’ll have to wait.
Personally, I think an embedded device will do even better with straight GL graphics, but if that’s not an option for you, then that’s unfortunate.

There is no such thing as “straight GL graphics”. We will use OpenGL in our pipeline, but OpenGL is a graphics library. It does not provide a way to display the graphics it renders on the screen. The common ways to do this are:

  • Write an X11 client: relatively easy, but requires an X server which takes resources. Also isn't forward compatible as X will be phased out in the future.
  • Write a Wayland client: also easy, but requires an external Wayland compositor, none of which work (as far as I know) without DRM.
  • Talk directly with the Linux kernel: This is how Wayland compositors are implemented. This isn't as easy, but does not require any other programs to be running to work. This method shouldn't be used lightly (terrible idea for normal desktop app) but in our case it is ideal.

We will start by simply drawing with OpenGL and then displaying that. Later we will implement a full Wayland compositor so we can run arbitrary desktop apps. Before We can do anything though, we need a way to get our OpenGL rendered buffer to the display. DRM is the most documented and forward compatible way to do this.

We are looking into using FBDEV, which (according to my current understanding) is the predecessor to DRM. I still don’t know exactly what the disadvantages of FBDEV are, but presumably there are some or DRM would not have been created.

Yes, the “how to bind a GL context to a display surface” keeps stumping all the smartest minds in the industry.
(This is the same problem that DXGI solves on Windows, which took them like 20 years to get to.)

I was under the impression that Jetson supported OpenWF, but I think I was wrong.

Thus, I agree, you’ll presumably have to support glx for now. Or you can use one of the many “helper” libraries that do this for you, and abstract it away, if you just want to get going on the real software development. I understand that you are worried about “resources,” but in reality, the small X servers aren’t that heavy these days. By the time you actually need those extra dozens of megabytes, hopefully a new way will have presented itself!
Luckily, this is like 200 lines of code, that are easily ripped out and changed whenever you need to target something else. I’ve found that trying to make projects “require the future” is a great way of not getting code shipped – who knows when the switch will really happen :-(

That’s just the take of a snarky doge on the internets, though, so feel free to keep pressuring for better support (like OpenWF) from Nvidia! :-)

You’re right, the resource usage of Xorg probably isn’t that significant. I think I’ll build my compositor with Weston, then I can run X without a window manager and use Westons’s X11 backend. As soon as NVIDIA supports DRM or I switch to another system, I’ll switch to the DRM backend and be running pure Wayland. Thanks for your help.

We enable DRM-KMS which is based on tegra display driver now. If you want to use X11-less rendering method. Please take a look at our MMAPI samples -08_video_dec_drm.