Enable spice + virtio-gpu + OpenGL for QEMU

Just switched from Asahi Arch to Asahi Fedora. I haven’t used Fedora for about 15 years I’m not sure how things work over here and currently don’t have the time to figure out how to make a submission/patch correctly and where to do it (sorry).

Setting up a VM with QEMU, with Video Virtio (+ 3D acceleration) and Display Spice (+ OpenGL) currently does not work out of the box. QEMU will crash with a GL_DRAW_COOKIE_INVALID error.

The guys from utm had this same issue last year and patched it, bottom of the page, line 557 of red-qxl.c. It should be highlighted. I am not well versed enough in SPICE to judge if their explanation makes sense or if this causes trouble down the line.

I have (manually) applied this change (removing that single line) to spice-0.15.1-3.fc39.src.rpm, compiled and installed it, and my VM is now accelerated. It has only been a couple of hours on Fedora, but I had been running this same patch on Arch Asahi for quite some time without issue. Note that I haven’t done anything fancy with the acceleration, just accelerated desktop stuff, no gaming or the likes.

Hopefully somebody can take a look at this and maybe fix it in the repo. If not, at least there’ll be another search engine hit for those running into this problem.

EDIT: Tested on M1 Max

That sounds like something that should be submitted upstream to the SPICE project :slight_smile:

I will report it there as well.

EDIT: Fix GL_DRAW_COOKIE_INVALID error with QEMU/virtio-gpu on Apple Silicon (#85) · Issues · spice / spice · GitLab