A virtual display can be attached to a virtual machine. It is a must-have for non-headless scenarios.
The Simple DirectMedia Layer (SDL)-powered display is a local-only low-latency display.
The SDL display is only avalable with virtual machines created using the QEMU/KVM User Session.
Mouse grab does not currently work with the SDL display
The display resolution of your guest display should not exceed that of your physical screen
By default, SELinux will block access to X Windows Server for the virtualization stack. An exception has to be set.
sudo setsebool -P virt_use_xserver 1
sudo ausearch -c 'qemu-system-x86' --raw | audit2allow -M my-qemusystemx86
k
sudo semodule -X 300 -i my-qemusystemx86.pp
echo $DISPLAY
.$ echo $DISPLAY
:0
The same applies to xauth
. On Wayland, it would look like that.
$ echo $XAUTHORITY
/run/user/1000/.mutter-Xwaylandauth.ARIY51
virtio-gpu
.<graphics type="sdl" display=":0" xauth="/run/user/1000/.mutter-Xwaylandauth.ARIY51" fullscreen="yes">
<gl enable="yes"/>
</graphics>
The fullscreen attribute is not honored at the moment
D-Bus is a desktop-oriented middleware that can be used to create a display for a virtual machine.
<graphics type="dbus">
<gl enable="yes"/>
</graphics>
This equates to
-display dbus,gl=on
in QEMU
When the virtual machine is launched, a specific D-Bus address will be choosen, as well as a rendering device:
<graphics type="dbus" address="unix:path=/run/user/1000/libvirt/qemu/run/dbus/8-user-d-bus-dbus.sock">
<gl enable="yes" rendernode="/dev/dri/renderD128"/>
</graphics>
<graphics type="dbus">
<audio id="1">
</graphics>
A third-party tool is required to interact to the D-Bus display.
Libmks, which is under development, is such a tool.
Due to a bug, it is currenlty only possible to connect a D-Bus display with plain QEMU
Libmks has to be built from source.
git clone https://gitlab.gnome.org/GNOME/libmks
cd libmks
meson setup build
cd build
ninja
qemu-system-x86_64 \
-enable-kvm \
-machine q35 \
-drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd \
-cpu host \
-device virtio-vga-gl \
-m 4G \
-smp 2,sockets=1,dies=1,cores=2,threads=1 \
-display dbus,gl=on \
-device virtio-tablet-pci \
-device virtio-keyboard-pci \
./build/tools/mks
As there is no Live ISO or disk attached to the virtual machine, you will eventually land in the UEFI shell.