Skip to content

perf: 在 Linux Wayland + Mesa 环境自动启用 WebKitGTK DMA-BUF 渲染器 - #796

Closed
Ravomi wants to merge 1 commit into
graphif:mygofrom
Ravomi:perf/795-linux-dmabuf-renderer
Closed

Ravomi wants to merge 1 commit into
graphif:mygofrom
Ravomi:perf/795-linux-dmabuf-renderer

Conversation

@Ravomi

@Ravomi Ravomi commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #795

在 Wayland + Intel/AMD 核显(尤其是 2x 缩放高分屏)下,因为 mygo v0.6.4 默认把 WEBKIT_DISABLE_DMABUF_RENDERER 设成了 1,WebKitGTK 渲染每帧都要走 CPU 拷贝,画布平移缩放只有 24fps 左右,UI 也很卡。

参考了上游 egoist/mygo#1124 里新增的 DMABUFRendererAuto 检测逻辑,在 runGUI() 启动前加了个判断:如果是 Linux + Wayland 会话、有 DRM 渲染节点,且不是 NVIDIA / 虚拟机 / 容器 / 软件渲染,你在环境变量里也没手动指定过 WEBKIT_DISABLE_DMABUF_RENDERER,就自动设成 0 启用 DMA-BUF 渲染;其他情况保持原来的行为不变,避免白屏。

顺便在 main_test.go 里补了对应的单测。


AI 工具:Google Antigravity
AI 模型:Claude Opus 5.5、Gemini 4 Argon

mygo v0.6.4 在 Linux 初始化时会默认设置 WEBKIT_DISABLE_DMABUF_RENDERER=1,
导致 Wayland + Mesa(Intel/AMD)环境下每帧回退到 CPU 拷贝、画布与 UI 严重掉帧。
在 runGUI 启动前检测安全的 Wayland + Mesa 环境并预设 WEBKIT_DISABLE_DMABUF_RENDERER=0,
同时对 NVIDIA、虚拟机、容器、软件渲染及用户显式配置的环境变量保持原有行为。

Fixes graphif#795

AI 工具:Google Antigravity
AI 模型:Claude Opus 5.5、Gemini 4 Argon
@Littlefean

Copy link
Copy Markdown
Collaborator

@zty012 来看下吧

@Ravomi Ravomi closed this Nov 12, 2026
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.

2 participants