sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.1k stars 70 forks source link

primerun setting doesn't work #953

Closed Rabcor closed 10 months ago

Rabcor commented 10 months ago

System Information

Issue Description

If I launch a game through tinkerlaunch after enabling the primerun option in tinkerlaunch's game settings, it will just use the iGPU instead.

Logs

steamtinkerlaunch.log

sonic2kk commented 10 months ago

That log doesn't seem to be from a game launch, so it doesn't have much useful information really.

When Prime Run settings are enabled, SteamTinkerLaunch sets the following environment variables:

if [ "$USEPRIMERUN" -eq 1 ]; then
    export __NV_PRIME_RENDER_OFFLOAD=1
    export __VK_LAYER_NV_optimus=NVIDIA_only
    export __GLX_VENDOR_LIBRARY_NAME=nvidia
fi

I should note as well that just like in #954, if you're using a custom command, the same comment applies here: make sure the correct options are enabled. Otherwise, the prime run environment variables may be incorrect.

If these are not sufficient, let me know and more can be added. I have no plans to ever own any Nvidia hardware, so I cannot test the code as it is currently, and it was implemented a long time ago (May/June 2022 it seems like, according to the wiki). It's possible things may have changed and other variables may be needed now.

Rabcor commented 10 months ago

The issue is unrelated to the custom command one. And I can see what the problem is, to apply primerun you just set the variables that primerun itself does on the spot.

The issue is that I am on a laptop, and I wanted my iGPU as the default gpu for vulkan applications. The only way to do it was to completely remove nvidia's vulkan icd from the icd file list (otherwise it was always default no matter what i did).

Which I do by setting this in my bash profile

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json:/usr/share/vulkan/icd.d/radeon_icd.i686.json

So my particular issue would be solved if the following were added to steamtinkerlaunch's primerun commands:

export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json

Or alternatively, if steamtinkerlaunch actually sought out the local primerun (or in some cases it's prime-run) and just ran that directly.

I also have another issue, mysteriously if I use prime-run in the steam launch options when i'm running something on steamtinkerlaunch, steamtinkerlaunch takes minutes to load up, if I don't, it takes seconds. Even if I just use prime-run on steam as a whole and leave it out of the launch options it still works the same, pretty misteriouos

So I'm caught in a situation where steamtinkerlaunch's primerun doesn't work for me, and if I use the normal prime-run my game takes ages to start through tinkerlaunch.

sonic2kk commented 10 months ago

I think the VK_ICD_FILENAMES export is fine. It saves us having to manage the two binary names or potentially have to introduce an option to select the ICD filename. No need to overengineer if the one-liner addition fixes it :-)

Just wondering: Should it be export VK_ICD_FILENAMES="${VK_ICD_FILENAMES}:/usr/share/vulkan/icd.d/nvidia_icd.json"? Or is it okay to override the way you have done here?


I will push this to a branch shortly and then you can test. Since I only own single-GPU AMD hardware, I have no way to test this (desktop has 7900XTX, laptop has 4700U, Steam Deck). I'm not sure how the previous maintainer who implemented this tested it either. My guess is that outside of cases like this, where the ICD list has been manually modified, that this setting would have worked as expected. If this is wrong and primerun has been broken without a report, please correct me so I can note it properly on the changelog.

To test, you can uninstall the AUR package, clone the repo, checkout the branch name (will post it when the branch is ready to test), and then run sudo make install. You can check you're on the right branch because the version will change. Once done, you can remove the branch installation by running sudo make uninstall. I'd recommend then either installing a git build with your package manager or in some other way, such as by checking out the main branch and running sudo make install. It would be better than going back to v12.12, which is 7+ months out of date now


Also, can't reproduce the minutes to start issue with Steam launch options set. I can't test primerun, but I tested mangohud and gamemode, STL launches as normal (1-2 secs). If this is an issue specific to primerun, the fix I'll push should resolve the need to ever use that, but otherwise it'll need to be fixed by a community member who has the issue and who has the hardware to troubleshoot.

sonic2kk commented 10 months ago

Branch is up at primerun-change, feel free to test if you have some time.

Rabcor commented 10 months ago

In my case, it should be fine to do:

export VK_ICD_FILENAMES="${VK_ICD_FILENAMES}:/usr/share/vulkan/icd.d/nvidia_icd.json

As you suggested, for me the effect should be the same and the potential benefit would be future compatibility if, say, nvidia icd name or location changes, or more nvidia icd files are added that would be used instead, I don't see why that would happen but you never know I suppose.

On the other hand, if ever there is a cornercase where the situation is reversed from mine and another icd is always selected over the nvidia one, using the original command I sent would prevent those users from experiencing issues instead.

Just a matter of priorities I suppose.

As for your branch, I would love to test it but I don't really know how to install custom git branches, I suppose now is a good time for me to look into it.

sonic2kk commented 10 months ago

As for your branch, I would love to test it but I don't really know how to install custom git branches, I suppose now is a good time for me to look into it.

I outlined it for you :-)

If you'd like more specific instructions, here are some:

A branch is simply a split from the current code where changes can be made independently from the master branch or other branches. It's a way to have a tree of changes for testing and development outside of the default master branch.

Once you're done testing, you can revert back with:

If you use your package manager, it'll handle updates for you. Otherwise, you'll have to update manually with git pull each time there's a new commit. If you installed with make, then you'll have to run sudo make install after each pull to make sure the new changes are applied correctly.

Rabcor commented 10 months ago

Thank you!

I tested it out, and I can confirm, this build solved my issue. Primerun on: nvidia gpu, primerun off: amd gpu.

sonic2kk commented 10 months ago

Will merge it now then and it'll be available on master, so any STL-git package or manual install from the master branch will have those changes in a few minutes :-)

The fix was basically submitted by you, all I did was paste the env var into the code, so thank you as well!

sonic2kk commented 10 months ago

Merged :partying_face: