bayasdev / envycontrol

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

[QUESTION] Use Intel's iGPU ONLY for hardware acceleration on `nvidia` mode? #146

Closed Impeta closed 7 months ago

Impeta commented 10 months ago

Title says it all. Is this feasible? I understand hybrid can fit my needs, but it halves somewhat performance on gaming and doesn't work as reliably on external monitors as nvidia does. While my NVIDIA dGPU can also function for HW, it's not as robust as my Intel iGPU.

bayasdev commented 10 months ago

Sadly it's not possible

On Wed, Nov 15, 2023, 23:47 Impeta @.***> wrote:

Title says it all. Is this feasible? I understand hybrid can fit my needs, but it halves somewhat performance on gaming and doesn't work as reliably on external monitors as nvidia does. While my NVIDIA dGPU can also function for HW, it's not as robust as my Intel iGPU.

— Reply to this email directly, view it on GitHub https://github.com/bayasdev/envycontrol/issues/146, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALY7IYM6QJZIK2DS6X2GEZLYEWLFPAVCNFSM6AAAAAA7NRFOQKVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE4TMMBVGE2DONY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

klmcwhirter commented 7 months ago

@bayasdev I believe this should be possible if:

Any reason that could not work?

bayasdev commented 7 months ago

@bayasdev I believe this should be possible if:

  • it can be assumed that envycontrol is run the first time in hybrid mode so that all needed values are available.

    • perhaps add an explicit cmd line option (e.g., --create-cache) to do this to remove "magic" feature
  • code is added to cache all needed info in ~/.cache/envycontrol/*/.yaml or equiv if it does not exist

    • consider updating cache when in hybrid mode

    • use the cached values if they exist

    • or add explicit cmd line option (e.g., --use-cache)

Any reason that could not work?

That's a clever approach @klmcwhirter!

It requires some refactoring but I don't see why it wouldn't work.

Feel free to send a PR and I'll review it ASAP ;)

klmcwhirter commented 7 months ago

@bayasdev I believe this should be possible if:

  • it can be assumed that envycontrol is run the first time in hybrid mode so that all needed values are available. ... snip Any reason that could not work?

That's a clever approach @klmcwhirter!

It requires some refactoring but I don't see why it wouldn't work.

Feel free to send a PR and I'll review it ASAP ;)

Sure, will do. I do not have the ability to test all the permutations - CUDA, etc. - but will do my best. We may have to enlist some help from others to test before merge. We can manage the testing in my fork-ed repo if you like to keep things cleaner.

I'll look at it tomorrow.

-k

bayasdev commented 7 months ago

@bayasdev I believe this should be possible if:

  • it can be assumed that envycontrol is run the first time in hybrid mode so that all needed values are available.

... snip

Any reason that could not work?

That's a clever approach @klmcwhirter!

It requires some refactoring but I don't see why it wouldn't work.

Feel free to send a PR and I'll review it ASAP ;)

Sure, will do. I do not have the ability to test all the permutations - CUDA, etc. - but will do my best. We may have to enlist some help from others to test before merge. We can manage the testing in my fork-ed repo if you like to keep things cleaner.

I'll look at it tomorrow.

-k

The only thing you need to cache are the dGPU PCI Bus ID, iGPU vendor and iGPU driver name.

klmcwhirter commented 7 months ago

@bayasdev should I target the main branch? I see there are a few others.

Thanks for the heads up!

I'll shoot you a link to a proposal for the cache file / design review before I start.

Looking at the GUIs (GNOME and KDE extensions) there may be a need to cache at the system level and user level potentially. Need to think on it a little more.

And I will try to make the feature transparent for them.

I might want to usre the GNOME extension myself ;)

bayasdev commented 7 months ago

Sorry, I forgot to read the issue title when answering you earlier.

At first sight, I thought you were proposing a solution to #79, which is switching directly from integrated to Nvidia by caching the dGPU bus ID on first run.

Regarding to this issue which is about using the iGPU on Nvidia mode, I've personally tried forcing things like VAAPI (which are not supported on Nvidia GPUs) to run on the iGPU but it fails.

Looking at the GUIs (GNOME and KDE extensions) there may be a need to cache at the system level and user level potentially. Need to think on it a little more.

These extensions are just wrappers for Envycontrol so if the default behavior is overridden to use a cache then it should work transparently without further action from them.

@bayasdev should I target the main branch? I see there are a few others.

Yes, you should target the main branch when sending the PR.

klmcwhirter commented 7 months ago

I'll switch to 79 for tracking my idea. Thanks.

Impeta commented 7 months ago

Regarding to this issue which is about using the iGPU on Nvidia mode, I've personally tried forcing things like VAAPI (which are not supported on Nvidia GPUs) to run on the iGPU but it fails.

@bayasdev So it isn't really possible? Sorry, I'm kind of confused too, based on you seemingly being as confused on misreading my title issue.

bayasdev commented 7 months ago

Regarding to this issue which is about using the iGPU on Nvidia mode, I've personally tried forcing things like VAAPI (which are not supported on Nvidia GPUs) to run on the iGPU but it fails.

@bayasdev So it isn't really possible? Sorry, I'm kind of confused too, based on you seemingly being as confused on misreading my title issue.

I'm sorry for the confusion I had caused.

From my understanding, when on Nvidia mode the iGPU acts only as a frame buffer and compute capabilities can't be used.