openSUSE / SUSEPrime

Provide nvidia-prime like package for openSUSE
64 stars 11 forks source link

prime-select must be killed to change graphics #55

Closed g7fernandes closed 4 years ago

g7fernandes commented 4 years ago

If nvidia is being used and one I wish to use intel, after sudo prime-select intel and log in and out, the nvidia driver will still be in use. If i try to change again to intel I get

"Error: a switch operation already in execution"
"You can undo it using sudo killall prime-select"

After

sudo killall prime-select
sudo prime-select intel

I can log in and out (when I log out it logs in immediately even without asking for password, I don't know if it is on propose, but it is nice ) and it will be using intel with nvidia off. If I try to use nvidia again, I have to go through the same process.

I'm using Opensuse Leap 15.2 with Gnome. The display manager is GDM. I have a Nvidia GTX 960.

sndirsch commented 4 years ago

Thanks for the report. Are you using

a) current git master (with bbswitch package and 09-nvidia-modprobe-bbswitch-G04.conf and prime-select.service installed and the latter enabled as described in README.md)

or

b) suse-prime-bbswitch package from openSUSE 15.2?

g7fernandes commented 4 years ago

b) I'm using the suse-prime-bbswitch package 0.7.12 (from community repo).

I noticed that if I log in and out more times it changes the driver. I suspect that sometimes it doesn't detect that I reloged. Another information. Using gnome-classic it worked with no problem (tested 3 times).

Using GDM + Gnome (default):

[ 09:42:47 ] Boot: setting-up nvidia card
[ 09:42:47 ] trying switch ON nvidia: [bbswitch] NVIDIA card is ON
[ 09:42:49 ] NVIDIA card correctly set
------------------------------------------------------------
sudo prime-select intel
Logout to switch graphics
------------------------------------------------------------
[ 09:43:15 ] user_logout_waiter: started
------------------------------------------------------------
<here I reloged>
-----------------------------------------------------------
$ /usr/sbin/prime-select get-current
Driver configured: nvidia
[bbswitch] NVIDIA card is ON

$ sudo prime-select intel
[sudo] password for root: 
Error: a switch operation already in execution
You can undo it using sudo killall prime-select
-----------------------------------------------------------
<No changes in the log, trying loggin out and in again>
-----------------------------------------------------------
$ /usr/sbin/prime-select get-current
Driver configured: intel
[bbswitch] NVIDIA card is OFF
-----------------------------------------------------------
<ok, now worked>
-----------------------------------------------------------
[ 09:49:08 ] user_logout_waiter: X restart detected, preparing switch to intel [ boot_state > S ]
[ 09:49:09 ] NVIDIA card will be switched off, NVIDIA offloading will not be available
[ 09:49:09 ] trying switch OFF nvidia: [bbswitch] NVIDIA card is OFF
[ 09:49:09 ] Intel card correctly set
[ 09:49:09 ] HotSwitch: starting Display Manager [ boot_state > N ]
-----------------------------------------------------------
$ sudo prime-select nvidia # changing again to nvidia 
-----------------------------------------------------------
[ 09:51:08 ] user_logout_waiter: started
-----------------------------------------------------------
<log in and out>
----------------------------------------------------------
$ /usr/sbin/prime-select get-current
Driver configured: intel
[bbswitch] NVIDIA card is OFF

-----------------------------------------------------------
<log in and out>
----------------------------------------------------------
/usr/sbin/prime-select get-current
Driver configured: intel
[bbswitch] NVIDIA card is OFF

If you find useful, here is my journalctl

https://drive.google.com/file/d/1r6T0NBbir2hJxYqctinolmakAyk7-9l_/view?usp=sharing

sndirsch commented 4 years ago

Thanks for the journalctl. Tried to fix this with this commit in master. Could you have a try, please?

sndirsch commented 4 years ago

As background. prime-select needs to wait until the session is terminated, so it can stop displayamanger, unload nvidia kernel modules, load bbswitch module, disable NVIDIA GPU and start again displaymanager. And vice versa when switching from intel mode to nvidia. nvidia modules and bbswitch module don't like each other.

sndirsch commented 4 years ago

Patch works for me. Tested with gdm and "GNOME on Xorg". Indeed I found "pam_unix(gdm-password:session): session closed" in journalctl output.

sndirsch commented 4 years ago

I made a 0.7.13 release, which includes the fix. openSUSE Devel project is also updated.

sndirsch commented 4 years ago

Closing as fixed.