qemu 8.1.0 breaks gvt-g + qemu-ui-gtk w gl=on (black screen, qemu: eglCreateImageKHR failed)
Host environment
- Operating system: Manjaro latest, Artix latest
- OS/kernel version: Linux a-PC 6.4.14-1-MANJARO
- Architecture: x86_64
- CPU: i5-5300u
- GPU driver: mesa 23.1.6-3 (i915)
- QEMU flavor: qemu-system-x86_64
- QEMU version: QEMU emulator version 8.1.0
- QEMU command line:
./qemu-system-x86_64 -M q35 -m 4096 -enable-kvm -hda win10.qcow2 \ -drive if=pflash,format=raw,readonly=on,file=/usr/share/edk2-ovmf/x64/OVMF_CODE.fd \ -drive if=pflash,format=raw,file=/home/user/VM/win10/OVMF_VARS.fd \ -display gtk,gl=on \ -video none -device vfio-pci,sysfsdev=/sys/bus/mdev/devices/$GVT_GUID,x-igd-opregion=on,romfile=/home/user/VM/i915ovmf.rom,display=on,ramfb=on,driver=vfio-pci-nohotplug
Emulated/Virtualized environment
- Operating system: Windows 10 21H1
- Architecture: x86_64
Description of problem
As of 8.1.0, qemu-ui-gtk renders a black window with the error qemu: eglCreateImageKHR failed
repeatedly appearing in the command line.
experiments
- fresh artix-runit-xfce install, no luck
- gl=es, no luck (gl=off is impossible w DMA_BUF)
-
video qxl
+ gtk with gl=on -> works fine - glxgears runs fine, so does 0ad, so do the openGL ES angle demos (they all use gles + egl)
- source build instead of versioned repo package, no luck
- change q35 to 8.0, no luck
- the mother of all downgrades: qemu 8.1.0 to 8.0.4 -> works fine again like it used to!!
Steps to reproduce
- enable kernel modules, set parameters etc.
- create vgpu
echo "$GVT_GUID" > "/sys/devices/pci0000:00/0000:00:02.0/mdev_supported_types/i915-GVTg_V4_2/create"
- launch VM
- wait
Instructions (a small part of which I wrote by trial and error) for the setup are on the Arch Wiki.
observed results
OVMF is displayed correctly through ramfb=on and EFI states it is booting Windows from the HDD.
Sometimes, Windows boot animation is displayed below Tiano Core logo when "configuring devices".
Then qemu-ui-gtk resizes to the resolution set in Windows and displays a black guest screen, repeatedly printing qemu: eglCreateImageKHR failed
to the terminal, with varying speed, likely on guest screen refreshes.
After 1-2 minutes qemu CPU usage goes down to usual "Windows is idling" levels (fairly high due to 60fps guest display redraws but I guess that can't be avoided).
Additional information
Windows is installed directly to a second SSD, I dual-boot it.
I've been using this exact VM, from libvirt, for almost two years.
relevant sections:
<hostdev mode="subsystem" type="mdev" managed="no" model="vfio-pci" display="off">
<source>
<address uuid="$GVT_GUID"/>
</source>
</hostdev>
</devices>
<qemu:commandline>
<qemu:arg value="-display"/>
<qemu:arg value="gtk,gl=on,zoom-to-fit=off"/>
<qemu:env name="DISPLAY" value=":0.0"/>
</qemu:commandline>
<qemu:override>
<qemu:device alias="hostdev0">
<qemu:frontend>
<qemu:property name="x-igd-opregion" type="bool" value="true"/>
<qemu:property name="driver" type="string" value="vfio-pci-nohotplug"/>
<qemu:property name="ramfb" type="bool" value="true"/>
<qemu:property name="display" type="string" value="on"/>
<qemu:property name="romfile" type="string" value="/home/user/VM/vbios_gvt_uefi.rom"/>
</qemu:frontend>
</qemu:device>
</qemu:override>
The patched vBIOS necessary to use DMA-BUF with OVMF is linked there too, but its successors doesn't work either.
how to downgrade qemu to 8.0.4 (assuming arch-based)
sudo pacman -S qemu-desktop
sudo pacman -Rdd qemu-audio-pipewire
sudo downgrade qemu-audio-alsa qemu-audio-dbus qemu-audio-jack qemu-audio-oss qemu-audio-pa qemu-audio-sdl qemu-audio-spice qemu-base qemu-block-curl qemu-block-dmg qemu-block-nfs qemu-block-ssh qemu-chardev-spice qemu-common qemu-hw-display-qxl qemu-hw-display-virtio-gpu qemu-hw-display-virtio-gpu-gl qemu-hw-display-virtio-gpu-pci qemu-hw-display-virtio-gpu-pci-gl qemu-hw-display-virtio-vga qemu-hw-display-virtio-vga-gl qemu-hw-usb-host qemu-hw-usb-redirect qemu-hw-usb-smartcard qemu-system-x86 qemu-system-x86-firmware qemu-ui-curses qemu-ui-dbus qemu-ui-egl-headless qemu-ui-gtk qemu-ui-opengl qemu-ui-sdl qemu-ui-spice-app qemu-ui-spice-core qemu-vhost-user-gpu qemu-desktop qemu-img
Or pacman -Rdd
all of the above and then pacman -U *.tar.zst
from a dir containing the 8.0.4 packages.
Good thing my SSD is a mess and these old packages are still present!
If anyone wants them I can upload them.
Then the VM works just fine, full gvt-g + qemu gtk-opengl performance.
reason for wanting GVT-G + gtk w openGL
On weak CPUs like my 5300u, this combo gives almost-native performance and full 3d accel!!