You are not logged in.

#1 2021-09-16 09:50:32

blazej222
Member
Registered: 2018-08-30
Posts: 18

Swap GPU drivers without rebooting

Hello. I would like to write a script that would switch used GPU driver from Nvidia proprietary to nouveau without rebooting. I figured out it would probably take unloading one driver's kernel module and loading another one, but that's a wild guess.
I assume it would probably require X-server restart, but that's ok for me as long as we don't reboot the whole system.

Is it possible to do it?If yes, what modules should I load/unload? And is it enough to just call insmod/rmod?

Offline

#2 2021-09-16 10:16:33

Irets
Member
Registered: 2019-02-01
Posts: 143

Re: Swap GPU drivers without rebooting

To maintain longer uptimes after GPU driver upgrades, I've closed my X session and then ran "modprobe -r module1 module2 module3 etc" to all my nvidia modules that are seen from "lsmod | grep nvidia" and then modprobed them back using the same command, but without the "-r" option.
I don't see a reason why you could not "modprobe nouveau" instead after unloading your proprietary drivers first or vice versa.

This indeed requires a restart of the X session in order to have a fully working environment.

Edit:
The wiki gives you hints to which modules to remove/load in this article.
https://wiki.archlinux.org/title/Nouvea … _installed

From the looks of it, they use "rmmod nvidia" instead of "modprobe -r <modules-here-separated-with-spaces>", which I assume to recursively unload everything nvidia related.
The nouveau GPU drivers is just one module called "nouveau".

Last edited by Irets (2021-09-16 11:15:42)

Offline

#3 2021-09-17 06:36:15

blazej222
Member
Registered: 2018-08-30
Posts: 18

Re: Swap GPU drivers without rebooting

That works indeed. Thanks for your help!

How would I run a bash script that restarts X without killing itself? I assume if my DE dies, so will all child processes, meaning terminal in which the script was executed?

EDIT: I can use nohup, works flawlessly, thanks for help.

Last edited by blazej222 (2021-09-17 06:53:58)

Offline

#4 2021-09-17 07:20:11

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,464

Re: Swap GPU drivers without rebooting

Irets wrote:

I don't see a reason why you could not "modprobe nouveau" instead after unloading your proprietary drivers first or vice versa.

https://wiki.archlinux.org/title/Kernel_mode_setting

I think nouveau needs kms to provide graphical acceleration, and removing it may not be that easy, this is because kms itself is used to manage the console (tty).
One can try to unbind it from the console before modprobing relevant nvidia modules:

echo 0 > /sys/class/vtconsole/vtcon1/bind

...but meanwhile you'll have just a black screen everywhere and i wouldn't bet on system stability.

So while switching from nvidia-old to nvidia-new may work, switching from/to "nvidia <-> nouveau (with kms)" is more complex.

blazej222:
Can I ask you why you want that?

Last edited by kokoko3k (2021-09-17 07:22:37)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2021-09-17 07:33:51

blazej222
Member
Registered: 2018-08-30
Posts: 18

Re: Swap GPU drivers without rebooting

kokoko3k wrote:

blazej222:
Can I ask you why you want that?

I'm trying to run Autodesk Fusion 360 via wine, and while it works OK-ish on my laptop with Intel GPU, I can't get it to work with Nvidia card on my main PC because of this issue: https://github.com/cryinkfly/Fusion-360 … /issues/73
I thought a possible workaround around this bug would be to switch to nouveau drivers (the bug is not present while using opensource drivers) when running fusion, and still using proprietary drivers for gaming and other stuff.

Offline

#6 2021-09-17 12:00:05

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,464

Re: Swap GPU drivers without rebooting

Just a shoot in the dark then, have you tried to disable pageflip in nvidia control panel?
Another thing you could try, if you have an igpu available in your desktop, is to setup nvidia render offloading and just use the igp for fusion:
https://wiki.archlinux.org/title/PRIME# … er_offload


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#7 2021-09-17 18:59:59

blazej222
Member
Registered: 2018-08-30
Posts: 18

Re: Swap GPU drivers without rebooting

Unfortunately I don't have igpu in my desktop. Disabling pageflipping also didn't help - the problem occurs on OpenGL and DXVK/DX9 mode of the application. Nvidia driver says the app is blitting, not flipping.

Offline

Board footer

Powered by FluxBB