From 2feb5f0f9d52033cdc67f0fde8a505d84d43adea Mon Sep 17 00:00:00 2001 From: Lam Wei Lun Date: Mon, 12 Oct 2026 13:07:02 +0800 Subject: [PATCH] Linux: drop the AppImage WebKit DMABUF exports; correct the skill notes The launcher cannot gate on the runtime WebKitGTK version, so exporting WEBKIT_DMABUF_RENDERER_FORCE_SHM/WEBKIT_FORCE_DMABUF_RENDERER there would clear a distro isNVIDIA() guard on hosts older than 2.44, where FORCE_SHM is ignored, re-exposing the broken hardware path. The binary already sets both with the correct gate, so remove them and say who owns the workaround. Also correct two claims in the skill reference. An empty transport set only means "no accelerated compositing" from 2.44 on; 2.42/2.43 still fall back to the Wayland/X11 renderers, removed in the same release that added FORCE_SHM. And threaded scrolling is off by default in 2.44/2.45 (on from 2.46), so FORCE_SHM keeps compositing rather than scrolling. Document the module-level detection cost and the WEBKIT_DMABUF_RENDERER_FORCE_SHM=0 opt-out. --- .../references/webview-gl-aui-media.md | 21 ++++++++++++------- .../platform/unix/build_linux_image.sh.in | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md b/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md index e9258c4522..5eeb003c67 100644 --- a/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md +++ b/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md @@ -573,8 +573,8 @@ sets the NVIDIA DMABUF workaround and then branches on `GDK_BACKEND`: honours the switch (>= 2.44, `WebView::SupportsForceSharedMemory()`), it sets `WEBKIT_DMABUF_RENDERER_FORCE_SHM=1` and `WEBKIT_FORCE_DMABUF_RENDERER=1` non-replacing. The proprietary driver cannot back WebKit's hardware DMABUF renderer, so the shared-memory transport keeps - compositing and threaded scrolling; `WEBKIT_FORCE_DMABUF_RENDERER` clears the Debian/Ubuntu/openSUSE - `isNVIDIA()` early return, which otherwise returns before the FORCE_SHM check. + accelerated compositing instead of dropping it; `WEBKIT_FORCE_DMABUF_RENDERER` clears the + Debian/Ubuntu/openSUSE `isNVIDIA()` early return, which otherwise returns before the FORCE_SHM check. - **Default path** (`GDK_BACKEND` unset or not starting with `x11`): if wx lacks EGL (`!wxHAS_EGL`) and `WAYLAND_DISPLAY` is set, it forces `GDK_BACKEND=x11`; it sets `WEBKIT_DISABLE_COMPOSITING_MODE=1` non-replacing **only** when the linked WebKitGTK predates 2.42 (`WebView::NeedsCompositingWorkaround()`) @@ -591,12 +591,17 @@ Runtime backend detection elsewhere uses Orca's `is_running_on_wayland()` / `is_ **Pitfall.** - **Rule:** On NVIDIA reach for `WEBKIT_DMABUF_RENDERER_FORCE_SHM` before `WEBKIT_DISABLE_COMPOSITING_MODE`. **Why:** the proprietary driver cannot back WebKit's hardware - DMABUF renderer, leaving web views blank or slow; FORCE_SHM keeps compositing and threaded scrolling - and only skips the hardware path, while disabling compositing also turns threaded scrolling off. - `WEBKIT_DISABLE_DMABUF_RENDERER` is not a substitute — it is read first, leaves the transport set - empty (no compositing) and has a reported crash path. On Debian/Ubuntu and openSUSE the `isNVIDIA()` - patch returns before the FORCE_SHM check, so `WEBKIT_FORCE_DMABUF_RENDERER=1` must clear it first. - WebKit reads all of these once per process, before the first WebView. + DMABUF renderer, leaving web views blank or slow; FORCE_SHM keeps accelerated compositing and only + skips the hardware path, while disabling compositing drops it. Threaded scrolling is a separate, + release-dependent default (off in 2.44/2.45, on from 2.46). `WEBKIT_DISABLE_DMABUF_RENDERER` is not a + substitute — it is read first, leaves the transport set empty (no compositing from 2.44 on, where the + X11/Wayland fallback renderers were removed) and has a reported crash path. On Debian/Ubuntu and + openSUSE the `isNVIDIA()` patch returns before the FORCE_SHM check, so `WEBKIT_FORCE_DMABUF_RENDERER=1` + must clear it first; that variable exists only in those patches. WebKit reads all of these once per + process, before the first WebView. + The test is `/proc/driver/nvidia/version`, so a hybrid laptop that renders on its iGPU also takes the + shared-memory path, which is a per-frame GPU readback rather than zero-copy; exporting + `WEBKIT_DMABUF_RENDERER_FORCE_SHM=0` in the environment restores the hardware path. ```cpp // Wrong: kills compositing and threaded scrolling (and can crash on modern WebKit) ::setenv("WEBKIT_DISABLE_DMABUF_RENDERER", "1", false); diff --git a/src/dev-utils/platform/unix/build_linux_image.sh.in b/src/dev-utils/platform/unix/build_linux_image.sh.in index 9348686f5e..a7f99ba775 100755 --- a/src/dev-utils/platform/unix/build_linux_image.sh.in +++ b/src/dev-utils/platform/unix/build_linux_image.sh.in @@ -429,8 +429,8 @@ if [ "\$XDG_SESSION_TYPE" = "wayland" ] && [ "\$ZINK_DISABLE_OVERRIDE" != "1" ]; export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json export MESA_LOADER_DRIVER_OVERRIDE=zink export GALLIUM_DRIVER=zink - export WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 - export WEBKIT_FORCE_DMABUF_RENDERER=1 + # WebKit's NVIDIA DMABUF workaround is applied by the binary itself, + # gated on the runtime WebKitGTK version (src/OrcaSlicer.cpp). fi fi fi