Skip to content

feat(waylib): add sgrenderer damage tracking and vendored wlroots renderer#1136

Draft
Groveer wants to merge 1 commit into
linuxdeepin:master-backup-20260717from
Groveer:agent/developer/0f3af415
Draft

feat(waylib): add sgrenderer damage tracking and vendored wlroots renderer#1136
Groveer wants to merge 1 commit into
linuxdeepin:master-backup-20260717from
Groveer:agent/developer/0f3af415

Conversation

@Groveer

@Groveer Groveer commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

为 waylib 实现全新的 QSGRenderer,支持 damage 跟踪并 vendor wlroots 渲染后端。

Implement a new QSGRenderer for waylib with damage tracking and vendored wlroots renderer backends.

Phase 1 — RHI path damage tracking

  • Add WSGDamageTracker: collects dirty nodes via nodeChanged() callback (Qt 6.8 removed QSGNode::m_dirtyState), accumulates bounding boxes with DirtyDamageMask including DirtyMatrix
  • Add WSGDirtyNodeObserver: passive QSGAbstractRenderer registered on root node to receive nodeChanged() without displacing the real renderer
  • Wire into WBufferRenderer::ensureRenderer/render/destroySource
  • Replace m_damageRing.add_whole() with scanned dirty-node damage, combined with rotate_buffer() damage
  • Add Y-flip for mirrorVertically() scenarios
  • Add unit tests (18 cases covering all dirty flags, edge cases, Y-flip)

Phase 2 — vendored wlroots 0.19 renderer

  • Vendor gles2/vulkan/pixman backends, egl, dmabuf, allocator, swapchain infrastructure under sgrenderer/vendor/wlroots/
  • Extension headers exposing buffer→FBO/Image conversion, texture handles, EGL context management for BAL consumption
  • CMake target waylib_sgrenderer_wlroots_vendor (static lib)
  • All Code Review fixes applied: underscore shader header names, wlr_egl_context for surface access, conditional WLR_HAS_GBM_ALLOCATOR, unified config.h includes, glslangValidator FATAL_ERROR

Both phases passed Code Review (18 unit tests).

Multica issue: WM-79

@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 @Groveer, 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

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: Groveer

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

@zzxyb zzxyb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

建议参考wlroots,然后以C++风格去写,这样可以避免引入wlroots很多功能结构和文件

@@ -0,0 +1,44 @@
// SPDX-FileCopyrightText: 2017-2023 wlroots contributors

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

allocator不需要copy,可以直接使用wlroots,或者自己扩展实现

#include <wlr/render/interface.h>
#include <wlr/render/pixman.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_drm.h>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

不应该实现wlr_renderer。只需要实现pixman\vulkan\gles后端

#include "render/pixel_format.h"
#include "types/wlr_buffer.h"

void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *renderer,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

同wlr_renderer一样只需要后端实现

@zzxyb

zzxyb commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

pixman要评估一下,是否可以不用自己实现?用wlroot上的wlr_pixman_renderer_create

@Groveer
Groveer force-pushed the agent/developer/0f3af415 branch 8 times, most recently from bd26afa to 2cffc9f Compare July 13, 2026 12:52
…derer

Phase 1 — RHI path damage tracking:
- Add WSGDamageTracker: collects dirty nodes via nodeChanged() callback
  (Qt 6.8 removed QSGNode::m_dirtyState), accumulates bounding boxes
  with DirtyDamageMask including DirtyMatrix
- Add WSGDirtyNodeObserver: passive QSGAbstractRenderer registered on
  root node to receive nodeChanged() without displacing the real renderer
- Wire into WBufferRenderer::ensureRenderer/render/destroySource
- Replace m_damageRing.add_whole() with scanned dirty-node damage,
  combined with rotate_buffer() damage
- Add Y-flip for mirrorVertically() scenarios
- Add unit tests (18 cases covering all dirty flags, edge cases, Y-flip)

Phase 2 — vendored wlroots 0.19 renderer:
- Vendor gles2/vulkan/pixman backends, egl, dmabuf, allocator, swapchain
  infrastructure under sgrenderer/vendor/wlroots/
- Extension headers exposing buffer->FBO/Image conversion, texture
  handles, EGL context management for BAL consumption
- CMake target waylib_sgrenderer_wlroots_vendor (static lib)
- All Code Review fixes applied: underscore shader header names,
  wlr_egl_context for surface access, conditional WLR_HAS_GBM_ALLOCATOR,
  unified config.h includes, glslangValidator FATAL_ERROR

Both phases passed Code Review.
@Groveer
Groveer force-pushed the agent/developer/0f3af415 branch from 1ec668d to a3175b8 Compare July 13, 2026 13:45
@deepin-bot

deepin-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.15
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1163

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