- Added upstream GPU detection patch

OBS-URL: https://build.opensuse.org/package/show/hardware/supergfxctl?expand=0&rev=16
This commit is contained in:
R N 2024-11-18 16:45:44 +00:00 committed by Git OBS Bridge
parent 89dbf8d30c
commit 4de0dc36b2
3 changed files with 41 additions and 0 deletions

33
GPUDetection.patch Normal file
View File

@ -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();

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 18 16:44:53 UTC 2024 - RN <R_Nik_C@proton.me>
- Added upstream GPU detection patch
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Nov 18 11:07:05 UTC 2024 - RN <R_Nik_C@proton.me> Mon Nov 18 11:07:05 UTC 2024 - RN <R_Nik_C@proton.me>

View File

@ -32,6 +32,9 @@ Group: System/Daemons
## Patch for user-groups ## Patch for user-groups
Patch1: user-group.patch Patch1: user-group.patch
## Upstream GPU detection patch
Patch2: GPUDetection.patch
BuildRequires: cargo-packaging BuildRequires: cargo-packaging
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-1)