Stuttering in game

Hello! I have had my LG setup for a while now but I only just started gaming with it.

I started playing GTA V and I notice a lot of stuttering with fast movement, e.g. when driving around fast. If I stop driving fast for a while the framerate seems to catch up and the stuttering stops.

If I plug my monitor in directly to the guest GPU, I do not experience the stuttering. It feels as if LG or something in the pipe cannot keep up when the frames have many differences between each other.

My in-game framerate is >60FPS at all times. I have tried lowering the settings as much as possible, turning V-Sync on and off in game and tried to not go over 130 FPS since GTA V can’t handle it.

My setup:
Threadripper 2920x in NUMA mode
ASRock X399 Taichi
32GB 3200MHz RAM
Host GPU: AMD HD7950
Guest GPU: NVIDIA GTX 1070
Host OS: Arch 5.3.6-arch1-1-ARCH
Guest OS: Win 10 fully updated

Some info about the VM:
Q35 chipset
qemu v4.1.0-2
I have passed through one NUMA node with its corresponding 16GB of RAM. Guest GPU is plugged into PCIe slot going to that NUMA node.
CPU topology is 1 socket, 6 cores, 2 threads.

My monitor’s resolution is 4K, but I am running the Win 10 VM and the game in 1080p and letting LG(?) upscale the image. I tried setting 256MB of SHMEM in case it helped but it did not.

I am running the LG client with app:renderer=OpenGL since running it with EGL produces some kind of weird diagonal tearing and even more stuttering. I have tried with V-Sync on and off in the LG client but it did not make a difference. Having V-Sync enabled everywhere, I get 60 FPS in game, 60FPS and UPS in LG but the stuttering remains.

The CPU seems to be turbo-ing up correctly, I have nothing else running on the host or guest and RAM usage is ~ 50 - 60% on the guest and about 2GB on the host. Windows is set in high performance power option.

The Windows VM runs on a dedicated SSD and used to be a bare metal Windows Install, i.e. it is not a qcow image. The game is installed on a second SSD that is completely passed through as well. Both are Samsung, the first an 840 Pro and the second an 850 EVO.

I am using the latest LG from the AUR and the B1 version on the guest.

I suffered this issue as well and it was finally resolved when I finally set up vcpupin. The hyperv enhancements helped too. My XML: http://ix.io/1YPb

vcpupin was the major changer, though

  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
    <vcpupin vcpu='2' cpuset='2'/>
    <vcpupin vcpu='3' cpuset='3'/>
    <vcpupin vcpu='4' cpuset='4'/>
    <vcpupin vcpu='5' cpuset='5'/>
    <vcpupin vcpu='6' cpuset='6'/>
    <vcpupin vcpu='7' cpuset='7'/>
  </cputune>

on my ryzen 2700x / x470 taichi / 32 gb CL14 3200mhz ram

Thanks for the answer but I have already pinned the CPUs to the VM.

I think I found the culprit. I was passing through the SSD as a SATA device and after testing it, I saw I had terrible (1/3 - 1/4 of normal) random 4K read performance. I switched it to VIRTIO passthrough and the stutters seem to have mostly gone away (although there still are some).

It was a part of my setup that I had not touched since I started messing with VFIO.

huh that’s strange I also have had SSDs passed as RAW SATA SSDs and I’ve never experienced any issues

I’ve had much worse luck with the openGL renderer in terms of performance and switched to it on B1 for the same reason of crazy tearing and stuttering. My hardware is a little bit different but I’m also using an AMD GPU for the host and nvidia for the guest.

Yesterday I thought I’d give the latest bleeding edge build (2019-10-14 18:08:53) a try since the windows host is precompiled. Unless you removed your make dependencies when you installed it from the AUR, you should be able to compile the client without any extra effort as well so I’d suggest giving it a try and using egl again as it seems to have fixed the issue for me. Performance still isn’t perfect but I suspect that has more to do with my setup than LG, but the stuttering and tearing is gone.

OK I have no idea what is going on.

While I initially felt like the stuttering went away mostly, I can definitely still notice it. I stop driving fast and it takes a good 5 - 10 seconds to clear up.

I am not sure if it really is stuttering. It feels like the framerate goes to 20FPS but Afterburner shows it being around 60FPS. Frametimes look normal as well, from 11ms to 25ms.

What is weird is that my GPU usage is low, around 60 - 80% while the framerate is ~ 60FPS with V-Sync off. I have seen the framerate go to 90FPS but it mostly hovers around 60 with GPU usage not being 100%.

Thermals are under control, the 1070 is around 70C and the core clock is around 1800MHz. VRAM usage is around 3GB, RAM usage is anything from 6GB to 9GB. CPU usage stays between 35 and 50% (with 6 cores and 12 threads passed through). RAM and CPU usage monitored through the Task Manager. Task manager reports even lower GPU usage at anything from 15 - 30%.

Monitoring CPU frequencies through Arch (watch -n1 “cat /proc/cpuinfo | sort -rn -t $’\t’ -k5,5 | grep “^[c]pu MHz””) I can see core frequencies of 4100MHz on anything from 2 to 8 cores.

This is starting to look more like a VFIO problem rather than an LG one. I said that I did not experience the stuttering with the display connected directly to the guest GPU but I did not spend much time trying that.

Here is my VM xml: https://pastebin.com/rdPuPfLK
I am not sure my CPU section is correctly configured.

Edit: Switched CPU governor from ondemand to performance. Stuttering is much better now but still not completely gone. Tested bare metal, ondemand and performance through GTA V’s benchmark. With ondemand I was getting nearly half of the bare metal framerate and GPU usage of around 60 - 80%, with performance I am getting a bit less than bare metal (90 - 130 FPS compared to 110 - 140).

My problem is that apart from GTA V, I don’t really know how to test performance and what to expect or change at this point.