Skip to content

comp: Add VK display window backend

Christoph Haag requested to merge haagch/monado:kms_backend into master

Not tested on nvidia, only AMD.

Background

Inspired by @pblack: If drm master is not being held by the X server / wayland we don't need to acquire the display. Using VK_KHR_display_swapchain on a VK_KHR_display automagically opens the display on a tty with KMS.

This uses almost the same code path that we use for nvidia, minus the call to vkAcquireXlibDisplayEXT().

Note: The AMD driver will not enumerate any display with vkGetPhysicalDeviceDisplayPropertiesKHR if it does not have the necessary access to their resources. That means when trying to run this backend from an X server, it will fail with

ERROR [comp_window_kms_init] KMS: No Vulkan displays found.

The nvidia driver is supposed to enumerate displays while running X. Swapchain creation is supposed to fail.

See this discussion for details: https://lists.x.org/archives/xorg-devel/2017-October/054909.html

Usage

An X server can be running, but it must not be on the active tty (see sudo fgconsole for current active tty). Switching to a text/kms vt with ctrl+alt+fX is enough to allow monado to take control of display.

First I wanted to make an env var with the display name equivalent to the nvidia XRT_COMPOSITOR_FORCE_NVIDIA_DISPLAY=PNP var but as it turns out all VkDisplayPropertiesKHR::displayName are "monitor" on AMD drivers...

For now this backend uses a numeric variable XRT_COMPOSITOR_FORCE_KMS_DISPLAY=2. Use a big number to get an error message printing all available displays.

On AMD drivers do NOT switch to an X server while this backend is running. It will hang your graphical output and you will need to kill the X server you switched to to get it unstuck again. This can be reproduced with vkcube compiled with vkcube from Vulkan-Tools compiled with the CUBE_WSI_SELECTION=DISPLAY cmake option. We should 1) report this issue to the xserver so it doesn't get stuck 2) detect the vt switch in monado and release the display (not sure if we can keep rendering).

Switching to other text/kms VTs is fine. You can run hello_xr -G Vulkan on a tty, it does not require a X/wayland windowing system to run.

Running OpenXR applications that require an X window with DISPLAY=:0 from a text/kms tty was not successful here but YMMV.

Edited by Jakob Bornecrantz

Merge request reports