Easiest way to get smooth graphics in Win11 KVM/QEMU VM

I bought a new laptop and I really want to ditch windows as my main OS. My laptop is is an 8 core i5 with 32gb of ram and an Intel GPU and an RTX4050. So I erased the windows install and installed Cachy, then bought a second 512gb nvme to store a Win11 VM on. Unfourtantely I am tied to windows for a few things, my work e-mail requires some windows only security certs and applications and I also tinker with legacy Visual Basic code and some older embedded hardware that uses windows compilers.

I am currently learning python, webdev and dipping my toes in to AI, I want to do all of that kind of stuff in linux and utilize the RTX4050 on my linux desktop.

I have created a QEMU/KVM windows 11 VM and installed the virtio/spice guest agents, after much fighting I got my storage type as virtSCSI not sata (that was insane windows just would not use the virtIO scsi drivers no matter what, turns out i needed to change the XML from and LSI controller to virt-scsi, that was in no tutorials!) . The VM is running pretty well but the the windows UI is still jittery dragging windows around looks awful and it really annoys me!

From what I understand using PCI pass through will fix the awful GUI stuttering. But everything I see about doing a GPU pass through is for passing the secondary card through to the VM. I don’t mind passing the 4050 card to the VM, but from what I understand is I cant use the 4050 in cachy even when the VM is shutdown? Can I force Cachy to default to the 4050 (right now it will use the intel gpu to save power and start the 4050 when needed) and pass the intel gpu to the win11 vm? I am on a laptop with an HDMI out so I dont have the advantage of plugging a monitor in to a specific GPU.

This is starting to become way more effort than I wanted to get a smooth windows VM running I am almost thinking about just going to dual boot. I saw a video a few months ago Wendell made about looking glass and its indirect display driver, that seemed like the ticket nut from what I can tell that isn’t a feature that is released to the public? I can not find anything about how to set up looking glass to use IDD.

My laptop has 32gb but is about half that strong on the CPU. Being 4 core, I haven’t tried to get it running smoothly directly on the laptop, but threw a win10 VM on my 8 core gaming pc. I find that when I remote into the VM with RDP it is much snappier than viewing it directly. Plays very nicely. Can play video or use applications without issue, whereas I couldn’t with my old VM setup. I’m not using anything heavy - mostly just bluebeam and the occasional web browser.

So you might try firing it up headless and using rdesktop or something to view.

Presumably windows 11 would work just as well, but I admittedly don’t know much about Windows at this point.

I will definitely give remote desktop a try, i remmber rdp having pretty smooth graphics at least with hyperV VMs.

Is there a way to make my 4050 the only GPU that cachy tries to use, if i can do that i think i could just use most of the tutorials out there to pass my iGPU to the VM?

I usually don’t recommend dual-booting because, eventually, a Windows update will corrupt your GRUB menu, leaving you with a laptop you cannot use. You’ll read online that a Windows update could corrupt your Linux install, but it’s more a matter of “when” than “if.” According to Murphy’s Law, it will happen at the worst possible time. If you still want to try, I suggest ensuring that Windows and Linux are installed on their own separate physical disks.

I cannot in good conscience suggest setting up GPU Passthrough for several reasons. On laptops with hybrid graphics (Optimus/MUXless designs), trying to make Linux use only the NVIDIA dGPU so you can pass through the iGPU is not a common or well-documented path. Most laptop VFIO guides do the opposite: the host stays on the iGPU while you pass through the NVIDIA dGPU, as the iGPU is typically tied to the internal panel and the system’s display pipeline.

My best advice is to create a regular Windows virtual machine. You should be able to receive your work emails and manage your Visual Basic code, but you will likely be out of luck with embedded hardware that requires Windows compilers. Since you didn’t provide your laptop specs or list the specific hardware that requires Windows, I can’t suggest any further workarounds.

You can setup this idd driver with looking glass. It’s what I currently use on both my laptop and pc. It will become redundant in future when looking glass releases with it’s own driver, but even this one works well on its own.

I think you are a little confused, @manspider0002. What @rwgast is looking for is a way to keep his Nvidia GPU for his Linux distro and use his Intel integrated GPU for his virtual machines.

I should point out to @rwgast that there are very few guides on the internet that explain how to accomplish this. As I mentioned in my last post, most guides dealing with passthrough for laptops provide instructions on how to pass the Nvidia GPU to the virtual machine while keeping the integrated Intel GPU for the host.

The major reason guides are written for the opposite of what you want is due to hybrid graphics (Optimus/MUXless) designs found in most laptops. In a standard hybrid laptop (Nvidia Optimus), the hardware is usually designed with a specific hierarchy that makes passing the Integrated GPU (iGPU) to a VM much harder than passing the Discrete GPU (dGPU). Since the Intel chip is the only one physically connected to the screen, if the VM “takes” it, your Linux host loses its ability to output anything to your laptop display. You’d essentially be flying blind on your host OS. Usually, to keep the host display working while giving a VM graphics power, people use Intel GVT-g (vGPU). This creates a “virtual” slice of the Intel GPU for the VM. However, Intel dropped support for this starting with 11th Gen CPUs (moving to SR-IOV), which is much harder to configure on consumer hardware. Even if you successfully pass the Intel iGPU to the VM, the VM often has no “virtual” monitor to plug into that hardware path, resulting in a black screen or the need for complex workarounds like Looking Glass. And since Looking Glass is still Alpha software, I can’t suggest its use in good conscience

1 Like

Yea, embarassingly misunderstood the post. As the post above me said pinning the IGPU to the VM isn’t exactly common or recommended.
What you can do instead (which would probably be even more exotic and uncommon), is to check if your laptop supports SR-IOV as I’m pretty sure your IGPU supports it. If your BIOS doesn’t have the option then you can’t have have the functionality, but if by off-chance it has the option, then you can create a virtual GPU (with custom drivers) and just passthrough that to the VM.
Unfortunately I doubt your BIOS has the option, but it doesn’t hurt to check.

As for this part:

I don’t mind passing the 4050 card to the VM, but from what I understand is I cant use the 4050 in cachy even when the VM is shutdown?

You can actually use it after VM is shut, you just have to unbind it from vfio.pci driver. You can even bind it back but that one can be sketchy as it has to be done in specific order or it will output modprobe errors.

1 Like

I’ve read a few posts on this forum where people have had trouble getting NVIDIA GPUs to unbind cleanly from the vfio-pci driver. That said, from what I’ve seen, NVIDIA cards are generally easier to rebind and manage with VFIO than AMD GPUs.

Sometimes NVIDIA GPUs also need a custom shutdown script to properly shut down the VM and rebind the card to the NVIDIA driver in the correct order. I remember reading a thread here where someone had figured this out and shared a working script, but I can’t recall the exact thread name or how to find it again.

I think @rwgast may eventually realize that fully abandoning Windows is more trouble than it’s worth for his use case. If this were a desktop PC, he’d probably have a much easier time spinning up a Windows VM for Windows-only workloads.

Since this is a laptop, though, the hardware is a lot more exotic—shared devices, muxed GPUs, firmware quirks, etc.—which means he’ll likely only be partially successful at best.

I’ve posted this elsewhere but it might interest you… at least the poor visual performance would be confined to the application interface rather than the usual rdp paradigm. Plus it sounds like you’re doing software development related stuff where maybe this isn’t the end of the world?

I am a little confused about what looking glass acually is, but would the IDD driver linked to above and looking glass get my windows vms graphics more smooth? I saw a video Wendell did on looking glass where he explained the IDD is acually using cpu cores to do video acceleration? Its crazy its this hard to get bare minimal 2D acceleration going on a VM.

I spend 75% of my time in a WSL2 shell. I really want to ditch windows im so sick of MS, but my DOD cac card is almost useless without windows/chrome. If it was just email and some old compilers i could just try to suck it up, but i didnt even think about some of the proprietary software i use for software defined radio, it requires smooth 2d.

I use to dual boot linux in the early 2000s and it was a pita as far as windows wiping the MBR, i cant belive this is still a thing with UEFI 20 years later.

1 Like

If you work for the Department of Defense (just an assumption on my part) or as a civilian contractor, and the DoD issued you that laptop, I’d honestly be surprised if you were allowed to replace Windows with Linux.

From what I’ve heard (mostly rumors), the DoD often deploys custom-hardened versions of Windows that aren’t available to the general public. If that’s true, it could help explain why you’re running into so many issues with your Windows VM.

It also wouldn’t surprise me if the laptop hardware itself is customized for DoD use, with specialized components or firmware that you wouldn’t normally find in a standard consumer system. That kind of setup can make virtualization and passthrough much more difficult.

Based on what I think might be going on, my advice would be to undo any configuration changes you’ve made to the laptop and return it to its original state.

If the system was issued by the Department of Defense (or any government/enterprise organization), there are usually very specific security and compliance reasons why Windows is installed and configured the way it is.

A few years ago, I actually had to let a member of my support staff go because he replaced Windows on his company-issued laptop with a Linux distro. That decision left our network exposed and out of compliance with our security policies.

On managed or government-issued hardware, it’s usually best to stick with the approved OS and configuration unless you have explicit authorization to do otherwise.

Yes im a civilian this is my personal laptop, you can use your cac on non DoD computers to access email/hr/ms365/training etc… i would not be trying to do anything to the work computer!

I wrote vm-curator to make multi-GPU passthrough easier to manage. Github Link

vm-curator is a Linux TUI for managing QEMU/KVMs for desktop/workstation use-cases. It supports the setup of multi-GPU passthrough with looking glass, or single-GPU passthrough with script generation. (The script, which must be run via a separate TTY or from another computer via SSH, will automatically unbind your GPU from your Linux display manager, attach to the VM, and then will launch your VM. Upon shutdown, it will run this process in reverse.)

Wow that is a great script! I will definately be using it once a set up my VM server!

You said it needs to be ran from a seperate computer via ssh, is that a one time thing for setup or is that every time you want to use the VM? The script unbinds and frees up the gpu for the host after the guest is shut down?

Can you briefly explain to me what looking glass and why someone would use it after passing there gpu?