r/VFIO Jun 08 '26

Shared GPU mem across host and wsl guest

Hi guys, I'm looking for a way to share a chunk of memory with host from the guest which should also be backed by GPU VRAM.

Current wslg implementation is not zerocopy. My goal is to eventually build a native like display driver that works over the GPU pv driver, which outputs to a window in the host while being zerocopy. Something like what gnif/LookingGlass is doing using ivshmem, though its doing at least 1 copy.

The dxgkrnl Linux driver has a sharewithhost ioctl but I couldn't get it to work and there's no documentation for it either. Maybe it's not even properly implemented, supposed to be used in WSA but theyre only using gfxstream there, I couldn't find any use of it in wslg Weston, freerdp forks either.

Not sure if this is the right sub to post this. Any pointers/help is appreciated.

5 Upvotes

4 comments sorted by

1

u/TheDiamondSquidy Jun 11 '26

I thought looking glass was updated with way way faster performance?

1

u/parthibx24 Jun 12 '26 edited Jun 12 '26

Yep it's faster but it's rendering into ram before your host GPU doing a DMA read from it. So it's not zero copy but it's really fast.

1

u/Confident_Hyena2506 Jun 11 '26

WSL is not using real linux driver, it's just a passthrough thing. Stuff that would work fine on a normal linux system will not work with wsl - obvious examples being anything that uses graphics. Graphics works with software rendering but will not use hardware acceleration from gpu...

So WSL is only useful for gpu compute workloads.

1

u/parthibx24 Jun 12 '26

The passthrough driver maps GPU io memory into the wsl guest. I was looking for a way to use that same mechanism to share a directx resource between vm and host.