Open netbrain opened 3 months ago
At the moment it checks if you have an NVidia driver installed then uses that, else it just uses /dev/dri. So skipping hte Nvidia card is easy by variable then selecting the dri card could be done maybe with switcheroo (in the container?)
Maybe install switcheroo in the container and see if it can be used to select the GPU with everything passed through.
NVidia drivers on linux are still not great and not good under wayland yet although better.
I found a fix for this for now if you have the nvidia container toolkit working and dual GPUs. in the zwift.sh just add: -e __GLX_VENDOR_LIBRARY_NAME=nvidia -e __NV_PRIME_RENDER_OFFLOAD=1 in the general flags. This will set the GPU for the current shell. Works fine for me with proprietary drivers. For the open drivers there other environment variables to use
# Define Base Container Parameters
GENERAL_FLAGS=(
--rm
--privileged
--network $NETWORKING
--name zwift-$USER
--security-opt label=disable
--hostname $HOSTNAME
-e __GLX_VENDOR_LIBRARY_NAME=nvidia
-e __NV_PRIME_RENDER_OFFLOAD=1
-e DISPLAY=$DISPLAY
-e ZWIFT_UID=$CONTAINER_UID
-e ZWIFT_GID=$CONTAINER_GID
-e PULSE_SERVER=/run/user/$CONTAINER_UID/pulse/native
-v zwift-$USER:/home/user/.wine/drive_c/users/user/Documents/Zwift
-v /run/user/$LOCAL_UID/pulse:/run/user/$CONTAINER_UID/pulse
)
I take it your are running dual GPU system?
Yes, that is correct. Struggled for a while to get the Nvidia driver to work fully in my system but once i got the nvidia container toolkit running i was able to find a quite easy solution that don't require rebuilding the docker image. If not having the env flags set wine starts with the primary gpu which in my case is the built in intel.
-e __GLX_VENDOR_LIBRARY_NAME=nvidia
-e __NV_PRIME_RENDER_OFFLOAD=1
Should probably be documented in the readme somrwhere, or maybe even just always included as flags when a Nvidia card is detected in Zwift.sh
i guess you could add it as optional env so one could add it in the settings file and let the run script include it if it is in the settings file so it not affects anything else. These are also only valid if you have the proprietary drivers from nvidia and not the open drivers for the newer gpus. for the open driver there are different env to use..
NixOs nvidia-container-toolkit have been broken for some time now, atleast on my machine.
So when running zwift i get
However as i have a laptop with dual video cards (nvidia/intel) if i run the docker command without the --gpus=all it will choose to run on my intel card instead, and work just fine albeit with less framerate.
So this got me thinking, maybe we should provide a way to choose which graphics system to try to run the container with?
WDYT @sHedC ?