Skip to content

fix: add RHI backend check for InWindowBlur blur - #694

Open
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/010546f31e4e
Open

mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/010546f31e4e

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Root Cause Analysis

The InWindowBlur.qml blitterEnabled condition only checked isSoftwareRender and hasInWindowBlur, but did not detect the RHI backend type. On SW (Shenwei) architecture, non-OpenGLES2 RHI backends silently skip blur rendering in RhiNode::render() (dbackdropnode.cpp:746-747 — reset(); return;), yet blitterEnabled stays true and blur.valid remains true. This causes FloatingPanel.qml:53-55 to use a semi-transparent background (alpha=0.6) with no actual blur, letting underlying content show through.

Key evidence: InWindowBlur.qml:16 → dbackdropnode.cpp:746-747 → FloatingPanel.qml:53-55 — the code path is self-consistent and matches the screenshot showing semi-transparent background without blur.

Fix

Added isBlurBackendSupported() static function in dqmlglobalobject.cpp that checks QQuickWindow::sceneGraphBackend() — returns true if the backend is empty (default OpenGL) or "opengl", false otherwise. Added && D.DTK.isBlurBackendSupported to the blitterEnabled condition in InWindowBlur.qml. When the RHI backend is not OpenGL, blitterEnabled becomes false, triggering FloatingPanel to fall back to an opaque background color (alpha=1.0).

Change Safety Assessment

Code Safety

  • Risk Level: Low
  • isSoftwareRender() and hasInWindowBlur() existing logic unchanged; new function is additive only
  • OpenGL/default backends: new condition returns true, no behavior change; non-OpenGL backends: blitterEnabled correctly becomes false

Business Impact Scope

All dtkdeclarative FloatingPanel components are affected. On SW architecture, dialog/panel backgrounds (album import dialog, control center panels, file manager dialogs) will switch from semi-transparent to opaque. On x86/ARM (OpenGL), no visual change.

Verification Suggestion

Regression test on x86/ARM: verify FloatingPanel blur effect is unchanged. Fix verification on SW: verify panel backgrounds are opaque with no content bleed-through.


根因分析

InWindowBlur.qml 的 blitterEnabled 条件仅检查 isSoftwareRender 和 hasInWindowBlur,未检测 RHI 后端类型。在 SW(申威)架构上,非 OpenGLES2 的 RHI 后端在 RhiNode::render()(dbackdropnode.cpp:746-747)中静默跳过模糊渲染(reset(); return;),但 blitterEnabled 仍为 true,blur.valid 也保持 true,导致 FloatingPanel.qml:53-55 使用半透明背景(alpha=0.6)但无模糊效果,底层内容透出。

关键证据:InWindowBlur.qml:16 → dbackdropnode.cpp:746-747 → FloatingPanel.qml:53-55,代码路径自洽,与截图现象一致。

修复方案

在 dqmlglobalobject.cpp 中新增 isBlurBackendSupported() 静态函数,检测 QQuickWindow::sceneGraphBackend() ——后端为空(默认 OpenGL)或 "opengl" 时返回 true,否则返回 false。在 InWindowBlur.qml 的 blitterEnabled 条件中增加 && D.DTK.isBlurBackendSupported。当 RHI 后端非 OpenGL 时,blitterEnabled 变为 false,触发 FloatingPanel 回退到不透明背景色(alpha=1.0)。

改动安全评估

代码安全评估

  • 风险等级: 低风险
  • isSoftwareRender() 和 hasInWindowBlur() 已有逻辑不变,新增函数为纯增量
  • OpenGL/默认后端:新条件返回 true,无行为变化;非 OpenGL 后端:blitterEnabled 正确变为 false

业务影响范围

所有使用 dtkdeclarative FloatingPanel 的组件受影响。SW 架构上,弹窗/面板背景(相册导入弹窗、控制中心面板、文件管理器弹窗)将从半透明变为不透明。x86/ARM(OpenGL)架构无视觉变化。

验证建议

x86/ARM 回归验证:确认 FloatingPanel 模糊效果不变。SW 架构修复验证:确认面板背景不透明,无底层内容透出。

Summary by Sourcery

Bug Fixes:

  • Prevent InWindowBlur from reporting an active blur effect on unsupported non-OpenGL RHI backends, ensuring affected panels use opaque backgrounds instead of revealing underlying content.

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

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

@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

@sourcery-ai

sourcery-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR adds a cached DTK capability check for the Qt Quick scene graph backend and incorporates it into InWindowBlur's blitter enablement. OpenGL/default backends retain blur behavior, while unsupported RHI backends disable blitting and allow affected FloatingPanel components to fall back to opaque backgrounds rather than showing unblurred transparency.

Flow diagram for backend-aware window blur

flowchart TD
    A[InWindowBlur evaluates blitterEnabled] --> B[isBlurBackendSupported]
    B --> C[QQuickWindow.sceneGraphBackend]
    C -->|empty or opengl| D[blitterEnabled remains true]
    C -->|other RHI backend| E[blitterEnabled becomes false]
    D --> F[FloatingPanel uses blur and semi-transparent background]
    E --> G[FloatingPanel falls back to opaque background]
Loading

File-Level Changes

Change Details Files
Gate in-window blur on whether the active Qt Quick scene graph backend supports the blur implementation.
  • Add a cached backend capability check that accepts the default/empty backend and OpenGL, rejecting other RHI backends.
  • Expose the capability check as a constant DTK QML property.
  • Require the new capability alongside software-rendering and blur availability checks before enabling the backdrop blitter.
src/private/dqmlglobalobject.cpp
src/private/dqmlglobalobject_p.h
qt6/src/qml/overridable/InWindowBlur.qml
Ensure unsupported backends use the existing opaque panel fallback instead of displaying transparency without rendered blur.
  • Disable blitting on non-OpenGL RHI backends so FloatingPanel consumers select their opaque background behavior.
  • Preserve existing blur behavior for OpenGL and default backends.
qt6/src/qml/overridable/InWindowBlur.qml

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

id: blitter
anchors.fill: parent
blitterEnabled: !D.DTK.isSoftwareRender && D.DTK.hasInWindowBlur
blitterEnabled: !D.DTK.isSoftwareRender && D.DTK.hasInWindowBlur && D.DTK.isBlurBackendSupported

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.

要是没有opengl,就用software渲染,这个应该就够了,不用加isBlurBackendSupported吧,

1. Root cause: InWindowBlur.qml blitterEnabled only checked
   isSoftwareRender and hasInWindowBlur, not RHI backend type; on SW
   architecture non-OpenGLES2 backends silently skip blur rendering
2. Fix: add isBlurBackendSupported() to check sceneGraphBackend is
   empty or opengl, gate blitterEnabled with this new condition
3. Impact: non-OpenGL backends fall back to opaque background;
   OpenGL/default backends unaffected (new condition returns true)

Log: Fix semi-transparent blur background on non-OpenGL RHI backends

Influence:
1. Test FloatingPanel blur on x86/ARM (OpenGL) — no regression
2. Test FloatingPanel background on SW architecture — should be opaque
3. Verify control center, file manager, album dialogs render correctly

fix: 修复非OpenGL后端下窗口模糊背景半透明问题

1. 根因:InWindowBlur.qml 的 blitterEnabled 仅检查 isSoftwareRender
   和 hasInWindowBlur,未检测 RHI 后端类型;SW 架构上非 OpenGLES2
   后端静默跳过模糊渲染但 blitterEnabled 仍为 true
2. 方案:新增 isBlurBackendSupported() 检测 sceneGraphBackend 是否
   为空或 opengl,在 blitterEnabled 中增加此条件
3. 影响:非 OpenGL 后端回退到不透明背景;OpenGL/默认后端不受影响

Log: 修复非OpenGL后端下窗口模糊背景半透明问题

Influence:
1. 测试 x86/ARM 架构(OpenGL)FloatingPanel 模糊效果——无回归
2. 测试 SW 架构 FloatingPanel 背景——应为不透明
3. 验证控制中心、文件管理器、相册弹窗背景显示正确

PMS: BUG-362545
@mhduiy
mhduiy force-pushed the agent/pms-bug-bot/010546f31e4e branch from bb28622 to 108ec07 Compare September 22, 2026 14:12
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值。本次变更为 InWindowBlur 模糊效果添加 RHI 后端检查,修复了非 OpenGL 后端下模糊渲染失效的问题。代码逻辑正确,注释完整,无安全漏洞,性能良好。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 语法正确,逻辑清晰。isBlurBackendSupported() 使用 C++11 magic statics 实现线程安全的延迟初始化,逻辑合理。QML 侧在 blitterEnabled 属性中追加条件判断,语法正确且与现有逻辑一致。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 代码结构清晰,注释完整。isBlurBackendSupported() 函数配有详细的多行注释,说明了设计意图、与 isSoftwareRender() 的区别以及不支持后端的行为表现。遵循了现有代码风格和模式。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 性能良好,资源使用合理。static bool 配合 lambda 初始化确保 sceneGraphBackend() 仅调用一次,后续访问直接返回缓存值,无性能开销。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在0个安全漏洞,无安全风险。本次变更不涉及用户输入处理、网络通信或敏感数据操作,安全合规。


💡 改进建议代码示例

// 本次变更代码质量优秀,无需修复示例。
// isBlurBackendSupported() 实现简洁高效:
//
// bool DQMLGlobalObject::isBlurBackendSupported()
// {
//     static bool supported = []() {
//         const QString backend = QQuickWindow::sceneGraphBackend();
//         return backend.isEmpty() || backend == QLatin1String("opengl");
//     }();
//     return supported;
// }

本报告由 AI 代码审查工具自动生成

This branch has not been deployed

No deployments
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