Add support for OpenGL/3D Acceleration (egl-headless, virgl) in QEMU to remotely view output through SPICE #547
Replies: 6 comments 7 replies
-
Thanks for your idea! Just to set the expectations, this is not something which we'll work on soon. Cockpit is primarily a server administration tool, 3D support in VMs sounds more suitable in a desktop application like GNOME Boxes. You can't plumb through such a SPICE view in the browser anyway -- you'll need an external tool (such as spice viewer). That said, if someone wants to integrate this into the project, we are certainly happy to provide some guidance and help. |
Beta Was this translation helpful? Give feedback.
-
Yes the remote machine requires proper SPICE and virt-viewer packages to be installed. That works fine with Cockpit on the remote machine, except there is no 3D support of course. If it was as simple as taking some courses to acquire the expertise I would probably do it, but I doubt it is that simple. lolll Let's see if someone chimes in to help or let's wait for that day when Cockpit maintainers will have it on their priority list... Thanks for the clarification! :) |
Beta Was this translation helpful? Give feedback.
-
I agree with you. The idea of quickly setting up virtual machines and supporting hardware acceleration would be a nice feature. I am actually working on this idea, but sadly haven't managed to get it running. Did you manage to have a headless linux host with a gpu, running linux guest vms utilizing virtio hard acceleration and connecting to the vm remotely via spice or RDP? |
Beta Was this translation helpful? Give feedback.
-
Not that far. I do use Linux Host/Guests, virtio, headless, 3D acceleration and SPICE, but no GPU passthrough and totally outside Cockpit, I use it with Proxmox. |
Beta Was this translation helpful? Give feedback.
-
Absolutely. I am running Host on Wayland and most Guests. I do have some X11 guests but most are Wayland.
From Proxmox? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Page: Virtual Machines
--- Feature description ---
Hello!
This project has a LOT of potential. Your web interface/front-end is gorgeous too! With releases every 2 weeks that's quite agile and should help bring in new features all the time.
I'm hoping to contribute with the following feature request:
There is currently no convenient way in Cockpit to enable OpenGL/3D Acceleration to view the output through SPICE (as well as NoVNC but this one has limitations explained later below), both locally and remotely.
I've heard about using PCI Passthrough, if that works with Cockpit, but it has many limitations (like shutting down the screen when you are local) and opens up all kinds of other non-fixable issues for many use cases. Therefore 3D Acceleration through SPICE has become a well wanted solution for those use cases.
More and more OSes/Apps are leveraging OpenGL/3D Acceleration capabilities which makes this feature through SPICE high on demand, because SPICE is flexible, easy to use, doesn't require the guest to be connected to the network nor an RDP-like service running once the guest has booted up. Therefore SPICE gives access to GRUB menu, boot sequence and BIOS, just like a physical machine. SPICE also has unlimited window geometry (size) as it auto-resizes to your liking and needs and an excellent mouse integration. A simple Googling will return countless posts of people asking for this with other softwares. There's actually a bug in Virt-Manager 3.2 about that as 3D used to work before. I don't know if the bug has been logged, but here we're talking about Cockpit.
As for NoVNC it is tied into the browser front-end and therefore lacks the flexibility of SPICE, which is why I am focusing on SPICE here but the feature doesn't need to be dependent of it.
Support for that feature is already included in the Linux kernel since at least 4.16 I believe. Since a long time ago, Type 2 HyperVisors like VirtualBox already enable this feature by one single click (for both Linux and Windows guests), no other configuration required. As mentioned above Virt-Manager also has this feature, a bit more clicks, but it's there (buggy right now, that's a different story).
Also, to prove it works outside of Cockpit by using QEMU/KVM/libvirt, running locally the guest machine inside a Desktop Environment with the following command works perfectly:
sudo qemu-system-x86_64 -name [domain-name] -drive file=/var/lib/libvirt/images/[domain-name].qcow2 -m 5G -enable-kvm -M q35 -cpu host -smp 6,sockets=1,cores=6,threads=1 -display sdl,gl=on -device virtio-vga,virgl=on -spice unix=on,disable-ticketing=on,image-compression=off,addr=[domain-name].sock,seamless-migration=on
The key is the use of
-display sdl,gl=on
and-device virtio-vga,virgl=on
. Other attributes may vary depending on your VM configuration, I am not sure about those following-spice
.Immediately a SPICE window, with auto-resize feature if supported by the guest, opens up and OpenGL with 3D Acceleration is working, making many modern Linux distros blistering fast and giving an unprecedented user experience.
Without this feature, those distros are laggy, some barely usable, and lack some compositor effects that require OpenGL/3D Acceleration. Even Windows 10/11 slows down a little bit. Some softwares, like rendering or games, require this too.
It is also possible to launch the VM with
egl-headless
display instead ofsdl
and then issue a remote-viewer command line to connect to the domain-name socket. This allows to pass 3D capabilities to the remote machine, although that is probably where most of the implementation challenge is. Working locally is one thing and probably much easier, working remotely is more challenging, but Cockpit is meant to work and maintain remotely.Could you please consider including this feature in your backlog in order to help getting closer to achieve one of Cockpit's goal: making it intended to everyone, including those using OpenGL/3D acceleration.
Beta Was this translation helpful? Give feedback.
All reactions