- Update to version 5.2.7:

* Various fixes. Use display port method to find gpu
  * Bump zbus and version
  * Update deps
  * Remove unnecessary debug info
  * For loop no longer ends when it encounters an error while reading the hwmon directory.
  * Update CHANGELOG.md
  * Fix dGPU detection for FA401WV
  * Bump version and deps
- Superseded GPUDetection.patch

OBS-URL: https://build.opensuse.org/package/show/hardware/supergfxctl?expand=0&rev=20
This commit is contained in:
R N 2025-02-16 19:46:10 +00:00 committed by Git OBS Bridge
commit 02007e981d
13 changed files with 466 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

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

26
_service Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<services>
<service name="obs_scm" mode="manual">
<param name="filename">supergfxctl</param>
<param name="url">https://gitlab.com/asus-linux/supergfxctl.git</param>
<param name="scm">git</param>
<param name="version">git-master</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="revision">5.2.7</param>
<param name="versionrewrite-pattern">v(.*)</param>
<!-- <param name="changesgenerate">enable</param> -->
<!-- <param name="changesauthor">R_Nik_C@proton.me</param> -->
</service>
<service name="set_version" mode="manual"/>
<service name="tar" mode="buildtime"/>
<service name="recompress" mode="buildtime">
<param name="compression">gz</param>
<param name="file">*.tar</param>
</service>
<service name="cargo_vendor" mode="manual">
<param name="srcdir">supergfxctl</param>
</service>
<!-- <service name="cargo_audit" mode="manual"> -->
<!-- <param name="srcdir">supergfxctl</param> -->
<!-- </service> -->
</services>

3
prime-run.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:300c5ca2f0449ea65ed3d9d4ce8e6933971c96a80a2949928c4834bfbba3480e
size 224267

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b192b4688537853457677232df99a8514dab656bb782bd99fb500b9b991058c
size 222731

3
supergfxctl-user.conf Normal file
View File

@ -0,0 +1,3 @@
# Type Name ID GECOS [HOME]
u supergfxctl - "supergfx daemon" -
m supergfxctl video - - -

217
supergfxctl.changes Normal file
View File

@ -0,0 +1,217 @@
-------------------------------------------------------------------
Sun Feb 16 19:03:45 UTC 2025 - R_Nik_C@proton.me
- Update to version 5.2.7:
* Various fixes. Use display port method to find gpu
* Bump zbus and version
* Update deps
* Remove unnecessary debug info
* For loop no longer ends when it encounters an error while
reading the hwmon directory.
* Update CHANGELOG.md
* Fix dGPU detection for FA401WV
* Bump version and deps
- Superseded GPUDetection.patch
-------------------------------------------------------------------
Fri Nov 22 23:36:28 UTC 2024 - RN <R_Nik_C@proton.me>
- Added prime-run binary that just links process to the nvidia
libraries
-------------------------------------------------------------------
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>
- Added patch for user groups
- Removed `users`, `sudo`, `adm` and `wheel` groups
- Added `video` group and separated `supergfxctl`
-------------------------------------------------------------------
Thu Oct 03 16:16:22 UTC 2024 - RN <R_Nik_C@proton.me>
- Update to version 5.2.4 release:
* Update CHANGELOG.md
* Fix dGPU detection for FA401WV
-------------------------------------------------------------------
Sun Sep 22 06:50:15 UTC 2024 - RN <R_Nik_C@proton.me>
- Update to version 5.2.4:
* Bump version and deps
* fix: check alternate path for egpu_enable flag
* Bump deps and version
* Bump deps
* Remove the nvidia/false config stuff as too problematic
* Further tweaks to asus dgpu safety check
* asus egpu fixes
* Update deps
* Update changelog
-------------------------------------------------------------------
Wed Jun 12 17:39:23 UTC 2024 - RN <R_Nik_c@proton.me>
- Fixing update process bug
-------------------------------------------------------------------
Thu Mar 28 19:59:05 UTC 2024 - RN <R_Nik_c@proton.me>
- Update to 5.2.1
- Better sanity check for booting without egpu after it was previously set
- Added Vulkan ICD profile switching
-------------------------------------------------------------------
Thu Dec 28 16:37:31 UTC 2023 - RN <R_Nik_C@proton.me>
- Switched to _service usage, because cargo_config is part of the vendor.tar now
- Cleaned up .spec
-------------------------------------------------------------------
Wed Dec 27 22:56:20 UTC 2023 - Jan Engelhardt <jengelh@inai.de>
- Avoid bashisms in build recipe
-------------------------------------------------------------------
Tue Nov 14 05:46:34 UTC 2023 - RN <R_Nik_C@proton.me>
- Update to version 5.1.2:
* Bump deps
* Add missing entry in changelog
* Adjust makefile to use vender-filter
* Ensure supergfx tries to fallback if change fails
* Small fixes for egpu
* Bump version
* Update deps
* Update deps
* Fix: Don't continue with action list if the error is a logout timeout
* Fix pipeline
-------------------------------------------------------------------
Fri Nov 18 07:57:22 UTC 2022 - luke@ljones.dev
- Update to version 5.0.1:
* Add dgpu status notification on dbus
* Fix: Check for GA401I, remove compute mode, set log level info
* Release 5.0.0
* Prep tag RC15
* RC15, final
* RC13 with various corrections
* Update dependencies
* Enable hotplug use, fixes to dgpu_disable, fixes to integrated
* Do pci rescan even if no missing device
* Update changelog
* Switch to async with tokio. Use asus switches if avilable. Bugfixes.
* Ignore possible i/o error as invalid
* Bump zbus version
* Add 99-nvidia-ac.rules udev rule
* fix: correction in changelog
* fix: make sure to use asus_use_dgpu_disable
* Add pipeline, cleanup with clippy
* 5.0.0-rc1
* Update dbus API docs (introspectable)
* Add more debug logging, default service to debug for now
* Switch to async runtime
* Slap Arc<Mutex<>> around gpu device
* Switch to udev. Add ASUS methods. Optimise.
* Remove dedicated mode
* Added pipe to sh command to install Rust Taken from the official Rust website -- https://www.rust-lang.org/tools/install
* fix AMD detection for pci-ids version 2020.03.20
-------------------------------------------------------------------
Tue Jul 05 08:23:07 UTC 2022 - luke@ljones.dev
- Update to version 4.0.5:
* Prep new release
* Fix interaction with newer lspci version
* add "Quadro" to the lspci parsing for NVIDIA cards
-------------------------------------------------------------------
Wed May 11 16:17:34 UTC 2022 - Enrico Belleri <idesmi@protonmail.com>
- Use obs services for source and vendor
-------------------------------------------------------------------
Fri Feb 4 22:35:35 UTC 2022 - Luke Jones <luke@ljones.dev>
- Version 4.0.4
- Adjust the kernel cmdline arg code path
-------------------------------------------------------------------
Thu Feb 3 21:37:52 UTC 2022 - Luke Jones <luke@ljones.dev>
- Version 4.0.3
- Add config option `no_logind`: Don't use logind to see if all sessions are
logged out and therefore safe to change mode. This will be useful for people not
using a login manager, however it is not guaranteed to work unless all graphical
sessions are ended and nothing is hooking the drivers. Ignored if `always_reboot`
is set.
- Add config option `logout_timeout_s`: The timeout in seconds to wait for all user
graphical sessions to end. Default is 3 minutes, 0 = infinite. Ignored if
`no_logind` or `always_reboot` is set.
- Add new dbus method: `PendingMode`, to check if a mode change is required
- Add new dbus method: `PendingUserAction`, to check if the user is required to perform an action
- Add new dbus method: `Config`, to get the current base config
- Add new dbus method: `SetConfig`, to set the base config
- Add `-p, --pend-action` CLI arg to get the pending user action if any
- Add `-P, --pend-mode` CLI arg to get the pending mode change if any`
- Add ability to read `supergfxd.mode=` from kernel cmdline on startup and set the mode appropriately
- CLI option `--force` was unused, it is now removed.
-------------------------------------------------------------------
Sat Jan 22 09:35:11 UTC 2022 - Luke Jones <luke@ljones.dev>
- Version 4.0.2
-------------------------------------------------------------------
Wed Jan 19 23:12:03 UTC 2022 - Luke Jones <luke@ljones.dev>
- Version 4.0.1
- Fix version upgrade of config
- Recreate the config if parsing fails
- Only write the (reboot) mode change to config file, don't update live config
- AMD dedicated + hybrid config for xorg
- "AllowExternalGpus" added to xorg for Nvidia Egpu mode
-------------------------------------------------------------------
Tue Jan 18 07:17:49 UTC 2022 - Luke Jones <luke@ljones.dev>
- Version 4.0.0
- Added
- Add new dbus method: `Version` to get supergfxd version
- Add new dbus method: `Vendor` to get dGPU vendor name
- Add new dbus method: `Supported` to get list of supported modes
- Add `-v, --version` CLI arg to get supergfxd version
- Add `-V, --vendor` CLI arg to get dGPU vendor name
- Add `-s, --supported` CLI arg to get list of supported modes
- Add new config option: `vfio_save` to reload VFIO on boot
- Add new config option: `compute_save` to reload compute on boot
- Add new config option: `always_reboot` reboot to change modes
- Changed
- Adjust startup to check for ASUS eGPU and dGPU enablement if no modes supported
- If nvidia-drm.modeset=1 is set then save mode and require a reboot by default\
- Add extra check for Nvidia dGPU (fixes Flow 13")
- Properly check the correct device for power status
- Breaking
- Rename Vendor, GetVendor to Mode, GetMode to better reflect their results
-------------------------------------------------------------------
Mon Jan 10 00:37:46 UTC 2022 - Luke Jones <luke@ljones.dev>
- Version 3.0.0
Sun Dec 19 07:43:11 UTC 2021 - Luke Jones <luke@ljones.dev>
- Version 2.0.5
-------------------------------------------------------------------
Tue Nov 2 20:23:58 UTC 2021 - Luke Jones <luke@ljones.dev>
- Version 2.0.4
-------------------------------------------------------------------
Tue Nov 2 03:56:07 UTC 2021 - Luke Jones <luke@ljones.dev>
- Version 2.0.3

4
supergfxctl.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: supergfxctl
version: 5.2.7
mtime: 1739659393
commit: a86383e1b2f32d4f87f8dd47f0d6b06690877c64

114
supergfxctl.spec Normal file
View File

@ -0,0 +1,114 @@
#
# spec file for package supergfxctl
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
Name: supergfxctl
Version: 5.2.7
Release: 0
Summary: Super graphics mode controller
License: MPL-2.0
URL: https://gitlab.com/asus-linux/supergfxctl
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.zst
Source2: %{name}-user.conf
Source3: prime-run.sh
Group: System/Daemons
## Patch for user-groups
Patch1: user-group.patch
##
BuildRequires: cargo-packaging
BuildRequires: pkgconfig
BuildRequires: sysuser-tools
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(systemd)
Requires: systemd
Conflicts: bbswitch
Conflicts: bumblebee
Conflicts: bumblebee-status-module-nvidia-optimus-manager
Conflicts: suse-prime
Conflicts: system76-power
%sysusers_requires
%description
supergfxctl is a super graphics mode controller for laptops with hybrid nvidia.
%prep
%autosetup -a1 -p1
%build
%cargo_build
%sysusers_generate_pre %{SOURCE2} %{name} %{name}-user.conf
%install
%cargo_install
mkdir -p "%{buildroot}%{_bindir}"
install -D -m 0755 target/release/supergfxd %{buildroot}%{_bindir}/supergfxd
install -D -m 0755 target/release/supergfxctl %{buildroot}%{_bindir}/supergfxctl
install -D -m 0644 data/90-supergfxd-nvidia-pm.rules %{buildroot}%{_udevrulesdir}/90-supergfxd-nvidia-pm.rules
install -D -m 0644 data/org.supergfxctl.Daemon.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/org.supergfxctl.Daemon.conf
install -D -m 0644 data/supergfxd.service %{buildroot}%{_unitdir}/supergfxd.service
install -D -m 0644 data/supergfxd.preset %{buildroot}%{_presetdir}/99-supergfxd.preset
install -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
install -D -m 0644 README.md %{buildroot}%{_datadir}/doc/%{name}/README.md
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}-user.conf
install -D -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/prime-run
%pre -f %{name}.pre
%service_add_pre supergfxd.service
%post
%service_add_post supergfxd.service
%preun
%service_del_preun supergfxd.service
%postun
%service_del_postun_with_restart supergfxd.service
if [ -e %{_sysconfdir}/modprobe.d/nvidia.conf ]
then
if grep -q "# options nvidia-drm.modeset=1" %{_sysconfdir}/modprobe.d/nvidia.conf
then
echo "optional nvidia-drm.modeset=1" > %{_sysconfdir}/modprobe.d/nvidia.conf
fi
fi
%files
%license LICENSE
%{_bindir}/supergfxd
%{_bindir}/supergfxctl
%{_bindir}/prime-run
%{_unitdir}/supergfxd.service
%{_presetdir}/99-supergfxd.preset
%{_udevrulesdir}/90-supergfxd-nvidia-pm.rules
%{_sysusersdir}/%{name}-user.conf
%ghost %attr(0644,root,root) %{_sysconfdir}/modprobe.d/supergfxd.conf
%config %{_sysconfdir}/dbus-1/system.d/org.supergfxctl.Daemon.conf
%dir %{_datadir}/doc/%{name}
%{_datadir}/doc/%{name}/*
%changelog

33
user-group.patch Normal file
View File

@ -0,0 +1,33 @@
diff --git a/data/org.supergfxctl.Daemon.conf b/data/org.supergfxctl.Daemon.conf
index 77fa627..9bc654f 100644
--- a/data/org.supergfxctl.Daemon.conf
+++ b/data/org.supergfxctl.Daemon.conf
@@ -2,24 +2,16 @@
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
- <policy group="adm">
- <allow send_destination="org.supergfxctl.Daemon"/>
- <allow receive_sender="org.supergfxctl.Daemon"/>
- </policy>
- <policy group="sudo">
- <allow send_destination="org.supergfxctl.Daemon"/>
- <allow receive_sender="org.supergfxctl.Daemon"/>
- </policy>
- <policy group="users">
+ <policy user="root">
+ <allow own="org.supergfxctl.Daemon"/>
<allow send_destination="org.supergfxctl.Daemon"/>
<allow receive_sender="org.supergfxctl.Daemon"/>
</policy>
- <policy group="wheel">
+ <policy group="video">
<allow send_destination="org.supergfxctl.Daemon"/>
<allow receive_sender="org.supergfxctl.Daemon"/>
</policy>
- <policy user="root">
- <allow own="org.supergfxctl.Daemon"/>
+ <policy group="supergfxctl">
<allow send_destination="org.supergfxctl.Daemon"/>
<allow receive_sender="org.supergfxctl.Daemon"/>
</policy>

3
vendor.tar.zst Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3a59b769c5b033ab5f8d10f5ebf3d894b4cb7880d4fbe664d010b12d931a831a
size 21090644