powerd shouldn't block while waiting for Chrome to turn displays on or off |
||||||||||
Issue descriptionpowerd logs: [0126/112416:INFO:daemon.cc(525)] Power button down [0126/112416:INFO:main.cc(240)] Launching "sync" [0126/112416:INFO:daemon.cc(1391)] Received request to stop forcing backlights off [0126/112416:INFO:display_power_setter.cc(80)] Asking Chrome to turn all displays on [0126/112418:INFO:internal_backlight_controller.cc(674)] Setting brightness to 572 (80%) over 0 ms [0126/112418:INFO:daemon.cc(1341)] Chrome is using normal display mode [0126/112418:INFO:daemon.cc(525)] Power button up There are ~2s between power button down and power button up, which will make chrome think that power button is kept pressed for 2s. This is bad for turning screen on from screen off, as it will trigger white animation and then cancel it. As I try it on cyan, I can visually see the white animation. This should be fixed either from chromeos side? or chrome side. Right now, the solution on chrome side I can think of is, do not StartShutdownTimer() when screen is off: https://cs.chromium.org/chromium/src/ash/system/chromeos/power/tablet_power_button_controller.cc?q=tablet_power_&sq=package:chromium&l=115 But it differs with android phone behaviors. I think it might be a RBS for m-57.
,
Jan 27 2017
Stephane, I'd love to hear your thoughts on this. Here's the relevant code in powerd:
if (set_display_power) {
// For instant transitions, this call blocks until Chrome confirms that it
// has made the change.
SetDisplayPower(display_power, TransitionToTimeDelta(display_transition));
}
// Apply the brightness after toggling the display power. If we do it the
// other way around, then the brightness set here has a potential to get
// interleaved with the display power toggle operation in some drivers
// resulting in this request being dropped and the brightness being set to its
// previous value instead. See chrome-os-partner:31186 and :35662 for more
// details.
ApplyBrightnessPercent(brightness_percent, brightness_transition,
BrightnessChangeCause::AUTOMATED);
That was ~2015. Is it still necessary for powerd to wait for the display power change to finish before changing the backlight brightness? If so, at the expense of some more complexity in powerd, I could probably switch this to an async call and have powerd wait until the D-Bus call finishes to set the brightness. That would make powerd not block here, which seems desirable anyway.
Note that this would be a risky change, though, and I'd need to make it quickly to be comfortable with asking for a merge to M57. If there's an easier way to work around this in the short term, that'd be better.
Another idea: powerd doesn't currently forward on timestamps from kernel input events, instead adding its own notion of "now" when it processes the event. Possibly it should use timestamps from events instead. This will probably be an easier change, although we need to check that it doesn't have other negative effects.
,
Jan 27 2017
I am pretty sure that's still needed, since this is a limitation that came from the kernel, and the kernel hasn't changed in that respect.
,
Jan 27 2017
Re powerd reading timestamps from the input_event struct: that's probably still a good thing, and I have a mostly-done change that should do that, but I realized that it probably won't help at all here. Chrome starts an internal timer when it sees the button-down report from powerd. Including a correct timestamp on the delayed button-up report won't help, since Chrome's timer will have already fired when it shows up. The only way to fix this will likely be to make powerd not block... which is scary, because we intentionally block right now since the kernel interface that we're using is racy. :-(
,
Jan 27 2017
I think the change to make powerd's calls async is still worthwhile, but I'm wondering if we can have a safer workaround in the M57 timeframe. Joe, can you test whether https://codereview.chromium.org/2651313004 helps here? I'm going with a 3-second delay, but we may need to avoid starting the timer entirely in this case, as you suggested earlier.
,
Jan 27 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/97f83d816742eef5677384925fd92d10eaa7dc9a commit 97f83d816742eef5677384925fd92d10eaa7dc9a Author: derat <derat@chromium.org> Date: Fri Jan 27 23:43:04 2017 chromeos: Avoid shutdown for delayed power button events. powerd makes blocking D-Bus calls to Chrome to turn the display on or off. When a power-button-down event turns the display on, this can result in the corresponding power-button-up event being delayed, which can then cause the system to be shut down prematurely. As a hopefully low-risk workaround for this, make TabletPowerButtonController wait 2000 (rather than 500) milliseconds before starting the shutdown animation if the screen was off when the power button was pressed. BUG=685734 Review-Url: https://codereview.chromium.org/2651313004 Cr-Commit-Position: refs/heads/master@{#446832} [modify] https://crrev.com/97f83d816742eef5677384925fd92d10eaa7dc9a/ash/system/chromeos/power/tablet_power_button_controller.cc
,
Jan 27 2017
,
Jan 28 2017
+ketakid
,
Jan 30 2017
Approving merge to M57 Chrome OS.
,
Jan 30 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/85d16735d1bdb59df1a1c229e8d381aa1a1a92f5 commit 85d16735d1bdb59df1a1c229e8d381aa1a1a92f5 Author: derat <derat@chromium.org> Date: Mon Jan 30 21:33:20 2017 chromeos: Avoid shutdown for delayed power button events. powerd makes blocking D-Bus calls to Chrome to turn the display on or off. When a power-button-down event turns the display on, this can result in the corresponding power-button-up event being delayed, which can then cause the system to be shut down prematurely. As a hopefully low-risk workaround for this, make TabletPowerButtonController wait 2000 (rather than 500) milliseconds before starting the shutdown animation if the screen was off when the power button was pressed. BUG=685734 NOTRY=true NOPRESUBMIT=true Review-Url: https://codereview.chromium.org/2651313004 Cr-Commit-Position: refs/heads/master@{#446832} (cherry picked from commit 97f83d816742eef5677384925fd92d10eaa7dc9a) Review-Url: https://codereview.chromium.org/2662903002 Cr-Commit-Position: refs/branch-heads/2987@{#188} Cr-Branched-From: ad51088c0e8776e8dcd963dbe752c4035ba6dab6-refs/heads/master@{#444943} [modify] https://crrev.com/85d16735d1bdb59df1a1c229e8d381aa1a1a92f5/ash/system/chromeos/power/tablet_power_button_controller.cc
,
Jan 31 2017
I'm going to keep this open to track making powerd's D-Bus calls async. The release-blocking issue should be worked around now, though.
,
Mar 17 2017
,
Apr 5 2017
,
Apr 5 2017
,
Jan 10 2018
|
||||||||||
►
Sign in to add a comment |
||||||||||
Comment 1 by derat@chromium.org
, Jan 26 2017Owner: derat@chromium.org