Witko / nvidia-xrun

Utility to run separate X with discrete nvidia graphics with full performance
GNU General Public License v2.0
488 stars 69 forks source link

[Feature Request] Run without using bbswitch #67

Closed IngeniousDox closed 5 years ago

IngeniousDox commented 6 years ago

As requested in #61, a seperate feature request:

Newer GPUs/laptops, together with new pm-suspend work, make it possible to enable / disable the nvidia dGPU simply by loading / unloading the nvidia modules. Bbswitch is no longer needed. Actually kernel 4.17 (4.16.3+) leaves me unable to restart the dGPU if I disable it with bbswitch.

So my request is:

The ability to disable the use of bbswitch, as in skipping the code that toggles ON / OFF.

Perhaps this could be done with flag, or perhaps an .nvidia-xrun config file where you can store standard options, or both.

Witko commented 6 years ago

Hi @IngeniousDox , currently I'm unable to test this. On my laptop the nvidia module fails to load. Once this is fixed I'll have a look on this.

eadwu commented 6 years ago

On my xps 9570 I can confirm this approach. Though problems concerning the runtime power management still affect it (though somewhat fixable).

IngeniousDox commented 6 years ago

Yes, I have an XPS 15 9570 aswell. Our quest to figure out what is going on can be seen here:

https://bbs.archlinux.org/viewtopic.php?pid=1802234

We tried normal bbswitch / bbswitch-develop / bbswitch-pm-rework. But in the end the answer is simple, bbswitch doesn't work for us. Lekensteyn has said he isn't going to update bbswitch, since it isn't needed at all anymore, newer laptops should all be able to use runtime-suspend. Now, I don't know which models etc, but it does mean we need a way to use nvidia-xrun without using bbswitch.

Anyways, the reason why it works for is this Linux commit: https://github.com/torvalds/linux/commit/abf92f86361b , however that only works if you don't use bbswitch to turn off the nvidia card since that seems to destroy the state somehow.

eadwu commented 6 years ago

The main problem for me is that with the runtime pm is that it has to be enabled for the graphics card to actually "shutdown" but at the same time, it has to be enabled after I login into my graphical session, not during boot. I currently solve this using a shoddy workaround with sudoers during it manually at .xprofile which I don't prefer.

IngeniousDox commented 6 years ago

Yes, I read that people had that issue. I didn't get that far, since my testing was with me toggling it in Powertop. Letting TLP turn off the card gave me issue.

I explain it here, in the issue I opened with bumblebee, that is actually requesting the same thing as I'm requesting here: https://github.com/Bumblebee-Project/Bumblebee/issues/978#issuecomment-413141456

I don't like a shoddy workaround. But I don't know what the best option will be to fix this right now. My brain says we should solve the problem in our setup so nvidia-xrun can just load / unload the modules and it should work. But the bumblebee guys are talking about setting for us.

trgeiger commented 6 years ago

I've figured out that if you're using TLP and haven't blacklisted the NVIDIA GPU from power management, then the GPU is put into pm mode when the nvidia module(s) aren't loaded. I've also edited the nvidia-xrun script to skip the bbswitch bits, and it's working quite nicely on my 9570. I need to rewrite it a bit so that there's a configurable option to either use or disable bbswitch (thoughts on the best way to do this?) and then I can make a PR maybe?

IngeniousDox commented 6 years ago

Yeah, I did the same. Michelers put his fork online aswell: https://github.com/michelesr/nvidia-xrun/blob/master/nvidia-xrun

IngeniousDox commented 5 years ago

I noticed your changes, I hope to have time to check soon.

AUR still has a bbswitch as required dependency, perhaps it can be changed to optional? (Or removed - wasn't sure if bbswitch is used at all now)

Witko commented 5 years ago

Hi @IngeniousDox , it is still a bit "experimental". My old laptop died so i had no means of testing. Now i have a replacement so i hope to get the things moving soon.

michelesr commented 5 years ago

@IngeniousDox my fork has been merged here and bbswitch is no longer required

IngeniousDox commented 5 years ago

Awesome! Thanks you both.

Issue closed.

luukvbaal commented 5 years ago

PM doesn't seem to power down the dGPU on my Thinkpad W541. Not sure how to determine this programmatically but I can tell from the 10 degree temperature difference. Willing to troubleshoot this if anyone can throw me any suggestions, I couldn't figure whats wrong. Checked bus id's to be correct. I do run tlp but I have the dGPU bus id blacklisted and also tried it with tlp disabled. The latest bbswitch release of nvidia-xrun still works perfectly fine for me on the other hand...