flathub / com.modrinth.ModrinthApp

https://flathub.org/apps/details/com.modrinth.ModrinthApp
8 stars 3 forks source link

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

Open Rawi666 opened 4 months ago

Rawi666 commented 4 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.