Skip to content
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

A questions about gpuchooser #1

Open
Ahmed-E-86 opened this issue Jan 3, 2020 · 2 comments
Open

A questions about gpuchooser #1

Ahmed-E-86 opened this issue Jan 3, 2020 · 2 comments

Comments

@Ahmed-E-86
Copy link

Ahmed-E-86 commented Jan 3, 2020

Where does gpuchooser store the added applications?
How can I make a database of native Linux games for gpuchooser, so anyone can use it?
If I want to add WINE application to gpuchooser, How can I do that?

@ChristophHaag
Copy link
Owner

Oof, I haven't touched this code in a long time.

Basically it opens the drirc file in the home directory drircfile = home + "/.drirc", parses its xml and presents the specific section for gpu offloading in a gui, and then writes new a new xml file with the new values for gpu offloading. I believe this app here will tell you to run drirc once if that file doesn't exist.

Back in the day when I wrote this, you would run the driconf tool, which would copy the global configuration file from /usr/etc/drirc or /etc/drirc into your home directory to ~/.drirc, and then allow editing it. But this often caused problems when mesa's drirc was updated because your older copy in the home directory would have precedence and the updated settings were not read anymore.

I believe mesa is now looking at both, local versions of drirc files and system wide installed drirc files, and it will apply all settings from the system wide installed drirc, but the local ones can override single settings. A newer tool called adriconf does this, it only saves single settings in ~/.drirc when they differ from the system wide file.

gpuchooser here might still work with this approach, but I haven't tried it in a very long time, the xml tags it's looking for might not be there in this slimmer format of the drirc file. It would probably be better if the feature to select a GPU for an application would be implemented in a proper tool like adriconf.

For wine I am not entirely sure. I think that using the windows gamename.exe name could work.

Anyway, as you may have seen, there is some code to parse the steam configuration and get the location of all steam libraries, and then find all executable files in those directories, but there turned out to be some games that just put +x on everything... There probably is a way to get all the runnable games from steam though. And of course it would also be nice to have a list of non steam games.

Random ideas:

  • Just make a giant text file with all known game executable names.
    • There are probably many that have the same name, e.g. just game
      • add an md5 hash or so, though that would be a pain to maintain with game updates
      • add some other related filenames or subdirectories that make it possible to identify a game executable
    • Searching the entire file system/home directory for games might be slow...
  • Find applications that cause lots of gpu load
    • On windows the many graphics drivers have a menu that shows currently running applications
    • some service/daemon could watch out for such applications and make a list. May need driver specific collection of data

@Ahmed-E-86
Copy link
Author

Ahmed-E-86 commented Jan 4, 2020

Adding the names of the games work just right even with Windows games.

I don't know how service/daemon can watch for running applications, and identify if it is a game or not, because native Linux games don't have an extension to identify them, the operating system identify an application by giving it execute permission, and the first launch of the game will not be switched automatically to the external GPU, it will be switched to the external GPU at the second launch after being added to ~/.drirc file unless we have drirc file with all game filenames, but every user will need to replace device id with his/her device id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants