diff --git a/GPUDetection.patch b/GPUDetection.patch new file mode 100644 index 0000000..ceb7764 --- /dev/null +++ b/GPUDetection.patch @@ -0,0 +1,33 @@ +diff --git a/src/pci_device.rs b/src/pci_device.rs +index ef15d03..5645d9e 100644 +--- a/src/pci_device.rs ++++ b/src/pci_device.rs +@@ -317,18 +317,21 @@ impl Device { + // Assume all Nvidia GPUs are dGPU + class.starts_with("30") && (boot_vga == "0" || id.starts_with("10DE")) + } else if id.starts_with("1002") { +- debug!("Found AMD GPU {id} without boot_vga attribute at {:?}", device.sysname()); +- ++ debug!("Found AMD Device {id} without boot_vga attribute at {:?}", device.sysname()); + // Sometimes AMD iGPU doesn't get a boot_vga attribute even in Hybrid mode + // Fallback to the following method for telling iGPU apart from dGPU: + // https://github.com/fastfetch-cli/fastfetch/blob/fed2c87f67de43e3672d1a4a7767d59e7ff22ba2/src/detection/gpu/gpu_linux.c#L148 + let mut dev_path = PathBuf::from(device.syspath()); + dev_path.push("hwmon"); +- +- let hwmon_n_opt = dev_path.read_dir().map_err( +- |e| GfxError::from_io(e, dev_path) +- )?.next(); +- ++ ++ let hwmon_n_opt = match dev_path.read_dir() { ++ Ok(mut entries) => { ++ entries.next() ++ } ++ Err(_e) => { ++ None // Continue with the assumption it's not a dGPU ++ } ++ }; + match hwmon_n_opt { + Some(hwmon_n_result) => { + let mut hwmon_n = hwmon_n_result?.path(); diff --git a/supergfxctl.changes b/supergfxctl.changes index 19f6a4b..bd9d7ea 100644 --- a/supergfxctl.changes +++ b/supergfxctl.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Nov 18 16:44:53 UTC 2024 - RN + +- Added upstream GPU detection patch + ------------------------------------------------------------------- Mon Nov 18 11:07:05 UTC 2024 - RN diff --git a/supergfxctl.spec b/supergfxctl.spec index ad6acd8..36d102c 100644 --- a/supergfxctl.spec +++ b/supergfxctl.spec @@ -32,6 +32,9 @@ Group: System/Daemons ## Patch for user-groups Patch1: user-group.patch +## Upstream GPU detection patch +Patch2: GPUDetection.patch + BuildRequires: cargo-packaging BuildRequires: pkgconfig BuildRequires: pkgconfig(dbus-1)