utmapp / UTM

Virtual machines for iOS and macOS
https://getutm.app
Apache License 2.0
26.98k stars 1.35k forks source link

UTM gl acceleration red artifacts, blank apps #5043

Open thedustinmiller opened 1 year ago

thedustinmiller commented 1 year ago

Describe the issue
In a linux guest all -gl, gpu accelerated displays show red artifacts during animations and some applications, like firefox, don't render at all and are transparent. X11 environments are much worse, with the desktop rendering as all black save for window edges. I've tried all the solutions for the mesa 22.1.7 bug with varying outcomes. Downgrading mesa to 22.1.7 mostly works, but puts me into dependency nightmares. Applying the patch from the main mesa post doesn't produce different behavior. Switching to non gpu accelerated displays behaves normally, but obviously performance is much worse. The same issues appear across multiple debian based distros and arch based distros. There don't appear to be any errors in dmesg or journalctl.

Thanks in advance for any help.

Guest Configuration Arch Desktop env: KDE Plasma 5.27.0 (wayland) (gnome acts similarly, x11 versions of both either crash or just show black screens) Kernel: 5.19.8-1-aarch64-ARCH mesa: mesa 22.3.4 (with virgl UTM patch)

UTM Configuration

Debug log
Running: -L /Applications/UTM.app/Contents/Resources/qemu -S -spice "unix=on,addr=/Users//Library/Group Containers/WDNLXAD4W8.com.utmapp.UTM/0372C6D6-00DF-4C2C-9A11-B9C5EB062593.spice,disable-ticketing=on,image-compression=off,playback-compression=off,streaming-video=off,gl=on" -chardev spiceport,id=org.qemu.monitor.qmp,name=org.qemu.monitor.qmp.0 -mon chardev=org.qemu.monitor.qmp,mode=control -nodefaults -vga none -device virtio-net-pci,mac=86:C6:A1:80:A5:8C,netdev=net0 -netdev vmnet-bridged,id=net0,ifname=en0 -device virtio-ramfb-gl -cpu host -smp cpus=8,sockets=1,cores=8,threads=1 -machine virt -accel hvf -drive if=pflash,format=raw,unit=0,file=/Applications/UTM.app/Contents/Resources/qemu/edk2-aarch64-code.fd,readonly=on -drive "if=pflash,unit=1,file=/Users//Library/Containers/com.utmapp.UTM/Data/Documents/archboot eos.utm/Data/efi_vars.fd" -m 8192 -device intel-hda -device hda-duplex -device nec-usb-xhci,id=usb-bus -device usb-tablet,bus=usb-bus.0 -device usb-mouse,bus=usb-bus.0 -device usb-kbd,bus=usb-bus.0 -device qemu-xhci,id=usb-controller-0 -chardev spicevmc,name=usbredir,id=usbredirchardev0 -device usb-redir,chardev=usbredirchardev0,id=usbredirdev0,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev1 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,bus=usb-controller-0.0 -chardev spicevmc,name=usbredir,id=usbredirchardev2 -device usb-redir,chardev=usbredirchardev2,id=usbredirdev2,bus=usb-controller-0.0 -device virtio-blk-pci,drive=driveA19C4308-2037-428E-B469-E9B250807EBF,bootindex=0 -drive "if=none,media=disk,id=driveA19C4308-2037-428E-B469-E9B250807EBF,file=/Users//Library/Containers/com.utmapp.UTM/Data/Documents/archboot eos.utm/Data/A19C4308-2037-428E-B469-E9B250807EBF.qcow2,discard=unmap,detect-zeroes=unmap" -device virtio-serial -device virtserialport,chardev=vdagent,name=com.redhat.spice.0 -chardev spicevmc,id=vdagent,debug=0,name=vdagent -name "archboot eos" -uuid 0372C6D6-00DF-4C2C-9A11-B9C5EB062593 -device virtio-rng-pci qemu-aarch64-softmmu: warning: Spice: playback:0 (0x1218da140): setsockopt failed, Operation not supported on socket qemu-aarch64-softmmu: warning: Spice: record:0 (0x1218da1e0): setsockopt failed, Operation not supported on socket gl_version 30 - es profile enabled WARNING: running without ARB/KHR robustness in place may crash vrend_renderer_fill_caps: Entering with stale GL error: 1280 GLSL feature level 130 mismatch in number of interps 1 1 GL error reported (1280) for context 4

ktprograms commented 1 year ago

Unfortunately I have no idea why the patch doesn't work for a lot of people. When I have time I'll try to see what the problem is. Other than that there isn't really a solution, sorry.

thedustinmiller commented 1 year ago

There were a couple things that came to mind that might be useful.

  1. Parallels is able to use virgl + virtio_gpu without needing to install special drivers. If that could be a useful lead to follow I can attach and compare the relevant info.

  2. This might be a more general bug with mesa + virgl. Consumer Nvidia GPUs usually don't work with virgl, but I was able to trick it in KVM/QEMU by messing with some egl devices. I haven't been able to reliably reproduce it, but if I do enough switching between windows on the guest and host the red artifacts occasionally appear on the guest. Who knows, maybe this will be an easy way to reproduce an elusive mesa/virgl bug.

Unfortunately my knowledge of systems and graphics is limited, so if there is more specific information I could provide or things to test please let me know.

sbritorodr commented 1 year ago

Same error here. For the sake of replicating the bug, the Archlinux-tweak-tol gives a black screen and doesn't work. X11 doesn't seem to even work, but at least wayland gives signal.

Guest config: same as OP, but I didn't apply any external patch

Host config: MacOS 13.1 Mac Chip: Intel core i5