Skip to content

fix(power): backport screen-off stall fix to 2500u2 - #233

Merged
fly602 merged 1 commit into
linuxdeepin:release/2500u2from
fly602:backport/pr-217-release-2500u2
Nov 23, 2026
Merged

fly602 merged 1 commit into
linuxdeepin:release/2500u2from
fly602:backport/pr-217-release-2500u2

Conversation

@fly602

@fly602 fly602 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

来源与目标

变更

  1. X11 关屏路径先关闭显示器,再请求锁屏,避免锁屏阻塞关屏。
  2. SessionDBusProxy::showLockAuth() 按原 PR 使用原始异步 D-Bus 消息,不等待 LockFront 的回复。
  3. 快捷键工具的 PowerController::doLock() 改为异步调用 ShowAuth。

目标分支的 showLockAuth() 仍使用缓存的 DDBusInterface,因此该处 cherry-pick 有冲突。已采用原 PR 的异步消息实现,并删除因此不再使用的 LockFront 缓存接口及成员声明;不引入 master 上的其他提交。

验证

  • plugin-power-session、dde-shortcut-tool、tst-screensaverproxy 编译通过。
  • ctest -R '^power-screensaver-proxy$' --output-on-failure:1/1 通过。
  • 临时私有 D-Bus 验证:LockFront 暂不回复 ShowAuth 时,SessionDBusProxy::showLockAuth() 与 PowerController::doLock() 均在 0 ms 返回;LockFront 均成功回读 Power1.SleepLock。验证脚本不包含在提交中。

未执行真实会话的关屏、锁屏/解锁、待机/唤醒、休眠与关机验证;私有 D-Bus 和 offscreen 验证不会触发实际锁屏或关屏。

仅通过此 PR 回移修复,不直接更新目标分支,不启用自动合并。

Summary by Sourcery

Prevent screen-off operations from being blocked by synchronous lock-auth requests.

Bug Fixes:

  • Prevent screen-off and lock actions from stalling when LockFront does not respond promptly.

Enhancements:

  • Make lock-auth requests non-blocking across the power manager, session D-Bus proxy, and shortcut controller.
  • Turn off the display before initiating the optional screen lock during X11 screen-off handling.

@sourcery-ai

sourcery-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Uses of the API

Make both LockFront ShowAuth requests fire-and-forget so callers do not block while LockFront reads Power1, and remove the now-unused cached interface.

  • src/plugin-qt/power/session/sessiondbusproxy.cpp L40 (removed lines), L337-343
  • src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp L278-280
  • src/plugin-qt/power/session/sessiondbusproxy.h L156 (removed lines)

Implementation

Blank the display before requesting the lock so the lock flow cannot delay the screen-off operation.

  • src/plugin-qt/power/session/powermanager.cpp L644 (removed lines), L646-650

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp" line_range="280" />
<code_context>
-    lockFront.call("ShowAuth", autoStartAuth);
+    // Fire and forget: LockFront reads Power1 back, so waiting for its reply
+    // from a key handler only risks the 25s D-Bus timeout.
+    lockFront.asyncCall("ShowAuth", autoStartAuth);
 }

</code_context>
<issue_to_address>
**Session suspends before locking**

When lockFront takes longer than the 500 ms suspend pause to establish the lock, `PowerController::doLock()` returns after queuing `ShowAuth`, so `handleSystemSuspend()` proceeds to `systemSuspend()` while LockFront is still handling the request; the machine suspends with the session unlocked.

Wait for the lock to be established before proceeding with suspend.

Also at `src/plugin-qt/power/session/sessiondbusproxy.cpp:343`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

lockFront.call("ShowAuth", autoStartAuth);
// Fire and forget: LockFront reads Power1 back, so waiting for its reply
// from a key handler only risks the 25s D-Bus timeout.
lockFront.asyncCall("ShowAuth", autoStartAuth);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High · Session suspends before locking

When lockFront takes longer than the 500 ms suspend pause to establish the lock, PowerController::doLock() returns after queuing ShowAuth, so handleSystemSuspend() proceeds to systemSuspend() while LockFront is still handling the request; the machine suspends with the session unlocked.

Wait for the lock to be established before proceeding with suspend.

Also at src/plugin-qt/power/session/sessiondbusproxy.cpp:343.

Prompt for AI agents
In `src/plugin-qt/shortcut/tools/dde-shortcut-tool/powercontroller.cpp` at line 280:

**Session suspends before locking**

When lockFront takes longer than the 500 ms suspend pause to establish the lock, `PowerController::doLock()` returns after queuing `ShowAuth`, so `handleSystemSuspend()` proceeds to `systemSuspend()` while LockFront is still handling the request; the machine suspends with the session unlocked.

Wait for the lock to be established before proceeding with suspend.

Also at `src/plugin-qt/power/session/sessiondbusproxy.cpp:343`.

1. TurnOffScreen waited for LockFront ShowAuth while dde-lock read Power1
   SleepLock back, so both sides stalled until the 25s D-Bus timeout and
   the display stayed lit the whole time.
2. SessionDBusProxy::showLockAuth fire-and-forgets ShowAuth now, and the
   X11 turn-off path blanks the screen before requesting the lock.
3. dde-shortcut-tool's power controller uses the same async ShowAuth call,
   so the power-button shortcut no longer blocks its key handler.

Log: Blank the screen immediately instead of waiting for LockFront.

Influence:
1. Press the power button: the display blanks immediately; journalctl shows
   no 25s gap between "Locking session" and "Setting DPMS mode to off".
2. Lock/unlock, suspend/resume, hibernate and shutdown still work.
3. Repeat screen-off after a suspend/resume cycle and confirm the display
   still blanks immediately.

fix(power): 修复锁屏回读导致关屏延迟 25 秒

1. TurnOffScreen 同步等待 LockFront ShowAuth,而 dde-lock 在 ShowAuth
   中回读 Power1 SleepLock,双方互等到 25 秒 D-Bus 超时,期间屏幕
   一直亮着。
2. SessionDBusProxy::showLockAuth 改为异步发送 ShowAuth 后立即返回,
   X11 关屏路径先关闭显示器再请求锁屏。
3. dde-shortcut-tool 的电源控制器同样改为异步调用 ShowAuth,按电源键
   不再阻塞快捷键处理。

Log: 立即关闭显示器,不再等待 LockFront 返回。

Influence:
1. 按电源键后显示器立即熄灭;journalctl 中 "Locking session" 到
   "Setting DPMS mode to off" 不再有 25 秒间隔。
2. 锁屏/解锁、待机/唤醒、休眠、关机功能正常。
3. 待机/唤醒后再按一次电源键,确认显示器仍立即关闭。

(cherry picked from commit 308d430)

Log: Blank the screen immediately instead of waiting for LockFront.
PMS: BUG-382691
@fly602
fly602 force-pushed the backport/pr-217-release-2500u2 branch from ef5c1d2 to 5a05216 Compare November 23, 2026 08:41
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: fly602, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fly602
fly602 merged commit 712fc95 into linuxdeepin:release/2500u2 Nov 23, 2026
5 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants