GNOME Bugzilla – Bug 762727
Add virtio-gpu & virgl, if supported by guest OS
Last modified: 2018-01-11 10:37:02 UTC
This patch is untested. Assuming your host has all the latest qemu/libvirt/libvirt-glib/osinfo/spice-gtk etc, then this patch should be enough to setup a VM with virgl support. Most of the required bits are already merged upstream and pending release, the libvirt/libvirt-glib/osinfo are not yet upstream.
Created attachment 322465 [details] [review] RFC: virtio-gpu + virgl
(In reply to Marc-Andre Lureau from comment #1) > Created attachment 322465 [details] [review] [review] > RFC: virtio-gpu + virgl Seems libvirt-glib patches have been merged a while back and spice-gtk too. I didn't see any patches on libosinfo list for this. Is it possible it's your your hard drive?
Created attachment 331517 [details] [review] Add virtio-gpu + virgl to new VMs If guest OS is known to support virtio-gpu, add the required bits to new VMs for enabling virgl. Based on a patch from Marc-André Lureau <marcandre.lureau@gmail.com>. ----- The only OS that this change is supposed to enable virgl for, is Fedora 24 and creating a VM with virgl setup, Boxes fails to connect to the VM. The host is also F24. Here is the troubleshooting log: ------- gl_version 33 - core profile enabled main_channel_link: add main channel client main_channel_handle_parsed: agent start on_new_display_channel_client: FIXME: GL not supported on this kind of connection red_dispatcher_set_cursor_peer: inputs_connect: inputs channel client create dcc_gl_draw_item_new: FIXME: client does not support GL scanout ----- Here are the relevant xml config bits: ----- <video> <model type='virtio' heads='1' primary='yes'> <acceleration accel3d='yes'/> </model> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <graphics type='spice' autoport='no' listen='127.0.0.1'> <listen type='address' address='127.0.0.1'/> <image compression='off'/> <gl enable='yes'/> </graphics> ----- s Please edit the description (first line) and comment (other lines). Lines
Created attachment 331518 [details] [review] Require libvirt-gconfig >= 0.2.4 We need to depend on next libvirt-gconfig for using the new API reequired for adding virtio-gpu and virgl to domains.
Created attachment 331519 [details] [review] Add virtio-gpu + virgl to new VMs If guest OS is known to support virtio-gpu, add the required bits to new VMs for enabling virgl. Based on a patch from Marc-André Lureau <marcandre.lureau@gmail.com>.
(In reply to Zeeshan Ali (Khattak) from comment #3) > > The only OS that this change is supposed to enable virgl for, is Fedora 24 > and creating a VM with virgl setup, Boxes fails to connect to the VM. The > host is also F24. Here is the troubleshooting log: > > ------- > gl_version 33 - core profile enabled > main_channel_link: add main channel client > main_channel_handle_parsed: agent start > on_new_display_channel_client: FIXME: GL not supported on this kind of > connection > red_dispatcher_set_cursor_peer: > > <graphics type='spice' autoport='no' listen='127.0.0.1'> > <listen type='address' address='127.0.0.1'/> > <image compression='off'/> > <gl enable='yes'/> > </graphics> > > ----- > > s Please edit the description (first line) and comment (other lines). Lines Could you check if Boxes is actually trying to connect with open_graphics_fd() in this case? Could you provide qemu command line that Boxes/libvirt is running?
Created attachment 331528 [details] [review] Add virtio-gpu + virgl to new VMs Rebased on current git master.
(In reply to Marc-Andre Lureau from comment #6) > (In reply to Zeeshan Ali (Khattak) from comment #3) > > > > The only OS that this change is supposed to enable virgl for, is Fedora 24 > > and creating a VM with virgl setup, Boxes fails to connect to the VM. The > > host is also F24. Here is the troubleshooting log: > > > > ------- > > gl_version 33 - core profile enabled > > main_channel_link: add main channel client > > main_channel_handle_parsed: agent start > > on_new_display_channel_client: FIXME: GL not supported on this kind of > > connection > > red_dispatcher_set_cursor_peer: > > > > > <graphics type='spice' autoport='no' listen='127.0.0.1'> > > <listen type='address' address='127.0.0.1'/> > > <image compression='off'/> > > <gl enable='yes'/> > > </graphics> > > > > ----- > > > > s Please edit the description (first line) and comment (other lines). Lines > > Could you check if Boxes is actually trying to connect with > open_graphics_fd() in this case? Yes, just ran in gdb with break point on gvir_domain_open_graphics_fd() and gdb did break as expected on connecting to the box. > Could you provide qemu command line that Boxes/libvirt is running? LC_ALL=C LD_LIBRARY_PATH=/home/zeenix/jhbuild/lib PATH=/home/zeenix/jhbuild/bin:/home/zeenix/jhbuild/sbin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/zeenix/bin:/home/zeenix/.local/bin HOME=/home/zeenix USER=zeenix LOGNAME=zeenix QEMU_AUDIO_DRV=spice /usr/bin/qemu-kvm -name fedora24-wor,debug-threads=on -S -machine pc-i440fx-2.6,accel=kvm,usb=off -cpu Haswell-noTSX -m 2048 -realtime mlock=off -smp 4,sockets=1,cores=2,threads=2 -uuid 54144da6-6f4e-47b5-8501-e479969491e0 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/home/zeenix/.config/libvirt/qemu/lib/domain-1-fedora24-wor/monitor.sock,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-reboot -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -kernel /home/zeenix/.cache/gnome-boxes/fedora24-wor-kernel -initrd /home/zeenix/.cache/gnome-boxes/fedora24-wor-initrd -append ks=hd:sda:/fedora.ks -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x6.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x6 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x6.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x6.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/home/zeenix/.local/share/gnome-boxes/images/fedora24-wor,format=qcow2,if=none,id=drive-virtio-disk0,cache=writeback -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=2 -drive file=/home/zeenix/Downloads/Fedora-Workstation-netinst-x86_64-24-1.2.iso,format=raw,if=none,id=drive-ide0-1-0,readonly=on -device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1 -drive file=/home/zeenix/.cache/gnome-boxes/fedora24-wor-unattended.img,format=raw,if=none,id=drive-usb-disk0 -device usb-storage,drive=drive-usb-disk0,id=usb-disk0,removable=off -netdev tap,fd=25,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:6d:a2:0b,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -device usb-tablet,id=input0 -device usb-mouse,id=input1 -device usb-kbd,id=input2 -spice disable-ticketing,image-compression=off,gl=on,seamless-migration=on -device virtio-vga,id=video0,virgl=on,bus=pci.0,addr=0x2 -device AC97,id=sound0,bus=pci.0,addr=0x4 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x8 -msg timestamp=on
Seems spice-gtk was old on my jhbuild install. After upgrading it, I'm able to connect to virgl-using f24 guest. However: * I'm unable to save the VM. I didn't see an error the first time in the log so to tried again from virsh: # managedsave fedora24-wor error: Failed to save domain fedora24-wor state error: internal error: unable to execute QEMU command 'migrate': There's a migration process in progress * For some reason I'm most of the time unable to connect to VMs with latest spice and spice-gtk+ but I'm unsure where the issue lies. I get tons of warnings on console: (gnome-boxes:14150): Gtk-WARNING **: GtkGrid 0xc9dcc0 is drawn without a current allocation. This should not happen. (gnome-boxes:14150): Gtk-WARNING **: GtkOverlay 0xfb62a0 is drawn without a current allocation. This should not happen. It might be just a coincidence but I had more luck connecting to virgl guest than qxl guest. I was unable to connect to qxl guest 100% of the time actually. I just get a black screen.
Created attachment 331598 [details] [review] Require spice-gtk >= 0.32 We need to depend on latest spice-gtk so ensure spice-gtk is able to handle virtio-gpu+virgl setup. --- This patch will come before "Add virtio-gpu + virgl to new VMs".
For current Fedora 25 and Fedora 26, gnome-boxes removes the GL directive from the machine description file effectively disabling VirGL 3D, see https://bugzilla.redhat.com/show_bug.cgi?id=1367660. Fedora 26 includes the very latest (stable) packages including - gnome-boxes-3.24.0-1.fc26 - libvirt-*-3.2.1-1.fc26 - libvirt-glib-1.0.0-2.fc26 - spice-gtk3-0.33-3.fc26 With Fedora 25, it is at least possible to work around this issue by launching a VirGL-enabled VM by means of 'virsh start ..' and connecting to the running session with gnome-boxes. With Fedora 26, even this is no longer possible: gnome-boxes simply crashes when clicking the corresponding thumbnail.
For current Fedora 27, gnome-boxes removes the GL directive from the machine description file effectively disabling VirGL 3D, see https://bugzilla.redhat.com/show_bug.cgi?id=1367660. Fedora 27 features the very latest (stable) packages including - gnome-boxes-3.26.1-2.fc27 - libvirt-*-3.7.0-2.fc27 - libvirt-glib-1.0.0-2.fc26 - spice-gtk3-0.34-1.fc27 With Fedora 25, it was at least possible to work around this issue by launching a VirGL-enabled VM by means of 'virsh start ..' and connecting to the running session with gnome-boxes. With Fedora 27, even this is no longer possible: gnome-boxes simply sits there indefinitely without connecting to the corresponding VM.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-boxes/issues/83.