-
Notifications
You must be signed in to change notification settings - Fork 203
Add hybrid GPU support #159
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
Conversation
Couldn't you just prefix your game launch commands with whichever wrapper you need as well as gamemoderun, e.g. I suppose the benefit of doing it this way though is that you can set the environment variable globally and not have to duplicate it through all of your Steam game launch options or anything like that. |
The main reason is the global environment variable. I know this is a bit optimistic, but imagine programs like Lutris or Steam would add support for gamemoderun, so that you could simply toggle it in the settings and don't have to edit every start command. And even if this will never happen, writing a command one time to the blacklist and add one global environment variable is shorter than writing it to every launch command. One could also use this environment variable for other things than just hyrbid gpu wrappers, for example setting a vsync mode. Overall I think while any hybrid gpu solution (especially with nvidia) is never perfect, at the moment where we can't choose the GPU for rendering in basically any game, this is a simple solution. |
I like the simplicity here - rather than going through the config or anything else, simply setting an env variable. It's not perfect, but I think the fact it's a "dumb" feature, not trying to do anything too clever, protects it from most issues I can come up with. One note: I wonder if the wrapper backlist could be worked around by using something like this?
|
I also thought about that. The problem is that now the wrapper will run I don't think one way is superior to the other. If you managed to set up your hybrid gpu on Linux in the first place, it shouldn't be an obstacle to set your wrapper to the blacklist if you wish to do so. I personally wouldn't do it with my current configuration of optirun, but I wouldn't mind to change the code if you think that this a cleaner solution. |
|
I thought more about the way optirun etc works, but after a bit of research it turns out I was wrong. I browsed the code of optirun and primusrun and they basically just activate the gpu and set some environment variables, so it really doesn't make any difference even if the PID would be different. So I'm going to change the code to the following: LD_PRELOAD="${CONFIG_LIB_DIR}${LD_PRELOAD:+:$LD_PRELOAD}"
exec $GAMEMODERUNEXEC env LD_PRELOAD="${LD_PRELOAD}" "$@" I also going to change the manpage, which I forgot about. |
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
Thanks, I've merged this and followed it up with 50303dc to expand the documentation a bit. |
I added hybrid GPU support by adding
$GAMEMODERUNEXEC
to the gamemoderun launch command. IfGAMEMODERUNEXEC
is unset, which given by its very specific name always should be the case by default, the program will execute normal. However if you set the environment variable to a specific command likeoptirun
, it will start optirun, which starts the game.Since the script injects libgamemodeauto globally inside the script, it will inject GameMode to the wrapper as well as the game. If a wrapper is not important for the performance (like
env XY=Z
), the user can blacklist it.closes #20 closes #87
Signed-off-by: Stephan Lachnit stephanlachnit@protonmail.com