pauleve / docker-mtgo

Docker image with ready-to-play MTGO (Magic Online) for Linux and macOS
https://hub.docker.com/r/panard/mtgo/
470 stars 34 forks source link

Nvidia host support #132

Open jathanasiou opened 2 years ago

jathanasiou commented 2 years ago

I have been using an Arch Linux host with Nvidia GPU and my performance was terrible until now (worse than a virtualbox VM). I did some googling and it turns out that nvidia acceleration needs to explicitly allowed, after an nvidia tookit installed.

In my case, this meant doing yay -S nvidia-container-toolkit, restarting docker.service and changing https://github.com/pauleve/docker-mtgo/blob/f99b972bf68fd4216cf128dd2e65ec192dc9edb7/run-mtgo#L280 to

run docker run --gpus all --privileged --rm -e DISPLAY \

I'm not sure if it's safe to add this change for everyone, but perhaps an argument could be passed to the mtgo-run script to append that option.

I'm not very experience with Docker but I could PR a little README addition for these cases and try to add a runner parameter for adding --gpus all internally.

pauleve commented 2 years ago

Thanks for your report. It might be hope for #68 . Do you confirm you have a smooth experience since using this trick? I'll investigate which changes would be the most universal.

jathanasiou commented 2 years ago

Hey @pauleve. I've been a bit busy and was trying out other ways to get MTGO to run as well.

I followed your instructions here https://github.com/pauleve/docker-mtgo/issues/68#issuecomment-941548684 and unfortunately there seems to be no significant improvement. The --gpus all helping me earlier must have been coincidental and/or placebo effect.

After ensuring I have the nvidia-container module and the latest script, a fresh MTGO docker install would still have random freezes (perhaps triggered by cards with new art? maybe there's some network or filesystem-level function in Wine causing delays?) sometimes lasting over a minute. Which, unfortunately, make the client far not so reliable when matches have timers :/

Another suspicion of mine is that it may have something to do with DE compositing/vsync. I might try to install a very bare-bones DE like XFCE/LXDE to see if the freezes still occur there.

pauleve commented 2 years ago

That's an interesting suspicion... I'm on minimalist DE (xmonad) and never experienced these freezes. It may be worth trying with a direct wine install as well (following https://it.toolbox.com/blogs/jeffhoogland/howto-install-mtgo-on-ubuntu-linux-010718) to check whether it is a Docker issue or not. Regarding filesystem delays, that would be surprising; the game file system is within a Docker volume, which should be very fast... I could also give a try to a vnc mode within Docker to avoid interactions with the host DE.

jathanasiou commented 2 years ago

@pauleve I tried with LXQT yesterday (which has no compositing AFAIK) and it behaved exactly the same for me. Might try a minimal WM as well Re filesystem operations, I was thinking of the Wine layer since I believe it has some OS-calls implemented to imitate windows and maybe those are slightly different. There's a chance I did not have those freezes some months ago on a different Wine version, but I haven't confirmed or pinpointed that yet.

The overall "feel" when those freezes occur is akin to some I/O operation on the MTGO client being (erroneously) executed on its main thread and, in conjunction with some setups having overhead for them, leading to a frozen GUI.

pauleve commented 2 years ago

Regarding wine version, from feedback from #107 wine 4.9 might work better:

./run-mtgo panard/mtgo:wine-4.9