Wayland Weston support on TX1 TX2 Xavier Nano
Support for Wayland/Weston has been adapted from the open-source libraries and patches that NVIDIA has published, rather than using the binary-only libraries packaged into the L4T BSP.
Unlike their recent driver releases for x86 platforms, NVIDIA does not provide kernel-level support for DRM/KMS on Tegra. Instead, the BSP includes a stripped-down and not-quite-ABI-compatible copy of
libdrm.so (binary-only, of course) to emulate a minimal amount of userspace DRM support for bootstrapping EGLStreams.
This wasn't needed for running X11, since the BSP comes with an X display driver, but it is needed for running Weston. Unfortunately, the L4T
libdrm library interfered with builds, since it causes segfaults when loaded into QEMU, which is used for generating GObject Introspection data files during a build.
To work around this issue, a shim library was created. On initialization, the shim checks if it's running on real hardware; if so, it dynamically loads all of the symbols from NVIDIA's
libdrm.so and passes through all of the function calls to that library. If not, it has stubs that return error values for all of the libdrm APIs. Since none of the build-time emulation actually needs to call on any of these functions, this appears to work OK.
Mesa build changes
The Mesa build has been changed to:
- disable its DRI drivers for Tegra platforms, since they aren't supported there
- patch EGL and GLES2 headers to include the NVIDIA-specific extension headers, which are installed from the Tegra Multimedia API SDK.
- For L4T R32.1 and later, enable
The xserver-xorg build has also been changed to disable DRI and KMS support on Tegra platforms.
Starting with L4T R32.1, the BSP uses libglvnd rather than including pre-built copies of the OpenGL/EGL/GLES libraries.
The egl-wayland extension is built from source, with an additional patch to correct an issue with detecting Wayland displays and surfaces. The recipe also installs the needed JSON file so that the extension can be found at runtime.
Besides the EGLStream/EGLDevice patches for Weston from ArchLinux, a couple of extra patches were needed to account for the pseudo-DRM support on Tegra.
--use-egldevice option gets added to the command line when starting Weston to activate this support.
The following tests are performed:
- Verify that
- Verify that weston starts at boot time.
- Verify that weston sample programs, such as
weston-simple-egl, display appropriate output.
- Verify that the
nveglglessinkgstreamer plugin works with the
winsys=waylandparameter by running a gstreamer pipeline to display an H.264 video. Note that the
DISPLAYenvironment variable must not be set, per the NVIDIA documentation.