bayasdev / envycontrol

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

Switching to nvidia don't work #89

Closed luigi370 closed 1 year ago

luigi370 commented 1 year ago

So i tried this and i can correctly switch btw hybrid and integrated modes but everytime i try nvidia mode computer won't boot. In my case this file did not exist.. /etc/X11/xorg.conf so the suggested fix not apply here. The grub debug just stop with the last line saying: [OK] Reached target Graphical Interface. and nothing else happens.

The ouput of lspci -k | grep -EA5 'VGA|3D' in hybrid mode is:

0000:00:02.0 VGA compatible controller: Intel Corporation Alder Lake-P Integrated Graphics Controller (rev 0c) Subsystem: Dell Device 0b19 Kernel driver in use: i915 Kernel modules: i915 0000:00:04.0 Signal processing controller: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant (rev 02) Subsystem: Dell Device 0b19

0000:01:00.0 3D controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] (rev a1) Subsystem: Dell Device 0b19 Kernel driver in use: nvidia Kernel modules: nouveau, nvidia_drm, nvidia 0000:a4:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS5260 PCI Express Card Reader (rev 01) Subsystem: Dell Device 0b19

That is exactly the same output i got before installing this app.

Desctop details: XPS 15 9520 CPU: 12th Gen Intel i7-12700H (20) @ 4.600GHz GPUs: Intel Alder Lake-P and NVIDIA GeForce RTX 3050 Mobile kernel version: 6.2.2-arch1-1 DE/WM: KDE Plasma 5.27.2 Nvidia driver version: 525.89.02-6 Steps to reproduce: just swtich to nvidia and restart External monitor: yes Was envycontrol working before: fist time intalation

Note: nvidia works just fine if using it like described here: https://wiki.archlinux.org/title/NVIDIA_Optimus#Use_NVIDIA_graphics_only

So i would assume the driver is correct.

Thanks in advance!

luigi370 commented 1 year ago

Extra note: on hybrid mode, I can successfuly send apps to execute on nvidia card. Extra note 2: i got this set in my grub: GRUB_CMDLINE_LINUX_DEFAULT='loglevel=3 quiet ibt=off i915.modeset=1 nvidia_drm.modeset=1' will try deleteing those extra params to see if is the issue.

bayasdev commented 1 year ago

Hello there, what DE/WM are you using?

luigi370 commented 1 year ago

kde Plasma 5.27.2 by the way, i cloned the repo to debut a little. is there any way to execute the switch method without really changing anything? just wanna debug the files created and values without really creating anything in my system. :D Thanks!

bayasdev commented 1 year ago

kde Plasma 5.27.2 by the way, i cloned the repo to debut a little. is there any way to execute the switch method without really changing anything? just wanna debug the files created and values without really creating anything in my system. :D Thanks!

It doesn't support dry runs but you can switch to Nvidia mode and grab a copy of the generated Xorg config before rebooting, as well you can return to hybrid mode prior.

luigi370 commented 1 year ago

I see! thanks for that. Look, this was my setup to just use nvidia before using your scritp. I dont really understand all options and how they work. But maybe rings the bell to you.

this for my grub: GRUB_CMDLINE_LINUX_DEFAULT='loglevel=3 quiet ibt=off i915.modeset=1

Xsetup: xrandr --setprovideroutputsource modesetting NVIDIA-0 xrandr --output eDP-1-1 --auto --pos 0x960 --output DP-1-2-1 --auto --pos 1920x0 (this is custom crap to set my secondary screen but --auto should work)

and 10-nvidia-drm-outputclass.conf: Section "OutputClass" Identifier "intel" MatchDriver "i915" Driver "modesetting" EndSection

Section "OutputClass" Identifier "nvidia" MatchDriver "nvidia-drm" Driver "nvidia" Option "AllowEmptyInitialConfiguration" Option "PrimaryGPU" "yes" ModulePath "/usr/lib/nvidia/xorg" ModulePath "/usr/lib/xorg/modules" EndSection

bayasdev commented 1 year ago

You don't need ibt=off with Nvidia 530+ drivers also i915.modeset=1 is not needed here.

Can you remove your custom Xsetup? you can do with envycontrol ---reset-sddm also remove the other Xorg config you have.

A little bit of context but initially Envycontrol used to generate a super simple Xorg config like yours but in some cases it didn't work so now it contains the PCI ID of the card.

On Fri, Mar 10, 2023, 09:36 Luis @.***> wrote:

I see! thanks for that. Look, this was my setup to just use nvidia before using your scritp. I dont really understand all options and how they work. But maybe rings the bell to you.

this for my grub: GRUB_CMDLINE_LINUX_DEFAULT='loglevel=3 quiet ibt=off i915.modeset=1

Xsetup: xrandr --setprovideroutputsource modesetting NVIDIA-0 xrandr --output eDP-1-1 --auto --pos 0x960 --output DP-1-2-1 --auto --pos 1920x0 (this is custom crap to set my secondary screen but --auto should work)

and 10-nvidia-drm-outputclass.conf: Section "OutputClass" Identifier "intel" MatchDriver "i915" Driver "modesetting" EndSection

Section "OutputClass" Identifier "nvidia" MatchDriver "nvidia-drm" Driver "nvidia" Option "AllowEmptyInitialConfiguration" Option "PrimaryGPU" "yes" ModulePath "/usr/lib/nvidia/xorg" ModulePath "/usr/lib/xorg/modules" EndSection

— Reply to this email directly, view it on GitHub https://github.com/bayasdev/envycontrol/issues/89#issuecomment-1463893504, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY7IYIYNNO57KWI7HUBTXLW3M36TANCNFSM6AAAAAAVWITZXQ . You are receiving this because you commented.Message ID: @.***>

luigi370 commented 1 year ago

if i remove ibt=off, i just tried, my pc stop booting. so now the only param in my kernel is ibt=off

luigi370 commented 1 year ago

so.. running sudo envycontrol -s nvidia generates: .few lines in the Xsetup file .a new file under /etc/X11/ and anything else i could check?

many thanks for your time by the way

bayasdev commented 1 year ago

You can send the content of those files to me

On Fri, Mar 10, 2023, 09:58 Luis @.***> wrote:

so.. running sudo envycontrol -s nvidia generates: .few lines in the Xsetup file .a new file under /etc/X11/ and anything else i could check?

many thanks for your time by the way

— Reply to this email directly, view it on GitHub https://github.com/bayasdev/envycontrol/issues/89#issuecomment-1463925178, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY7IYLWSH2XCBAUJYACTBTW3M6QZANCNFSM6AAAAAAVWITZXQ . You are receiving this because you commented.Message ID: @.***>

luigi370 commented 1 year ago

here it is xorg.conf https://dpaste.com/7Y8352UMY

and Xsetup https://dpaste.com/C9K8Y9LM7

bayasdev commented 1 year ago

Looks good to me, try removing the other .conf files you have created inside the /etc/X11/xorg.conf.d directory

On Fri, Mar 10, 2023, 10:02 Luis @.***> wrote:

here it is xorg.conf https://dpaste.com/7Y8352UMY

and Xsetup https://dpaste.com/C9K8Y9LM7

— Reply to this email directly, view it on GitHub https://github.com/bayasdev/envycontrol/issues/89#issuecomment-1463931628, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY7IYJNBYBU2QCQ3VX3OFLW3M7BNANCNFSM6AAAAAAVWITZXQ . You are receiving this because you commented.Message ID: @.***>

luigi370 commented 1 year ago

yes.. i removed already... there is another config there.. but just to increment the scrool on my mouse

bayasdev commented 1 year ago

yes.. i removed already... there is another config there.. but just to increment the scrool on my mouse

Can you capture the Xorg logs when the black screen happens?

https://wiki.archlinux.org/title/xorg#General

Thanks in advance.

luigi370 commented 1 year ago

Xorg.0.log here are the logs, i dont really get it.. why the error.. but there is an error. Thanks sir!

bayasdev commented 1 year ago

I see the problem, open your /etc/X11/xorg.conf and change the Nvidia bus ID to "PCI:1:0:0", somehow there's a bug with the regex that generates the Xorg config.

On Sat, Mar 11, 2023, 05:13 Luis @.***> wrote:

Xorg.0.log https://github.com/bayasdev/envycontrol/files/10948233/Xorg.0.log here are the logs, i dont really get it.. why the error.. but there is an error. Thanks sir!

— Reply to this email directly, view it on GitHub https://github.com/bayasdev/envycontrol/issues/89#issuecomment-1464877934, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY7IYL3KGQMLRJWSKRDVHTW3RF37ANCNFSM6AAAAAAVWITZXQ . You are receiving this because you commented.Message ID: @.***>

bayasdev commented 1 year ago

I rewrote the get PCI function, please clone this repository and perform the following steps:

git checkout rewrite-pci
sudo python ./envycontrol.py -s nvidia

Please let me know if the problem has been solved or not ;)

luigi370 commented 1 year ago

So far, i tested editing the file and works!!! that awesome. Will get some dinner for my child and try your branch. I let you know. Thanks Sir!

luigi370 commented 1 year ago

And yes! rewrite-pci branch does the job correctly. Would you latter on, merge and release it in AUR? I can survive patching the file manualy until you deploy this.

Again, many thanks for taking the time and for coding this. Is very usefull.

bayasdev commented 1 year ago

And yes! rewrite-pci branch does the job correctly. Would you latter on, merge and release it in AUR? I can survive patching the file manualy until you deploy this.

Again, many thanks for taking the time and for coding this. Is very usefull.

I'm happy to read the new implementation works as expected. Currently I'm working on the 3.0 version of EnvyControl which will be released soon with a handful of new CLI options and improved reliability.

bayasdev commented 1 year ago

@luigi370 version 3 has been released to the AUR 🎉

luigi370 commented 1 year ago

Yes! thanks a lot! :D