public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Antheas Kapenekakis <lkml@antheas.dev>
Cc: linux-pm@vger.kernel.org, "Rafael J. Wysocki" <rafael@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	Mario Limonciello <mario.limonciello@amd.com>,
	luke@ljones.dev, me@kylegospodneti.ch,
	Denis Benato <benato.denis96@gmail.com>
Subject: Re: [PATCH v2 0/5] acpi/x86: s2idle: move Display off/on calls outside suspend (fixes ROG Ally suspend)
Date: Sun, 6 Oct 2024 12:16:17 +0200	[thread overview]
Message-ID: <fca2e4bd-10c6-462c-82a2-37627a797cb9@redhat.com> (raw)
In-Reply-To: <CAGwozwESYc=znHvgJidjxoUskRuzxgoVGY7=fnmPQyYOLJP_0w@mail.gmail.com>

Hi,

On 6-Oct-24 12:15 AM, Antheas Kapenekakis wrote:
> <skip>
> 
>> Thinking some more about this I am having second doubts about
>> moving the LPS0 display power off call to before devices are suspended,
>> doing so would mean that the display might still be on when that call
>> is made and that call could disable power-resources which are necessary
>> for the display causing issues when the display driver's suspend method
>> runs.
> 
> Is there any device where that is used for display powersaving?

The problem is that we cannot rule out that the LPS0 display off
call relies on the displays actually being off.

I have seen ACPI AML code do all sort of crazy stuff.

So IMHO we really need to make sure that all physical displays
are off before we make the LPS0 display off call.

I have read what you wrote about this also applying to virtual
displays, I guess that means that there should be no rendering done
(so also no GPU non display tasks) when this is called.

IOW it might be best to tie this to all VGA class PCI devices
being in D3 as Mario suggested.

Regards,

Hans








>> So I think that we need something closer to Mario's POC from:
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/superm1/linux.git/log/?h=superm1/dsm-screen-on-off
>>
>> here where the call is made when the last display is turned off.
>>
>> IOW have the drm modesetting core call this.
> 
> I can see two problems with this approach: 1) it would happen in a
> random point in the suspend sequence, introducing race conditions with
> sensitive modern standby devices (e.g., Ally). 2) It would not be
> gated and debounced properly, so a drm driver could call it 5 times
> when you e.g., plug in an HDMI cable.
> 
> And indeed that is the case, that PR horribly breaks the Ally even
> while any asus-wmi quirk was active. Perhaps DRM can be consulted
> though, see below.
> 
>> Maybe have something like a enabled_displays counter in the
>> drm-core which gets increased / decreased by helpers and
>> have the drm-core call platform_suspend_screen_off() /
>> platform_suspend_screen_on() when the counter goes from 1 -> 0
>> resp. 0 -> 1, ignoring the very first 0 -> 1 transition
>> which will be done when the first GPU with an enabled
>> output is found ?
> 
> To quote Microsoft [1], "This _DSM Function will be invoked when the
> operating system has entered a state where all displays—local and
> *remote*, if any—have been turned off."
> 
> Since it says remote, binding it to DRM could prove difficult. In
> addition, the call in Windows is made 5 seconds after the displays
> turn off due to inactivity. To mirror this behavior you would need
> userspace.
> 
> If there is strong indication that the Display On/Off calls interfere
> with the DRM subsystem, e.g., turn off a GPU in certain laptops, the
> call could be gated with a counter similar to Mario's PR and error
> out. In that way, it is still controllable by userspace while ensuring
> the device display is off. Is there such an indication/do we know of
> such a device?
> 
> The Ally and Legion Go which I tested happily had their display turn
> on after I yanked their display on and sleep exit callbacks. The
> Legion Go even had its suspend light blink while the screen was on.
> And both had disabled controllers. This behavior was sticky even after
> a reboot. I suppose this is due to the fact that the device might
> hibernate, so the EC would have to remember the last state before
> power off.
> 
>> The idea being that the first increase() call gets made when
>> a drm/kms driver probes a display and finds outputs which are
>> light up during probe() and then further increase / decrease
>> calls are made either when all displays go off; or maybe
>> per crtc when the crtc gets enabled / disabled.
>>
>> Anyways how best to do this at display off time should be
>> discussed with the drm/kms community on the dri-devel list.
> 
> I can cc on the next version.
> 
> Link: https://learn.microsoft.com/en-us/windows-hardware/design/device-experiences/modern-standby-firmware-notifications#display-off-notification-function-3
> [1]
> 
> Antheas
> 




  reply	other threads:[~2024-10-06 10:16 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
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 [this message]
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=fca2e4bd-10c6-462c-82a2-37627a797cb9@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=benato.denis96@gmail.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=lkml@antheas.dev \
    --cc=luke@ljones.dev \
    --cc=mario.limonciello@amd.com \
    --cc=me@kylegospodneti.ch \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@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