Thanks for the update! On Sun, May 15, 2022 at 03:20:24PM +0000, Thomas Leonard wrote:
On Thu, 14 Apr 2022 at 13:57, Alyssa Ross
wrote:On Wed, Apr 13, 2022 at 05:12:13PM +0000, Thomas Leonard wrote:
On Wed, 6 Apr 2022 at 12:19, Thomas Leonard
wrote: [ converting from virtwl to virtio-gpu ] I tried, but failed, to figure out the protocol. I did manage to get a test application showing a little animation, but it crashes after a few seconds.
OK, I found a solution to this: you can just open the device file twice and use one instance for Wayland messages and the other for allocating images. This avoids the first race. With that, I got the proxy converted:
https://github.com/talex5/wayland-proxy-virtwl/pull/28
Though I'm not sure it's an improvement: +1,819 −577 lines!
Instructions for configuring crosvm to use it:
https://github.com/talex5/wayland-proxy-virtwl#virtio-gpu-support
And I wrote up my guesses about the protocol here:
https://github.com/talex5/wayland-proxy-virtwl/blob/master/virtio-spec.md
That's extremely helpful, thanks for writing it up!
A small update on this:
First, I got virtio-gpu working with the jail. It just needs a couple of extra paths for NixOS:
diff --git a/src/linux.rs b/src/linux.rs index ad031749..52d3142f 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -790,6 +790,8 @@ fn gpu_jail(cfg: &Config, policy: &str) -> Result
Secondly, I realised that the "video" memory returned by virtio-gpu was just regular host memory (from stracing crosvm). This is because crosvm is compiled without minigbm support and falls back to this.
After enabling minigbm and its amdgpu support (which also required adding a dependency on mesa) it started allocating vram. However, this broke the proxy because vram can't be used with the Wl_shm protocol.
Do you have a Nix expression somewhere for crosvm with all this stuff fixed? I'd like to integrate it into my draft Nixpkgs PR. (If you didn't do it with Nix, I can make the changes myself.)