ANV: VT not restored after using VK_KHR_display
System information
System: Host: fido6 Kernel: 5.15.1-051501-generic x86_64 bits: 64 compiler: gcc v: 11.2.0 Desktop: GNOME 40.5
tk: GTK 3.24.30 wm: gnome-shell dm: GDM3 Distro: Ubuntu 21.10 (Impish Indri)
CPU: Info: 8-Core model: Intel Core i9-9900K bits: 64 type: MT MCP arch: Kaby Lake note: check rev: C cache: L1: 512 KiB
L2: 16 MiB L3: 16 MiB
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 115200
Speed: 800 MHz min/max: 800/5000 MHz Core speeds (MHz): 1: 800 2: 800 3: 800 4: 800 5: 800 6: 800 7: 800 8: 800
9: 800 10: 800 11: 800 12: 800 13: 800 14: 800 15: 800 16: 800
Graphics: Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] vendor: Gigabyte driver: i915 v: kernel bus-ID: 00:02.0
chip-ID: 8086:3e98
Device-2: NVIDIA GA102 [GeForce RTX 3090] driver: nvidia v: 495.44 bus-ID: 01:00.0 chip-ID: 10de:2204
Display: server: X.Org 1.20.13 compositor: gnome-shell driver: loaded: modesetting,nvidia
unloaded: fbdev,nouveau,vesa resolution: 3840x2160~60Hz s-dpi: 96
OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 21.2.2 direct render: Yes
Describe the issue
I implemented support in mpv for VK_KHR_display, and while it works to allow us to display content just fine, we are left with a blank screen after exiting the program. On nvidia, the original VT mode (and contents) are restored. I don't have AMD hardware to test. It seems like the mode should be restored in this situation, as there is no official way to manage saving and restoring the previous mode. You can't use DRM calls to do it without massive contrivances, as you can't keep the drm fd open around your vulkan usage. I implemented a proof-of-concept of using DRM to save the mode details, then close the fd, then reopen and restore after freeing all vulkan state, but this isn't a reasonable thing to do and turns what should be a pure Vulkan implementation into something with a bunch of DRM dependencies.
Doing a VT switch away and back restores the mode and contents.
Please let me know if there's any additional information I can provide. If you want to test the behaviour, you can use mpv.
At least on my hardware I need to specify plane 1.
mpv --no-config --gpu-context=displayvk --gpu-api=vulkan --vulkan-display-plane=1 <file>
Regression
This has never worked in all the time I've tried it, going back to 2019.