Skip to content

feat(output-manager): adapt to treeland-output-manager v2 protocol - #1386

Draft
deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/b451c6d13070
Draft

feat(output-manager): adapt to treeland-output-manager v2 protocol#1386
deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/b451c6d13070

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

概述

适配 treeland-protocols 0.6.0 的 breaking 变更,将 output-manager 模块从 v1 迁移到 v2。

WM-441

变更内容

  • 接口重命名: treeland_output_manager_v1_v2treeland_output_color_control_v1treeland_output_picture_control_v2
  • set_primary_output: 参数从 string(输出名)改为 wl_output 对象(non-null, enabled)
  • primary_output 事件: 从 string 改为 wl_output(null 表示无可用输出),bind 后立即发送一次
  • 新增 primary_output_failed 事件 + primary_output_error 枚举: 禁用/不可用输出通过该事件报告
  • result 事件: 参数从 uint flag(1=成功/0=失败)改为 commit_result 枚举(success=0, failed=1, unsupported=2, invalid_output=3, invalid_color_temperature=4, invalid_brightness=5),值反转
  • 移除 picture control error 枚举: 越界值改由 result 事件反馈而非协议错误
  • destroy 移至首个请求位: opcodes 偏移

修改文件 (14 files changed, +507/-329)

源码:

  • src/modules/output-manager/CMakeLists.txt — XML 路径和 BASENAME 更新为 v2
  • src/modules/output-manager/outputmanagement.h — 类名和接口版本更新
  • src/modules/output-manager/outputmanagement.cpp — 完整 v2 实现
  • src/seat/helper.h / src/seat/helper.cpp — 类型引用和变量命名更新

测试:

  • tests/protocols/CMakeLists.txt — 子目录引用更新
  • tests/protocols/treeland-output-manager-v2/ — 完整 v2 测试(7 个测试用例)
  • tests/test_protocol_primary-output/main.cpp — 类型引用更新

测试结果

7/7 passed — test_treeland_output_manager_v2
1/1 passed — test_protocol_primary-output

代码审查

已通过 Code Review 审查(87/100),并修复了审查反馈:

  1. commit 验证顺序修正(先校验 pending 值,再检查 output)
  2. 变量命名 m_outputManagerV1m_outputManagerV2
  3. 测试代码冗余 (void)data; 移除

Summary by Sourcery

Migrate output management to the Treeland v2 protocol and validate its new output-object, failure-reporting, and picture-control result semantics.

New Features:

  • Migrate the output manager and picture-control interfaces to the Treeland output-manager v2 protocol.
  • Expose primary outputs as wl_output objects with immediate bind notifications and explicit failure reporting.
  • Return detailed picture-control commit outcomes, including success, unsupported, and failure states.

Bug Fixes:

  • Prevent invalid or unavailable outputs from being silently accepted when selecting the primary output or creating picture controls.

Enhancements:

  • Update output color application handling to distinguish unsupported hardware from failed commits and validate pending settings consistently.

Build:

  • Update protocol generation and test configuration to use the unstable output-manager v2 XML definitions.

Documentation:

  • Add protocol test documentation describing v2 behavior and coverage.

Tests:

  • Replace the v1 protocol tests with v2 coverage for primary-output events, output selection, picture-control creation, successful commits, and validation errors.

Chores:

  • Rename output-manager implementation and helper references from v1 to v2 throughout the compositor.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

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

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Migrates output-manager server and tests from the v1 protocol to treeland-protocols v2, including wl_output-based primary-output selection/events, explicit failure reporting, and enum-based picture-control commit results. The new 7-case protocol suite and primary-output test pass, while disabled/unavailable-output, brightness, unsupported, and rendering paths remain untested.

Sequence diagram for v2 primary output selection

sequenceDiagram
    participant Client
    participant OutputManagerV2
    participant RootSurfaceContainer
    participant WlOutput

    Client->>OutputManagerV2: bind_resource
    OutputManagerV2->>RootSurfaceContainer: primaryOutput()
    OutputManagerV2->>WlOutput: outputResourceForClient()
    OutputManagerV2-->>Client: primary_output(wl_output or null)
    Client->>OutputManagerV2: set_primary_output(wl_output)
    OutputManagerV2->>WlOutput: wlr_output_from_resource()
    alt output invalid, disabled, or unavailable
        OutputManagerV2-->>Client: primary_output_failed(invalid_output)
    else output enabled and available
        OutputManagerV2->>RootSurfaceContainer: setPrimaryOutput()
    end
    RootSurfaceContainer-->>OutputManagerV2: primaryOutputChanged
    OutputManagerV2-->>Client: primary_output(wl_output or null)
Loading

Sequence diagram for v2 picture-control commit results

sequenceDiagram
    participant Client
    participant PictureControlV2
    participant Output

    Client->>PictureControlV2: set_color_temperature(temperature)
    Client->>PictureControlV2: set_brightness(brightness)
    Client->>PictureControlV2: commit()
    alt invalid color temperature
        PictureControlV2-->>Client: result(invalid_color_temperature)
    else invalid brightness
        PictureControlV2-->>Client: result(invalid_brightness)
    else output unavailable
        PictureControlV2-->>Client: result(invalid_output)
    else no pending changes
        PictureControlV2-->>Client: result(success)
    else valid pending changes
        PictureControlV2->>Output: setOutputColor()
        Output-->>PictureControlV2: success
        PictureControlV2-->>Client: result(success or failed)
    end
Loading

File-Level Changes

Change Details Files
Migrate the generated Wayland server integration and application-facing classes from output-manager v1 to unstable v2.
  • Generate bindings from the v2 protocol XML and update interface/class names.
  • Attach the v2 manager from seat initialization and update primary-output signal wiring.
  • Update protocol consumers and primary-output unit-test references.
src/modules/output-manager/CMakeLists.txt
src/modules/output-manager/outputmanagement.h
src/modules/output-manager/outputmanagement.cpp
src/seat/helper.h
src/seat/helper.cpp
tests/test_protocol_primary-output/main.cpp
Implement v2 primary-output semantics using client-specific wl_output resources and explicit failure reporting.
  • Send the current primary wl_output immediately on manager bind and on changes, or null when unavailable.
  • Accept a wl_output object for set_primary_output and reject unknown or disabled outputs with primary_output_failed.
  • Create picture controls for live wl_output resources, including unavailable outputs that later report invalid_output on commit.
src/modules/output-manager/outputmanagement.cpp
Adapt picture-control transactions and result handling to the v2 commit protocol.
  • Replace protocol errors for invalid brightness/color temperature with commit-time result enum events.
  • Track whether each setting is pending, validate pending values before output state, and report success for empty commits.
  • Convert protocol brightness values to internal scaling and map asynchronous backend success/failure to v2 result values.
src/modules/output-manager/outputmanagement.cpp
Replace the v1 protocol test suite with v2 coverage and fixtures.
  • Point the test build at the unstable-v2 XML and rename the generated client/test artifacts.
  • Exercise binding, initial primary_output, valid primary selection, picture-control creation, empty commit success, and invalid color-temperature reporting.
  • Document untested failure and rendering scenarios.
tests/protocols/CMakeLists.txt
tests/protocols/treeland-output-manager-v1/README.md
tests/protocols/treeland-output-manager-v1/treeland-output-manager-v1.c
tests/protocols/treeland-output-manager-v1/CMakeLists.txt
tests/protocols/treeland-output-manager-v2/README.md
tests/protocols/treeland-output-manager-v2/treeland-output-manager-v2.c
tests/protocols/treeland-output-manager-v2/treeland-output-manager-v2.h

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

@wineee
wineee marked this pull request as ready for review September 9, 2026 05:46

@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 @wineee, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 3 hours and 12 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@wineee
wineee force-pushed the agent/git-commit/b451c6d13070 branch from e35c74a to 97bea59 Compare September 10, 2026 01:52
@zccrs
zccrs marked this pull request as draft September 10, 2026 02:15
@wineee
wineee force-pushed the agent/git-commit/b451c6d13070 branch from 97bea59 to ee7c1ee Compare September 10, 2026 05:29
Migrate the output-manager module from treeland-output-manager-v1 to
treeland-output-manager-unstable-v2 (treeland-protocols 0.6.0).

Key breaking changes handled:
- Rename interfaces: treeland_output_manager_v1 → _v2,
  treeland_output_color_control_v1 → treeland_output_picture_control_v2
- set_primary_output: parameter changed from string to wl_output object
- primary_output event: changed from string to wl_output (null = none)
- New primary_output_failed event + primary_output_error enum
- result event: uint flag (1/0) → commit_result enum (values reversed)
- Remove picture control error enum; out-of-range values reported via
  commit result instead of protocol errors
- destroy moved to first request position (opcode shift)

适配 treeland-protocols 0.6.0 的 breaking 变更,将 output-manager 模块
从 v1 迁移到 v2。重命名接口,set_primary_output 改用 wl_output 对象,
新增 primary_output_failed 事件,result 事件改用 commit_result 枚举,
移除 picture control error 枚举改由 commit result 反馈。

Log: 迁移 output-manager 协议 v1 到 v2
Influence: output-manager 模块适配 treeland-protocols 0.6.0,使用旧协议
  的客户端需要同步迁移到 v2 接口。
@wineee
wineee force-pushed the agent/git-commit/b451c6d13070 branch from ee7c1ee to cd03d22 Compare September 10, 2026 07:29
@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.10.0
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1392

The test_case struct has an expect_disconnect field, but 6 of 7 entries
in the cases[] array omitted it. With -Werror=missing-field-initializers
this caused CI compilation failure. Add explicit 0 to all entries that
don't expect a disconnect.
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