I set up a vm with gvt-g in virt-manager and it works fantastic, I’m getting 60fps rendering output when I playback video and even games. But for some unknown reason, the cursor seems to be locked to low framerates, it might be 30fps but it’s possibly even lower than that.
I thought maybe since the rendering results are so good, if I’d fully passthrough the mouse I could work around the issue that way, but no dice, cursor still behaved the same.
Full VM libvirt/xml config
<domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">
<name>Windoze_GVT</name>
<uuid>3c5e73bd-fba0-4cf0-b024-a38814cc8d90</uuid>
<title>Windoze GVT</title>
<description>Windoze 10 With GVT-G</description>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://microsoft.com/win/10"/>
</libosinfo:libosinfo>
</metadata>
<memory unit="KiB">16777216</memory>
<currentMemory unit="KiB">16777216</currentMemory>
<vcpu placement="static">8</vcpu>
<os>
<type arch="x86_64" machine="pc-q35-6.1">hvm</type>
<loader readonly="yes" type="pflash">/usr/share/edk2-ovmf/x64/OVMF_CODE.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/Windoze_GVT_VARS.fd</nvram>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
<hyperv>
<relaxed state="on"/>
<vapic state="on"/>
<spinlocks state="on" retries="8191"/>
</hyperv>
<vmport state="off"/>
</features>
<cpu mode="host-model" check="partial">
<topology sockets="1" dies="1" cores="4" threads="2"/>
</cpu>
<clock offset="localtime">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
<timer name="hypervclock" present="yes"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/home/rabcor/Windoze/vm-files/Windoze.img"/>
<target dev="sda" bus="sata"/>
<address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>
<controller type="usb" index="0" model="qemu-xhci" ports="15">
<address type="pci" domain="0x0000" bus="0x02" slot="0x00" function="0x0"/>
</controller>
<controller type="sata" index="0">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1f" function="0x2"/>
</controller>
<controller type="pci" index="0" model="pcie-root"/>
<controller type="pci" index="1" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="1" port="0x10"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0" multifunction="on"/>
</controller>
<controller type="pci" index="2" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="2" port="0x11"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x1"/>
</controller>
<controller type="pci" index="3" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="3" port="0x12"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x2"/>
</controller>
<controller type="pci" index="4" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="4" port="0x13"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x3"/>
</controller>
<controller type="pci" index="5" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="5" port="0x14"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x4"/>
</controller>
<controller type="pci" index="6" model="pcie-root-port">
<model name="pcie-root-port"/>
<target chassis="6" port="0x15"/>
<address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x5"/>
</controller>
<controller type="pci" index="7" model="pcie-to-pci-bridge">
<model name="pcie-pci-bridge"/>
<address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
</controller>
<controller type="virtio-serial" index="0">
<address type="pci" domain="0x0000" bus="0x03" slot="0x00" function="0x0"/>
</controller>
<interface type="network">
<mac address="52:54:00:cb:a9:1d"/>
<source network="default"/>
<model type="e1000e"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</interface>
<serial type="pty">
<target type="isa-serial" port="0">
<model name="isa-serial"/>
</target>
</serial>
<console type="pty">
<target type="serial" port="0"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
<address type="virtio-serial" controller="0" bus="0" port="1"/>
</channel>
<input type="tablet" bus="usb">
<address type="usb" bus="0" port="1"/>
</input>
<input type="mouse" bus="ps2"/>
<input type="keyboard" bus="ps2"/>
<graphics type="spice">
<listen type="none"/>
<streaming mode="off"/>
<gl enable="yes" rendernode="/dev/dri/by-path/pci-0000:00:02.0-render"/>
</graphics>
<sound model="ich9">
<address type="pci" domain="0x0000" bus="0x00" slot="0x1b" function="0x0"/>
</sound>
<audio id="1" type="spice"/>
<video>
<model type="none"/>
</video>
<hostdev mode="subsystem" type="mdev" managed="no" model="vfio-pci" display="on">
<source>
<address uuid="71abd338-d32e-4a56-8f9a-5830d16a2828"/>
</source>
<address type="pci" domain="0x0000" bus="0x05" slot="0x00" function="0x0"/>
</hostdev>
<redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="2"/>
</redirdev>
<redirdev bus="usb" type="spicevmc">
<address type="usb" bus="0" port="3"/>
</redirdev>
<memballoon model="virtio">
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</memballoon>
<shmem name="looking-glass">
<model type="ivshmem-plain"/>
<size unit="M">512</size>
<address type="pci" domain="0x0000" bus="0x07" slot="0x01" function="0x0"/>
</shmem>
</devices>
<qemu:commandline>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.romfile=/home/rabcor/Windoze/vm-files/vbios_gvt_uefi.rom"/>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.x-igd-opregion=on"/>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.ramfb=on"/>
<qemu:arg value="-set"/>
<qemu:arg value="device.hostdev0.driver=vfio-pci-nohotplug"/>
</qemu:commandline>
</domain>
I also tried to use alternatives to spice as well to see if I could get a better experience, but no dice there either…
xfreerdp
I get a smooth 60fps cursor in xfreerdp however the rendering experience is considerably downgraded, I get what I believe are frame delays (stuttering) extremely frequently,
This is the command I’m using:
xfreerdp /d:"WORKGROUP"/u:"$USER" /v:192.168.122.2:3389 /w:1920 /h:1015 /bpp:32 +clipboard +fonts /gdi:hw /rfx /rfx-mode:video /sound:sys:pulse +menu-anims +window-drag /gfx:avc444 /codec-cache:rfx -compression
The most impactful settings were the gfx (encode) command:
/gfx[:[[RFX|AVC420|AVC444],mask:<value>]]
I tried all 3 settings, RFX had the most stuttering, AVC420 had less stuttering, AVC444 had even less stuttering.
The codec cache command:
/codec-cache:[rfx|nsc|jpeg]
For which rfx seems to provide by far the best result
And also disabling compression
-compression
I tried various compression settings but even setting compression level to 0 is worse than entirely disabling it this way.
The resulting experience is, usable, but not very enjoyable. Also certain 3D applications refuse to run for unknown reasons (errors like: Your video hardware is not supported) on RDP, but most have no issues.
Looking Glass
I couldn’t get it to work with GVT-G, more here:
Update: Can now display the VM in looking glass by running looking-glass-client -s
but this comes at the cost of not having any HID support in looking glass so my only way to interact with looking glass is with passhtrough peripherals.
Which ultimately leaves me with either figuring out a way to get rid of the stuttering in xfreerdp, or get the cursor to be smoother on spice in virt-manager.
Additionally, on both xfreerdp and on spice/virt-manager, I had an issue where the mouse wouldn’t work properly in first-person games. I think I can work around the issue by passing through the mouse, rather than using usb redirect, but that is not a desirable solution. I believe the issue has something to do with VMs not allowing applications to grab the cursor maybe?
I’ve been looking all day but couldn’t find any way to achieve either.
How hard can it be to get a smooth VM experience?