Github messages for voidlinux
 help / color / mirror / Atom feed
From: Treeniks <Treeniks@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: Suspend Boken under Nvidia Gnome Wayland
Date: Tue, 14 Nov 2023 07:19:55 +0100	[thread overview]
Message-ID: <20231114061955.OoQ4wmXLaXGU-d6qz9wBSpvlFDJP_wJZgD2N9eSnk50@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-47125@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 3923 bytes --]

New comment by Treeniks on void-packages repository

https://github.com/void-linux/void-packages/issues/47125#issuecomment-1809598774

Comment:
When I look into gdm's udev rules (located at `/lib/udev/rules.d/61-gdm.rules`), I can find these lines:
```
# Check if suspend/resume services necessary for working wayland support is available
TEST{0711}!="/usr/bin/nvidia-sleep.sh", GOTO="gdm_disable_wayland"
TEST{0711}!="/usr/lib/systemd/system-sleep/nvidia", GOTO="gdm_disable_wayland"
...
```
meaning they specifically disable wayland if a `/usr/bin/nvidia-sleep.sh` file is not found.

The Arch Wiki has some info on this:
<https://wiki.archlinux.org/title/GDM#Wayland_and_the_proprietary_NVIDIA_driver>
> If the Wayland option is not displayed in GDM, even after [enabling KMS](https://wiki.archlinux.org/title/NVIDIA#DRM_kernel_mode_setting) and [configuring Wayland](https://wiki.archlinux.org/title/NVIDIA#Wayland), then you most likely have `NVreg_PreserveVideoMemoryAllocations` and [NVIDIA systemd services](https://gitlab.gnome.org/GNOME/gdm/-/commit/51181871e9db716546e9593216220389de0d8b03) disabled.

<https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend>
> The **still experimental** system enables saving all video memory (given enough space on disk or main RAM). The interface is through the `/proc/driver/nvidia/suspend` file as follows:
> * write "suspend" (or "hibernate") to `/proc/driver/nvidia/suspend` immediately before writing to the usual Linux `/sys/power/state` file
> * write "resume" to `/proc/driver/nvidia/suspend` immediately after waking up, or after an unsuccessful attempt to suspend or hibernate.
>
> To save and restore all video memory contents, [load](https://wiki.archlinux.org/title/Kernel_modules#Setting_module_options) the nvidia kernel module with the `NVreg_PreserveVideoMemoryAllocations=1` option and [enable](https://wiki.archlinux.org/title/Enable) `nvidia-suspend.service` and `nvidia-hibernate.service`.
> [...]
> The interaction with `/proc/driver/nvidia/suspend` is handled by the simple Unix shell script at `/usr/bin/nvidia-sleep.sh`, which will itself be called by [systemd](https://wiki.archlinux.org/title/Systemd) or other tools. The [nvidia-utils](https://archlinux.org/packages/?name=nvidia-utils) package ships with the following services (which essentially just call `nvidia-sleep.sh`): `nvidia-suspend.service`, `nvidia-hibernate.service`, `nvidia-resume.service`.

The Debian docs on this also have similar instructions:
<https://wiki.debian.org/NvidiaGraphicsDrivers#Wayland>

From what I can tell by using `xlocate`, I cannot find any package which includes such services or scripts.

I am awfully unqualified for this, but I believe the only way to make this work in Void at the moment is to disable the GDM udev rule entirely (with `ln -s /dev/null /etc/udev/rules.d/61-gdm.rules`) and live with a broken suspend, until a similar `nvidia-utils` package is added.

I did however notice that the `/proc/driver/nvidia/suspend` file already has a `suspend hibernate resume` line written in it. Not sure what this does, ~~but maybe by simply adding the `NVreg_PreserveVideoMemoryAllocations=1` kernel module option, suspend can be fixed (or at least improved)?~~ After short testing, seems to change nothing.
I.e. adding a `/etc/modprobe.d/nvidia-power-management.conf` file (be careful not to name it `nvidia.conf` like my idiot self, that will override `/lib/modprobe.p/nvidia.conf` which blacklists nouveau) with the following content:
```
options nvidia NVreg_PreserveVideoMemoryAllocations=1
```
(and I believe one has to [reconfigure the linux kernel](https://docs.voidlinux.org/config/kernel.html#install-hooks)?)

It might also be possible to simply add `nvidia-sleep.sh` etc. manually by copying it over from the Arch or Debian packages, though that does seem rather hacky.

  parent reply	other threads:[~2023-11-14  6:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 19:30 [ISSUE] " CuriousApe2020
2023-11-14  6:05 ` Treeniks
2023-11-14  6:06 ` Treeniks
2023-11-14  6:09 ` Treeniks
2023-11-14  6:09 ` Treeniks
2023-11-14  6:19 ` Treeniks [this message]
2023-11-20 15:11 ` m3tav3rse
2024-05-03 12:47 ` tgorordo
2024-05-03 12:48 ` tgorordo
2024-05-03 23:27 ` mtvrsh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231114061955.OoQ4wmXLaXGU-d6qz9wBSpvlFDJP_wJZgD2N9eSnk50@z \
    --to=treeniks@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).