vscode-dev-containers
vscode-dev-containers copied to clipboard
X11 Forwarding by DevContainers significantly drops FPS.
- VSCode Version: 1.78.2
- Local OS Version: Windows 10
- Local chip architecture: x64
- Reproduces in: Remote - Containers
Steps to Reproduce:
- When running glxgears within WSL, its FPS is as follows.
6303 frames in 5.0 seconds = 1260.489 FPS
OK.
- When I manually create a Docker container on WSL and do X11 Forwarding by myself with
-v /tmp/.X11-unix:/tmp/.X11-unix
mount option, the FPS is as follows.
6105 frames in 5.0 seconds = 1220.828 FPS
Good. It is down a bit, but fast enough.
- However, if I execute glxgears in the DevContainer with X11 Forwarding by the function of DevContainers, the FPS is as follows.
812 frames in 5.0 seconds = 162.287 FPS
Hmmm...
According to the Dev Containers logs, it seems that it's Forwarding with a different approach than the mount. This may be Dev Containers' philosophy, but why so slow?
DevContainers does not seem to provide a way to disable the X11 Forwarding feature, so I am doing the following hack to keep a high FPS even with DevContainers.
[devcontainer.json]
{
...
"mounts": [
{
"source": "/tmp/.X11-unix",
"target": "/tmp/.X11-unix",
"type": "bind"
}
],
"containerEnv": {
"DISPLAY": ":0"
}
In this way, an error occurs when creating a container, but the container itself is created and Forwarding is performed by bind mount, so the FPS does not drop.
[2772 ms] Start: Run in container: test -e /tmp/.X11-unix/X0
...
[2774 ms] Start: Run in container: test -e /tmp/.X11-unix/X1
...
[2776 ms] Start: Run in container: mkdir -p '/tmp/.X11-unix'
...
[2779 ms] X11 forwarding: DISPLAY in container (:1) forwarded to wsl host (:0).
...
[3115 ms] Container server: Error: listen EROFS: read-only file system /tmp/.X11-unix/X1
at Server.setupListenHandle [as _listen2] (node:net:1415:21)
at listenInCluster (node:net:1480:12)
at Server.listen (node:net:1579:5)
at /tmp/vscode-remote-containers-server-f104bdef-0c3d-4eda-94cc-b27ecd1a84c3.js:12:10714
at new Promise (<anonymous>)
at /tmp/vscode-remote-containers-server-f104bdef-0c3d-4eda-94cc-b27ecd1a84c3.js:12:10697
at async Promise.all (index 1)
At least, I would like to be provided a way to disable X11 Forwarding.