modrinth / code

The Modrinth monorepo containing all code which powers Modrinth!
https://modrinth.com
Other
902 stars 164 forks source link

Flatpak version doesn't support environmental variables override for launching with dGPU #1253

Open Rawi666 opened 3 months ago

Rawi666 commented 3 months ago

Describe the bug

In Fedora 40 in order to launch MC with dGPU I need to start java process with the following environmental variables: __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia When I Add these to Settings->Environmental variables it should launch MC on nvidia gpu which can be observed using e.g. nvidia-smi tool. The problem is this works on AppImage version but doesn't on Flatpak which looks like containerization/permission issue.

Steps to reproduce

  1. Add __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia into Settings->Environmental variables
  2. Launch MC on a laptop with two GPUs and see if dGPU is in use

System information

OS: Fedora 40 Kernel: Linux 6.9.7-200.fc40.x86_64 DE: Gnome 46 WM: Mutter (Wayland) CPU: Intel i9-12900H GPU: NVidia RTX 3070 Ti (drivers 555.58.02) RAM: 32GB

Additional Info

I've tried writing a java wrapper script that starts java with the above env variables set so that from Modrinth perspective there are no additional env vars but it doesn't help. It definitely looks like flatpak doesn't allow starting any process with env variable override in a way that nvidia gpu is used.

brawaru commented 3 months ago

Flatpak package is community-maintained. Please report this at https://github.com/flathub/com.modrinth.ModrinthApp/issues.