Skip to content

fix(output): restore configured topology after output reconnect#1176

Draft
zzxyb wants to merge 1 commit into
linuxdeepin:masterfrom
zzxyb:outputs
Draft

fix(output): restore configured topology after output reconnect#1176
zzxyb wants to merge 1 commit into
linuxdeepin:masterfrom
zzxyb:outputs

Conversation

@zzxyb

@zzxyb zzxyb commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Persist single-output and copy-mode state in global DConfig and restore the configured output topology after the initial output scan and subsequent reconnects. Replace the transient output config state and lifecycle helpers with OutputManager so primary-output intent, surface migration, copy-output recreation, and single-output fallback all use stable output IDs.

Re-register outputs consistently in the root container and output layout before applying configuration, and update virtual-output state when copy-mode groups are restored, changed, or removed.

Log: restore display mode after output reconnect
PMS: BUG-300647
Influence: Output mode restoration after display reconnect, hotplug, and restart

@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.

Sorry @zzxyb, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zzxyb

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

中文概述:
此 PR 旨在将输出拓扑(单屏 / 扩展 / 复制)相关状态持久化到全局 DConfig,并在初次扫描与输出重连(hotplug/reconnect)时基于稳定的 output ID 恢复配置;同时用新的 OutputManager 替代此前的临时状态与生命周期辅助类,以统一主屏意图、surface 迁移、复制输出重建与单屏回退逻辑。

English summary:
This PR persists single-output and copy-mode state into global DConfig and restores the configured output topology after the initial output scan and on output reconnects. It introduces OutputManager to replace transient output state/lifecycle helpers so primary-output intent, surface migration, copy-output recreation, and single-output fallback are driven by stable output IDs.

Changes:

  • Introduce src/output/outputmanager.{h,cpp} and migrate Helper’s output lifecycle logic from OutputConfigState/OutputLifecycleManager to OutputManager.
  • Rework initial scan + reconnect handling in Helper to restore extension/single/copy topology from global config and to re-register outputs consistently in root container/layout.
  • Extend virtual-output manager API and adjust output enabling / viewport detach ordering.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
waylib/src/server/qtquick/woutputviewport.cpp Adjusts detach ordering to avoid synchronous layer-change callbacks re-querying an already-detached viewport.
src/seat/helper.h Replaces old output helpers with OutputManager and adds new helper methods/state for topology restore.
src/seat/helper.cpp Major refactor: initial scan gating, restore logic, root/layout re-registration, copy/single persistence, and surface migration updates.
src/output/outputmanager.h Defines new OutputManager API for mode management, restore intents, and config persistence.
src/output/outputmanager.cpp Implements ID-based persistence/restore for single-output + copy-mode, plus primary-output intent tracking.
src/output/outputlifecyclemanager.h Removed (replaced by OutputManager).
src/output/outputlifecyclemanager.cpp Removed (replaced by OutputManager).
src/output/outputconfigstate.h Removed (no longer needed after moving persistence to global DConfig + OutputManager).
src/output/outputconfigstate.cpp Removed (no longer needed after moving persistence to global DConfig + OutputManager).
src/output/output.cpp Improves Output::enable() to reconcile cached _Enabled with wlroots enabled state and adds categorized logging.
src/modules/virtual-output/virtualoutputmanagerinterfacev1.h Adds APIs to restore/update/remove virtual output groups and exposes VirtualOutputInterfaceV1::name().
src/modules/virtual-output/virtualoutputmanagerinterfacev1.cpp Refactors persistent config handling and adds restore/update/remove support for virtual output groups.
src/CMakeLists.txt Replaces removed output helper sources with new outputmanager sources.
misc/dconfig/org.deepin.dde.treeland.output.json Removes per-output enabled key (shifts enable/disable semantics to global single-output/copy configuration).
misc/dconfig/org.deepin.dde.treeland.json Adds global keys: singleOutputId, createCopyOutput, copyOutputName, copyOutputOutputs.

Comment thread src/seat/helper.h Outdated
Comment thread src/seat/helper.cpp
Comment thread src/seat/helper.cpp Outdated
Comment thread src/seat/helper.cpp Outdated
Comment thread src/seat/helper.cpp Outdated
Comment thread src/seat/helper.cpp
Comment thread src/seat/helper.cpp Outdated
Comment thread src/seat/helper.cpp
Comment thread src/modules/virtual-output/virtualoutputmanagerinterfacev1.cpp
Comment thread misc/dconfig/org.deepin.dde.treeland.json Outdated
Persist single-output and copy-mode state in global DConfig and
restore the configured output topology after the initial output scan
and subsequent reconnects. Replace the transient output config state
and lifecycle helpers with OutputManager so primary-output intent,
surface migration, copy-output recreation, and single-output fallback
all use stable output IDs.

Re-register outputs consistently in the root container and output
layout before applying configuration, and update virtual-output state
when copy-mode groups are restored, changed, or removed.

Log: restore display mode after output reconnect
PMS: BUG-300647
Influence: Output mode restoration after display reconnect, hotplug, and restart
@zzxyb
zzxyb marked this pull request as draft July 21, 2026 07:44
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