bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
MIT License
1.34k stars 61 forks source link

[QUESTION] NVK? #153

Open boxyld opened 9 months ago

boxyld commented 9 months ago

What is your question? [...] Just wondering if i can use nvk drivers on this optimus tool

bayasdev commented 9 months ago

Hi @boxyld, unfortunately the only Nvidia hardware I own is a GTX1060 laptop so I've not had the opportunity to try it.

But I think the nvk driver follows the Linux rules and should support the standard switcherooctl.

Best regards.

boxyld commented 9 months ago

https://m.youtube.com/watch?v=77u61iB6zpE&feature=youtu.be

Either the guide has something worng or sadly it doesn't work

Edit(the guide forgot that i need to switch nouveau first so i would try later)

MrDuartePT commented 8 months ago

Nvk should be kinda easy to implement I will try to see about it tomorrow. Just need to ask to mesa/nouveau team if RD3D is working on nouveau or not since on my testing is allways stay D0, besides being set to auto

About switcherooctl not sure if still works. Small note DRI_PRIME works so switcherooctl is not needed at all

bayasdev commented 8 months ago

Nvk should be kinda easy to implement I will try to see about it tomorrow. Just need to ask to mesa/nouveau team if RD3D is working on nouveau or not since on my testing is allways stay D0, besides being set to auto

About switcherooctl not sure if still works.

I’d love to test EnvyControl with Nvk but I don’t own Turing (or later) hardware as I work from a MacBook Pro and my Linux laptop has a GTX 1060.

MrDuartePT commented 8 months ago

@bayasdev envycontrol support change the state without reboot, I dont use envycontrol for a long time. I was using superglxfctl because of that and vfio, now that I dont use vfio would be good to use envycontrol (I also dont know rust, that why Im chaging).

MrDuartePT commented 8 months ago

Nvk should be kinda easy to implement I will try to see about it tomorrow. Just need to ask to mesa/nouveau team if RD3D is working on nouveau or not since on my testing is allways stay D0, besides being set to auto About switcherooctl not sure if still works.

I’d love to test EnvyControl with Nvk but I don’t own Turing (or later) hardware as I work from a MacBook Pro and my Linux laptop has a GTX 1060.

For my looking to the files it seems the nvidia rules also work on nouveau since it also expose the sames file so that dosent need changes the only think is just detect if nouveau or nvidia is loaded or not. And ajust some files.

The only thing user will need to set is nouveau or nvidia modset.

bayasdev commented 8 months ago

@bayasdev envycontrol support change the state without reboot, I dont use envycontrol for a long time.

I was using superglxfctl because of that and vfio, now that I dont use vfio would be good to use envycontrol (I also dont know rust).

No, EnvyControl requires rebooting the machine to switch between modes.

I think these tools like Optimus Manager work by killing the X server so it applies the new config on a hot state as Arch Linux doesn't need to rebuild the initramfs when kernel parameters change.

bayasdev commented 8 months ago

Nvk should be kinda easy to implement I will try to see about it tomorrow. Just need to ask to mesa/nouveau team if RD3D is working on nouveau or not since on my testing is allways stay D0, besides being set to auto

About switcherooctl not sure if still works.

I’d love to test EnvyControl with Nvk but I don’t own Turing (or later) hardware as I work from a MacBook Pro and my Linux laptop has a GTX 1060.

For my looking to the files it seems the nvidia rules also work on nouveau since it also expose the sames file so that dosent need changes the only think is just detect if nouveau or nvidia is loaded or not. And ajust some files.

The only thing user will need to set is nouveau or nvidia modset.

Nouveau should be modeset by default as it's an in-tree kernel module, supporting this would require a refactor of the logic so we don't mix nouveau with things that only apply to the proprietary driver.

MrDuartePT commented 8 months ago

@bayasdev envycontrol support change the state without reboot, I dont use envycontrol for a long time. I was using superglxfctl because of that and vfio, now that I dont use vfio would be good to use envycontrol (I also dont know rust).

No, EnvyControl requires rebooting the machine to switch between modes.

I think these tools like Optimus Manager work by killing the X server so it applies the new config on a hot state as Arch Linux doesn't need to rebuild the initramfs when kernel parameters change.

Superglfx if you disable the dgpu or set the hybrid it basically reload the udev rules and then restart the display manager. I don't know if that would be possible to do with envycontrol need to look it to it. For at least integrated and hybrid would be interesting.

I just don't know what nvidia mode does since I never did to use it when switching the mux (if the mode where set to hybrid).

MrDuartePT commented 8 months ago

Nvk should be kinda easy to implement I will try to see about it tomorrow. Just need to ask to mesa/nouveau team if RD3D is working on nouveau or not since on my testing is allways stay D0, besides being set to auto

About switcherooctl not sure if still works.

I’d love to test EnvyControl with Nvk but I don’t own Turing (or later) hardware as I work from a MacBook Pro and my Linux laptop has a GTX 1060.

For my looking to the files it seems the nvidia rules also work on nouveau since it also expose the sames file so that dosent need changes the only think is just detect if nouveau or nvidia is loaded or not. And ajust some files. The only thing user will need to set is nouveau or nvidia modset.

Nouveau should be modeset by default as it's an in-tree kernel module, supporting this would require a refactor of the logic so we don't mix nouveau with things that only apply to the proprietary driver.

Yup I notice that some commands would need to disable or change when nouveau is loaded and envycontrol need to check that. I would try to see if I get to a working "prototype".

bayasdev commented 8 months ago

@bayasdev envycontrol support change the state without reboot, I dont use envycontrol for a long time.

I was using superglxfctl because of that and vfio, now that I dont use vfio would be good to use envycontrol (I also dont know rust).

No, EnvyControl requires rebooting the machine to switch between modes.

I think these tools like Optimus Manager work by killing the X server so it applies the new config on a hot state as Arch Linux doesn't need to rebuild the initramfs when kernel parameters change.

Superglfx if you disable the dgpu or set the hybrid it basically reload the udev rules and then restart the display manager, I don't if that would be possible to do with envycontrol need to look it to it.

For at least integrated and hybrid would be interesting.

This is feasible from my POV, if you have enough bandwidth to implement this please send a PR.

I just don't know what nvidia mode does since I never did to use it when switching the mux (if the mode where set to hybrid).

It's basically a Xorg hack where your iGPU becomes a framebuffer device and your dGPU is now in charge of rendering everything.

MrDuartePT commented 8 months ago

Oh ok I dont need that since I use wayland.

bayasdev commented 8 months ago

Oh ok I dont need that since I use wayland.

AFAIK the only way to get the dGPU work as the primary renderer on Wayland is by having a physical MUX switch that effectively makes your laptop video outputs work like a desktop PC. Since Nvidia's proprietary bs is broken on Wayland hahahaha

MrDuartePT commented 8 months ago

Oh ok I dont need that since I use wayland.

AFAIK the only way to get the dGPU work as the primary renderer on Wayland is by having a physical MUX switch that effectively makes your laptop video outputs work like a desktop PC. Since Nvidia's proprietary bs is broken on Wayland hahahaha

I think is no possible to change the MUX Switch on the fly (Advanced Optimus) on nouveau as well, but I could be wrong. Also AO can't not work with some Internal display the presence of mux switch is not the only required (the display also affect, mine works tho on Windows, but some Legion 5 with different display model have problems).

bayasdev commented 8 months ago

Oh ok I dont need that since I use wayland.

AFAIK the only way to get the dGPU work as the primary renderer on Wayland is by having a physical MUX switch that effectively makes your laptop video outputs work like a desktop PC. Since Nvidia's proprietary bs is broken on Wayland hahahaha

I think is no possible to change the MUX Switch on the fly (Advanced Optimus) on nouveau as well, but I could be wrong.

If they expose the functions to the kernel it can be made possible for Nouveau devs but seeing how Nvidia was in the past smh

MrDuartePT commented 8 months ago

I also think that will never happen, was a news saying nvidia was doing it for linux, but well 1.5 year later and nothing.

bayasdev commented 8 months ago

I also think that will never happen, was a news saying nvidia was doing it for linux, but well 1.5 year later and nothing.

Yup, Nvidia only supports Linux and FreeBSD because their cards are used for AI and super computing at datacenters.

MrDuartePT commented 8 months ago

And thing are kinda changing slow because some of there partner are demanding, because of RHEL kiling xorg support in the future. But the FreeBSD driver compare to the Linux one is a total mess.

MrDuartePT commented 8 months ago

@bayasdev this lightdm script is use for: https://github.com/bayasdev/envycontrol/blob/e10ac7e566b77a15dd7129be3c55a0e49878b8ff/envycontrol.py#L203 I dont use xorg and never use lightdm

For my understanding is to set NVIDIA and igpu as provider for lightdm, the problem I dont know what name nouveau give. @boxyld you can give the name of the xorg provider using the nouveau.

boxyld commented 8 months ago

Oh...sorry for being late i'm not that active on github + i already quit using envycontrol and relay using hybrid mode on default archinstall script

But still i would love to try gain specially cuz i'm just a noob user that st

Maybe there's a lot of stuff that i need to learn

Yeah even i wasn't know to to switch to open source nvidia drivers in general and i have to learn it...it will take a while spically i'm not that active

boxyld commented 4 months ago

Update after 4 months LMAO

anyway to make NVK works well we should replace nvidia-drm.modeset=1 to nouveau.config=NvGspRm=1

I switched to NVK manually without useing envycontrol

Anyway hope that helps