udevbe/greenfield

[Build] WSL2

markusbkk opened this issue · 6 comments

I'd like to use this issue to track my process in getting Greenfield to work under Windows 11/WSL2.

According to microsoft/WSL#938 (comment), this apparently worked before.

RN, after disabling WSLg with the following command (to be updated with a snippet that will automatically pull the Windows username. As soon as I've figured out how to properly get the Windows username from Powershell or cmd without additional characters), Greenfield proxy reports that no dev/dri interface can be found.

echo $'[wsl2]\nguiApplications=false' > /mnt/c/Users/[Windows User]/.wslconfig

/dev/dri is optional. It allows for Wayland clients to be hardware accelerated and was only relatively recently added to Greenfield. The comment you posted, Greenfield didn't have support for /dev/dri at the time.

/dev/dri is optional. It allows for Wayland clients to be hardware accelerated and was only relatively recently added to Greenfield. The comment you posted, Greenfield didn't have support for /dev/dri at the time.

Makes sense. I think shutting down WSLg made it more complicated than I had thought.
Turns out, I just needed to changed the WAYLAND_DISPLAY variable (export WAYLAND_DISPLAY=wayland-1) and start Firefox (my test target ... because browser inception) with MOZ_ENABLE_WAYLAND=1 firefox.

Works properly now. Alas, a bit slow and flickery. But so does the native Wayland compositor on my machine, too.
One more question: How do I connect XWayland applications to the compositor? By default, it's still launching them through WSLg for me.

EDIT: NVM. DISPLAY is analogous to WAYLAND_DISPLAY. Just as I thought. It's not displaying xeyes for some other reasons, but Greenfield seems to work on my machine now.

EDIT2: Was apparently an XAUTH issue. After manually setting $Xauthority though, it's now stuck at Spawned XWayland Server (trying with xeyes instead of firefox)

Using these steps #108 (comment) I can run xterm & xeyes

Using these steps #108 (comment) I can run xterm & xeyes

Thanks again. I got it working with those steps on my WSL2 Ubuntu 20.04 system, too. Namely, the XAuthority parts helped a lot.

I've done some digging on how to run this smoothly on WSLg, and it seems WSLg uses a system distro image to run Weston with a custom build of MESA to get hardware acceleration. I expect Greenfield to run faster/smooth if a similar image is used.