Skip to content

Add Discrete GPU Detection

Jan requested to merge Jan200101/switcheroo-control:PR/discrete-detection into master

supersedes !68 (closed) since it has become messy and unclear.

This Merge Request adds a boolean Discrete key which signifies if the GPU in question is considered Discrete or not by querying the driver and heuristics.

Detection is done in the following ways through udev:

  • amdgpu
  • nouveau
    • device info is queried
    • if the device platform is IGP or SOC its not discrete
    • otherwise its considered discrete
      • while this could be considered wrong, there are few available integrated Nvidia GPUs and to my knowledge no Multi GPU systems with an integrated Nvidia GPU
  • nvidia
    • always considered discrete
      • I found no good way to query the proprietary nvidia drivers without having to poke at it with proprietary libraries.
      • the same reason as for why the nouveau detection consideres anything else discrete also applies
  • i915
    • the PCI ID of integrated Intel GPUs appears to always be `0000:00:02.0`
      • I've asked around the community for sample data and out of 17 sets of data it applied every time

I've personally tested this against the following setups:

  • Intel integrated GPU
  • Nvidia discrete GPU (both using Nouveau and Nvidia drivers)
  • AMD discrete GPU
  • AMD integrated GPU

and this far had no issues.

CI failure appears to be unrelated to any code issues

it compiles fine locally and on copr

Edited by Jan

Merge request reports