Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:add virutalgl for hardware accelrated opengl #15

Merged

Conversation

vajonam
Copy link
Contributor

@vajonam vajonam commented Apr 3, 2024

Add support for virtualGL.

This however means you need to get VirtualGL supported on the host this involved the following

  • installing simple X server
  • installing virtualgl and running vglserver_config

Once the X server is up and running. Then this container will with fully accelerated

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
@vajonam
Copy link
Contributor Author

vajonam commented Apr 3, 2024

@helfrichmichael its in a decent spot now. This approach with VirtualGL it need a Xserver and VirtualGL running on the host (which can be headless). And we will need to make that a pre-req. We will have to document steps to get that going. I tried so many things so need to understand what I did from a docs perspective. But folks who already are using Xsever this should be quite easy.

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
@vajonam
Copy link
Contributor Author

vajonam commented Apr 3, 2024

Need a solution for firefox, because in 22.04 it runs from snapd, and I can't be bothered to get snapd to work inside a container for now that is missing.

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
… it works!

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
vajonam and others added 12 commits April 4, 2024 10:45
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
@helfrichmichael helfrichmichael self-assigned this Apr 4, 2024
@helfrichmichael helfrichmichael self-requested a review April 4, 2024 17:52
…that. the first is the author of the original dockerfile.

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to launch firefox with a /usr/bin/vglrun before it so that it uses the GPU? I will make the rendering faster.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To adjust this, we'd need to modify the lxpanel configuration for firefox-esr to add that prior to the firefox-esr bit.

It does work using /usr/bin/vglrun firefox-esr, but I'm unsure how best to implement this consistently. I can look into that in a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • rename firefox-esr and create a script file that calls the renamed binary prepending vglrun and postpending any params. vglrun /usr/bin/firefox-esr-renameed $@

@helfrichmichael
Copy link
Owner

helfrichmichael commented Apr 4, 2024

Interestingly, I cannot get the GPU (NVidia RTX 3070) to passthrough with NVidia + WSL2 + Docker on Windows. Using the benchmark in https://docs.docker.com/desktop/gpu/ works just fine though.

image

Command I'm using to start it: docker run --detach --volume=prusaslicer-novnc-data:/configs/ --volume=prusaslicer-novnc-prints:/prints/ -p 8080:8080 -e SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" -e ENABLEHWGPU=true -e NVIDIA_DRIVER_CAPABILITIES="all" -e NVIDIA_VISIBLE_DEVICES="all" --name=prusaslicer-novnc prusaslicer-novnc

Wondering if I've done something wrong to cause the GPU to not passthrough?

@vajonam
Copy link
Contributor Author

vajonam commented Apr 4, 2024 via email

@vajonam
Copy link
Contributor Author

vajonam commented Apr 4, 2024

Also make sure you can read /dev/dri/card0 from inside the docker container this is that vglrun uses. So that's the first place to look along with the tool I mentioned above

@vajonam
Copy link
Contributor Author

vajonam commented Apr 4, 2024

The GPU benchmark is testing out CUDA cores which are differnt from the EGL features virtualGL uses. AFAIK. I am no expert just got into this a few days ago!

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
…ing.

Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
Signed-off-by: vajonam <152501+vajonam@users.noreply.github.com>
@vajonam
Copy link
Contributor Author

vajonam commented Apr 5, 2024

added code to launch firefox-esr as accelerated if ENABLEHWGPU is set.

@helfrichmichael
Copy link
Owner

Sorry again for the delay. I'll be reviewing and merging this tonight after work. It's been a busy few days.

@helfrichmichael
Copy link
Owner

Super sorry for the delayed review! Merging now and we'll address any bugs along the way. Thanks again!

@helfrichmichael helfrichmichael merged commit 9c6cddc into helfrichmichael:main May 17, 2024
@vajonam vajonam deleted the feature/virtualgl-support branch May 20, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants