bayasdev / envycontrol

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

Use of cache is not clear #167

Closed cMancio00 closed 4 months ago

cMancio00 commented 4 months ago

Don't know how to classify it, question or bug.

I wanted to use the new cache feature but I'm unsure that I understood how it works since it doesn't work in my pc.

I have a Dell Inc. Inspiron 16 7610, with i7-11800H a 3050ti and proprietary drivers. Everything works as intended in Integrated, hybrid and nvidia mode.

According to the readme I should be able to switch from Integrated to Nvidia (and viceversa?) without the need to reboot. However I have to reboot all the time.

This is what I've done to use the cache system:

Starting from hybrid mode

sudo envycontrol --cache-create

Using:

sudo envycontrol --cache-query

outputs:

{
    "nvidia_gpu_pci_bus": "PCI:1:0:0"
}

Now the cache is created so I can switch to Integrated mode and reboot with:

sudo envycontrol -s integrated

and then

reboot

After reboot I check that nvidia-smi outputs the error that no drivers are loaded and

envycontrol --query

gives of course integrated.

BTW I am still able to use my external display.

Now I was expecting that using:

sudo envycontrol -s nvidia

will switch mode without rebooting and nvidia-smi will work, but it is not the case.

Am I missing something? Maybe it will work with open source drivers?

Best regards

klmcwhirter commented 4 months ago

The cache is automatically created when you switch away from hybrid mode. There is no need to use the explicit command line options.

Steps

The intent of the cache is to switch directly from integrated mode to nvidia mode without switching to hybrid mode first. sudo envycontrol -s nvidia and REBOOT! The reboot is required to have the configuration changes take effect.

This works because the dGPU PCI Bus ID is cached so that the information is available when not in hybrid mode. The envycontrol app can then generate the /etc/X11/xorg.conf file with the correct bus id.

See lines switching to nvidia mode that need bus id.

But once those changes have been made, a reboot IS required as usual.

Hope that helps.

cMancio00 commented 4 months ago

Thanks for the clarification. I'll do a pull request to add this information on the README that (in my opinion) it is not clear about this topic. Best regards

bayasdev commented 4 months ago

Thanks for the clarification.

I'll do a pull request to add this information on the README that (in my opinion) it is not clear about this topic.

Best regards

Thanks @cMancio00, really appreciate it!

klmcwhirter commented 4 months ago

@cMancio00 - I added some review comments to your PR. Please take a look.

Thanks for taking the time to provide feedback!