From 0aa0a46bb28d5a36601bfabb90a17c392950386d Mon Sep 17 00:00:00 2001 From: Christoph Haag <christoph.haag@collabora.com> Date: Wed, 3 Feb 2021 22:12:17 +0100 Subject: [PATCH] direct-mode: Add VkDisplayKHR backend documentation --- direct-mode.md | 14 +++++++- tegra.md | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 tegra.md diff --git a/direct-mode.md b/direct-mode.md index c06abe7..27ebaed 100644 --- a/direct-mode.md +++ b/direct-mode.md @@ -91,7 +91,19 @@ The `VK_EXT_acquire_xlib_display`/`VK_EXT_direct_mode_display` Vulkan extensions For standalone XR systems or systems that don't support these extensions, it is possible to use `VK_KHR_display` and `VK_KHR_display_swapchain` directly on KMS/DRM without running X.Org altogether. -This is currently not implemented in Monado, but will be supported eventually. +Monado v21.0.0 introduces such a VkDisplayKHR based backend. Its internal structure is very similar to the nvidia backend. + +This backend requires the Vulkan driver to gain exclusive ("drm master") control over the display hardware. This means that an X server or wayland compositor must not be control the "active" vt, it must be a text vt (an X server running "in the background" can still be running in the background). The active vt can be switched with Ctrl+Alt+F1 to F12 or `sudo chvt 1` to 12. + +This backend is only enabled when the environment variable `XRT_COMPOSITOR_FORCE_VK_DISPLAY=0` is used. Its value is the nth display connector. Using a too big number like `XRT_COMPOSITOR_FORCE_VK_DISPLAY=100` will print the available display connectors and the names of the connected displays. + +Note that X servers may not handle well switching to them while the monado compositor is running. Switching to another text vt should work fine. + +Many OpenXR applications will require to be started with an X server - however X servers that are "running in the background" may not accept connections for applications that use the GPU. See [Tegra]({% link tegra.md %}) for an example of how to get it working on the proprietary nvidia driver. + +An OpenXR application that does not require an X server is hello_xr with the Vulkan backend: `hello_xr -G Vulkan`. + +This implementation has been tested on amd (radv) and the proprietary nvidia driver. # Extended Mode in Monado (Linux) diff --git a/tegra.md b/tegra.md new file mode 100644 index 0000000..343a621 --- /dev/null +++ b/tegra.md @@ -0,0 +1,86 @@ +--- +title: "Monado - Running on Tegra" +layout: main +--- + +glslang is not available on Ubuntu 18.04. It can be compiled and installed with the usual procedure: + +``` +https://github.com/KhronosGroup/glslang.git +cd glslang +cmake . -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -Bbuild +ninja -C build install +``` + +Otherwise the instructions from [Getting Started]({% link getting-started.md %}) work on Tegra for extended mode on X11. + +# Direct Mode + +The Vulkan driver for nvidia Tegra does not support vulkan based direct mode (VK_EXT_acquire_xlib_display, VK_EXT_direct_mode_display). + +[Response from nvidia](https://forums.developer.nvidia.com/t/vk-ext-direct-mode-display-not-present-in-vulkan-1-2-on-jetpack-4-4/161593/2): + +> VK_EXT_direct_mode_display is not required for doing direct mode through Vulkan on Jetson. VK_KHR_display and VK_KHR_display_swapchain are supported and those can be used for direct display mode. + +See the `Vulkan on KMS/DRM` section in [Direct Mode]({% link direct-mode.md %}) for details of the implementation in Monado. + +## Applications that require X11 + +Graphical applications do not properly connect to a normally running X server. + +It is possible to run an offscreen X server that runs graphical applications. + +Save a modified copy of the xorg.conf file as + +/etc/X11/xorg.conf.offscreen +``` +# Copyright (c) 2011-2013 NVIDIA CORPORATION. All Rights Reserved. + +# +# This is the minimal configuration necessary to use the Tegra driver. +# Please refer to the xorg.conf man page for more configuration +# options provided by the X server, including display-related options +# provided by RandR 1.2 and higher. + +Section "ServerLayout" + Identifier "Layout0" + Screen 0 "Screen0" +EndSection + +Section "Monitor" + Identifier "Monitor0" + VendorName "Unknown" + ModelName "Unknown" + HorizSync 28.0 - 33.0 + VertRefresh 43.0 - 72.0 + Option "DPMS" +EndSection + +Section "Screen" + Identifier "Screen0" + Device "Device0" + Monitor "Monitor0" + SubSection "Display" + Virtual 1920 1080 + EndSubSection + Option "UseDisplayDevice" "none" +EndSection + +Section "Module" + Disable "dri" + SubSection "extmod" + Option "omit xfree86-dga" + EndSubSection +EndSection + +Section "Device" + Identifier "Tegra0" + Driver "nvidia" +# Allow X server to be started even if no display devices are connected. + Option "AllowEmptyInitialConfiguration" "true" +EndSection +``` + +Then run an X server with the command `Xorg -config ./xorg.conf.offscreen :10`. It should drop to a text vt console. + +Now it is possible to use both `XRT_COMPOSITOR_FORCE_VK_DISPLAY=0` to let the Monado compositor use the display, and to start an OpenGL application that requires an X server with `DISPLAY=:10`, for example `DISPLAY=:10 hello_xr -G OpenGL`. -- GitLab