pop-os / cosmic-epoch

Next generation Cosmic desktop environment
1.71k stars 54 forks source link

[Feature Request] Select primary GPU #276

Open m1m1k4tz opened 2 months ago

m1m1k4tz commented 2 months ago

It would be nice for laptop users with an iGPU and dedicated GPU, also for double gpu pass through for VMs to be able to select the primary GPU to be used when there two available ones.

Drakulix commented 2 months ago

Cosmic doesn't really have a concept of a primary-gpu.

It has a fallback-gpu that it uses in (very rare) cases, where it cannot determine the appropriate gpu to use and that defaults to the internal gpu / boot gpu / first gpu (in this order) in the system (but is configurable via an environment variable).

In all cases it tries to figure out the appropriate gpu to use for best performance and latency on a case-by-case basis. (E.g. compositing outputs connected to the dedicated gpu and displaying apps running on the dedicated gpu with the dedicated gpu to avoid unnecessary copies.)

So effectively Cosmic will always use all gpus in the system, that are required for a given configuration. But it does so lazily, so there will not be any open resources to e.g. the dedicated gpu, if nothing is using it. And resources will be freed again opportunistically, e.g. to allow the gpu to enter sleep modes. (The desktop also displays gpu-usage by apps in the power applet.)

This should give you all information to be able to re-bind a gpu for gpu-passthrough without any explicit configuration.