commit 02007e981daa1af3bd4aa5f8b96430d9aa458834467a26098ad1aafe7a81e42e Author: R N Date: Sun Feb 16 19:46:10 2025 +0000 - 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 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc 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/_service b/_service new file mode 100644 index 0000000..204ec20 --- /dev/null +++ b/_service @@ -0,0 +1,26 @@ + + + + supergfxctl + https://gitlab.com/asus-linux/supergfxctl.git + git + git-master + @PARENT_TAG@ + 5.2.7 + v(.*) + + + + + + + gz + *.tar + + + supergfxctl + + + + + diff --git a/prime-run.sh b/prime-run.sh new file mode 100644 index 0000000..162f343 --- /dev/null +++ b/prime-run.sh @@ -0,0 +1,3 @@ +#!/bin/bash +__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@" + diff --git a/supergfxctl-5.2.4.obscpio b/supergfxctl-5.2.4.obscpio new file mode 100644 index 0000000..b1114b4 --- /dev/null +++ b/supergfxctl-5.2.4.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:300c5ca2f0449ea65ed3d9d4ce8e6933971c96a80a2949928c4834bfbba3480e +size 224267 diff --git a/supergfxctl-5.2.7.obscpio b/supergfxctl-5.2.7.obscpio new file mode 100644 index 0000000..62f960e --- /dev/null +++ b/supergfxctl-5.2.7.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b192b4688537853457677232df99a8514dab656bb782bd99fb500b9b991058c +size 222731 diff --git a/supergfxctl-user.conf b/supergfxctl-user.conf new file mode 100644 index 0000000..4a22fdb --- /dev/null +++ b/supergfxctl-user.conf @@ -0,0 +1,3 @@ +# Type Name ID GECOS [HOME] +u supergfxctl - "supergfx daemon" - +m supergfxctl video - - - diff --git a/supergfxctl.changes b/supergfxctl.changes new file mode 100644 index 0000000..a8757c3 --- /dev/null +++ b/supergfxctl.changes @@ -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 + +- Added prime-run binary that just links process to the nvidia + libraries + +------------------------------------------------------------------- +Mon Nov 18 16:44:53 UTC 2024 - RN + +- Added upstream GPU detection patch + +------------------------------------------------------------------- +Mon Nov 18 11:07:05 UTC 2024 - RN + +- 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 + +- Update to version 5.2.4 release: + * Update CHANGELOG.md + * Fix dGPU detection for FA401WV + +------------------------------------------------------------------- +Sun Sep 22 06:50:15 UTC 2024 - RN + +- 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 + +- Fixing update process bug + +------------------------------------------------------------------- +Thu Mar 28 19:59:05 UTC 2024 - RN + +- 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 + +- 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 + +- Avoid bashisms in build recipe + +------------------------------------------------------------------- +Tue Nov 14 05:46:34 UTC 2023 - RN + +- 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> 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 + +- Use obs services for source and vendor + +------------------------------------------------------------------- +Fri Feb 4 22:35:35 UTC 2022 - Luke Jones + +- Version 4.0.4 +- Adjust the kernel cmdline arg code path + +------------------------------------------------------------------- +Thu Feb 3 21:37:52 UTC 2022 - Luke Jones + +- 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 + +- Version 4.0.2 + +------------------------------------------------------------------- +Wed Jan 19 23:12:03 UTC 2022 - Luke Jones + +- 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 + +- 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 + +- Version 3.0.0 + +Sun Dec 19 07:43:11 UTC 2021 - Luke Jones + +- Version 2.0.5 +------------------------------------------------------------------- +Tue Nov 2 20:23:58 UTC 2021 - Luke Jones + +- Version 2.0.4 + +------------------------------------------------------------------- +Tue Nov 2 03:56:07 UTC 2021 - Luke Jones + +- Version 2.0.3 diff --git a/supergfxctl.obsinfo b/supergfxctl.obsinfo new file mode 100644 index 0000000..69bf9b3 --- /dev/null +++ b/supergfxctl.obsinfo @@ -0,0 +1,4 @@ +name: supergfxctl +version: 5.2.7 +mtime: 1739659393 +commit: a86383e1b2f32d4f87f8dd47f0d6b06690877c64 diff --git a/supergfxctl.spec b/supergfxctl.spec new file mode 100644 index 0000000..cff07f9 --- /dev/null +++ b/supergfxctl.spec @@ -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 diff --git a/user-group.patch b/user-group.patch new file mode 100644 index 0000000..1334531 --- /dev/null +++ b/user-group.patch @@ -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"> + +- +- +- +- +- +- +- +- +- ++ ++ + + + +- ++ + + + +- +- ++ + + + diff --git a/vendor.tar.zst b/vendor.tar.zst new file mode 100644 index 0000000..aa0623d --- /dev/null +++ b/vendor.tar.zst @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a59b769c5b033ab5f8d10f5ebf3d894b4cb7880d4fbe664d010b12d931a831a +size 21090644