Add per-game configuration override (for cpu pinning) - #572
Conversation
|
Cool idea! I like the implementation, it seems simple enough. I'm intending something similar in a fork, though I was gonna allow specifics within the existing configs, paired with an envar or a filter of some kind, like so: But this approach offers similar versatility without the up-front complexity, so that's cool. There's a few caveats that maybe are worth solving:
|
Actually worth mentioning this - I had assumed more recent code was accounting for this in gamemode-wine.c. Is that no longer working? Worth a bug report if so. |
|
Thanks for the review! Looking at your comments in order... Config locations: good call. I changed it to search all of the same locations as the main Reload: agreed it doesn't match. I am open to trying to tackle it, but like you said, it doesn't seem as easy. I added a line to the README noting it, but let me know if this is a blocker. Multiple config formats: I am not married to any particular solution. I'll admit, I really liked the ideaof
Here's an excerpt from my local testing (Fedora 44 KDE, native RPM Steam, GE-Proton11-3)The failures start immediately at container start (before wineboot) and repeat throughout launch (there were 24 total counts here; I obviously trimmed the log down). Happy to open a separate bug report for this with the full log output, if that would help. |
|
Lovely. I'm not a maintainer (haven't been for almost a decade at this point) so we'll see what Feral thinks! (And yes, the wine thing is worth reporting separately!) (Sorry for micro-essay below, just dumping thoughts) From my perspective I'll say this may not be the direction I'd go, after some consideration. I think the TL;DR is that this kind of invents a new concept along the lines of GameMode config "profiles", but the instigating problem-to-solve didn't really need that in its full form, resulting in some possibly confusing behaviours going forward. Client ControlThis has the side effect of giving clients control over their own optimisations, but as that's only an "emergent feature" it's not particularly usable. e.g. A client might think to try and set the environ before requesting GameMode, but:
I think this one might be solvable, but it also means feature work towards a need thats not really defined - I've not seen a request to allow clients to control themselves like this, so we'd have no "real world" use case to validate against. ConvenienceThis requires a user to do two things to use this feature:
Ideally a single step solution would be preferable and a sign of a more elegant design. Client OnlyThis one might be my UX brain speaking but these "profiles" only controling the client might cause more confusion in almost the same way that the $PWD config location has caused confusion for many reporters here on the repo - it implies a new "profile" could be created and have system optimisations set in it, to have an affect on those system values. This one maybe should be solved in this review by rejecting rather than ignoring unknown values in these files, but does reveal a wider design issue. I think I'm leaning more towards allowing a client to set Another alternative would be to have a new section in the config where a user defined a pattern match to the exe or process name, and then chooses custom settings in there. Again doesn't fully solve things (especially with the identified wine issue) but would I think be a step closer to an elegant solution. I'll ponder it for longer. |
|
Agreed with pretty much everything you've said. Not sure a whole per-game system with multiple configuration files is totally worth it for the rare exception (in my case, Elden Ring is the only one). In that case, something like passing a I'll defer to your expertise on the codebase; if we move forward with this, awesome. If you wanna go a different direction, I'm down to help or see how that goes. I've been using my branch's I think some form of workaround for situations like Elden Ring where one setting needs to be tweaked would be immensely useful; it's just a matter of what the easiest route to that is (both code-wise and UX-wise). Anyways, I look forward to what comes of this! |
Elden Ring crashes when using
gamemoderunwith core pinning. I was using a script workaround to load a different config file on-the-fly, which was (at best) messy. This adds an option for per-game configuration files, living in~/.config/gamemode.d/(also ties to previous per-game use-cases, such as #388 and #570).The change lets users pass
GAMEMODE_CONFIG=xinto Steam launch options, which then dynamically loadsx.inifrom thegamemode.dfolder. Passes all tests (build, format-check, meson test). Confirmed working locally (Elden Ring now launches properly for me usingGAMEMODE_CONFIG=eldenring gamemoderun %command%). Also tested against invalid names, invalid values, with and without overrides.I originally looked at just checking the process name and using that to match to the file (so
eldenring.exewould look foreldenring.ini). This worked in testing (gamemoderun sleep 5would properly check forsleep.ini), but launching a game via Steam would look forenvevery time. This is because the game itself is a Windows process under Wine inside pressure-vessel, where the LD_PRELOAD never loads, so only the wrapper processes ever register with gamemode.Additionally, names are restricted to
[A-Za-z0-9_-]to prevent path traversal; config files can only be loaded from thegamemode.dfolder (confirmed by testing withGAMEMODE_CONFIG=../badconfigand it being rejected). Verified the override holds across the reaper's periodic re-pinning and config reloads too.This was intentionally scoped to only
pin_coresto solve my personal issue with Elden Ring, and keep it more easily reviewable. Further keys can be added using the same pattern. Happy to adjust the approach; I would love to see a per-game solution for gamemode.