public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: Antheas Kapenekakis <lkml@antheas.dev>
Cc: linux-pm@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	luke@ljones.dev, me@kylegospodneti.ch,
	Denis Benato <benato.denis96@gmail.com>
Subject: Re: [PATCH v2 2/5] acpi/x86: s2idle: handle Display On/Off calls outside of suspend sequence
Date: Mon, 23 Sep 2024 12:05:02 -0500	[thread overview]
Message-ID: <257cf784-f038-494f-bd45-016172fcd639@amd.com> (raw)
In-Reply-To: <CAGwozwHbt8+hVDpyz8GM=Lwg8o=oLZDgCJ9JZN_HRzHLuwuknA@mail.gmail.com>

On 9/23/2024 11:43, Antheas Kapenekakis wrote:
> 
> If it were me, yes, systemd would switch the system to the inactive
> "Screen Off" state 5 seconds after the system displays are off due to
> inactivity. If we are talking about implementing something Modern
> Standby-like, then pressing the powerbutton would no longer suspend
> the device. Instead systemd would use two tiers of activators like
> windows (first tier for "Screen Off", second tier for "Sleep"; right
> now there is only one tier that mirrors screen off) and once all those
> activators are released, suspend the kernel.
> 
> Then it would handle the transition from "Active" to "Screen Off" to
> "Sleep" through a sysfs endpoint, with the platform responding by
> e.g., lowering TDP and using a different fan curve.
> 
> If the kernel is asked to suspend outside of the Sleep state, then it
> does the transitions to reach that state and references the quirk
> table to avoid racing conditions in manufacturer firmware (not with
> the kernel), before it suspends.
> 
>> Important to note; it DOESN'T explicitly turn off displays.  If you
>> configured it to suspend then displays get turned off as part of the
>> kernel suspend sequence (drm_atomic_helper_disable_all).
>>
>> If it is configured to trigger a lockscreen then the compositor will
>> turn off displays after whatever the DPMS configuration is set to.
> 
> The problem with a DRM atomic helper is that we cannot control how it
> is called and do debouncing. WIndows does debouncing (part of that is
> waiting for 5 seconds so that if you move the mouse the call is
> skipped). You could have edge conditions that spam the calls.
> 
> Antheas

I'm not meaning that anything in userspace SHOULD be calling 
`drm_atomic_helper_disable_all`, my point was that this is how it's 
normally called in the suspend sequence.  Folks who work on the 
compositors don't like anyone other than the kernel touching their
configuration at runtime.

I think a lot of what you're looking for is the concept of a systemwide 
"userspace only" suspend sequence.  A lot of devices already support 
runtime PM and will already go into the low power state when not in use. 
  For example USB4 routers you'll see in D3 until you plug something 
into the USB4 port.

IMO your proposal needs to cross at least 3 projects.  Here's my 
thoughts on it.

1) systemd
    * To be able to handle behaviors associates with a dark screen only
      suspend/resume.  I did start a discussion on dark resume some time
      back but it went nowhere. [1]

    * Make sure that all devices have been put into runtime PM.
    * Notify compositor that screens should be turned off.
    * Manage transitions from dark screen to full suspend and vice versa.

2) Kernel
   A. To be able to notify the _DSM at the right time that all CRTCs have
      been turned off).
   B. To be able to notify the _DSM at the right time that at least one
      CRTC is now on.

3) Wayland protocols
    Introduce a new protocol for requesting userspace suspend.
    To notify that dark screen only suspend is being triggered.
4) Compositor use.
    All the popular compositors would need to add support for the new
    protocol.  IE Gamescope, mutter, kwin.

This isn't a trivial effort, there are a lot of people to convince.  I 
think the lowest effort is to start with kernel.  IE having DRM core 
call the _DSM when the CRTCs are off.  If you get that far, you can at 
least get this power saving behavior when DPMS is enacted.  Then you can 
work with systemd and wayland protocol folks.


[1] https://github.com/systemd/systemd/issues/27077

  parent reply	other threads:[~2024-09-23 17:05 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-22 17:22 [PATCH v2 0/5] acpi/x86: s2idle: move Display off/on calls outside suspend (fixes ROG Ally suspend) Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 1/5] acpi/x86: s2idle: add support for Display Off and Display On callbacks Antheas Kapenekakis
2024-09-23 15:57   ` Mario Limonciello
2024-09-22 17:22 ` [PATCH v2 2/5] acpi/x86: s2idle: handle Display On/Off calls outside of suspend sequence Antheas Kapenekakis
2024-09-23 16:03   ` Mario Limonciello
2024-09-23 16:15     ` Antheas Kapenekakis
2024-09-23 16:30       ` Mario Limonciello
2024-09-23 16:43         ` Antheas Kapenekakis
2024-09-23 17:01           ` Antheas Kapenekakis
2024-09-23 17:05           ` Mario Limonciello [this message]
2024-09-23 17:13             ` Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 3/5] acpi/x86: s2idle: add quirk table for modern standby delays Antheas Kapenekakis
2024-09-22 17:54   ` Denis Benato
2024-09-22 18:00     ` Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 4/5] acpi/x86: s2idle: call Display On/Off as part of callbacks and rename Antheas Kapenekakis
2024-09-22 17:22 ` [PATCH v2 5/5] platform/x86: asus-wmi: remove Ally (1st gen) and Ally X suspend quirk Antheas Kapenekakis
2024-09-22 18:15 ` [PATCH v2 0/5] acpi/x86: s2idle: move Display off/on calls outside suspend (fixes ROG Ally suspend) Derek J. Clark
2024-09-22 19:40   ` Antheas Kapenekakis
2024-09-23  1:35     ` Derek J. Clark
2024-09-23  5:57       ` Antheas Kapenekakis
2024-09-23 11:09         ` Luke Jones
2024-09-23 13:11           ` Antheas Kapenekakis
2024-09-23 15:56             ` Mario Limonciello
2024-09-23 16:11               ` Antheas Kapenekakis
2024-09-23 16:21                 ` Mario Limonciello
2024-09-23 16:54                   ` Antheas Kapenekakis
2024-09-23 17:15                     ` Mario Limonciello
2024-09-23 17:48                       ` Antheas Kapenekakis
2024-10-05 14:21 ` Hans de Goede
2024-10-05 15:10   ` Antheas Kapenekakis
2024-10-05 16:24     ` Hans de Goede
2024-10-05 16:27       ` Hans de Goede
2024-10-05 16:50         ` Antheas Kapenekakis
2024-10-05 16:57       ` Antheas Kapenekakis
2024-10-05 21:47       ` Hans de Goede
2024-10-05 22:15         ` Antheas Kapenekakis
2024-10-06 10:16           ` Hans de Goede
2024-10-06 11:29             ` Antheas Kapenekakis

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=257cf784-f038-494f-bd45-016172fcd639@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=benato.denis96@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=lkml@antheas.dev \
    --cc=luke@ljones.dev \
    --cc=me@kylegospodneti.ch \
    --cc=platform-driver-x86@vger.kernel.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