Skip to content

Studio on Linux: WEBKIT_DISABLE_DMABUF_RENDERER=1 is full software rendering on WebKitGTK 2.44+, and we set it for AppImage on Wayland #9393

Closed as not planned

Description

@danielhanchen

Summary

studio/src-tauri/src/linux_webkit.rs picks a WebKitGTK rendering workaround before GTK is
initialized. For some shipped Linux configurations it sets WEBKIT_DISABLE_DMABUF_RENDERER=1.
On WebKitGTK 2.44 and later that variable is not a transport tweak. It turns off accelerated
compositing entirely and drops the process to CPU rasterization, because the X11 and Wayland
accelerated backing stores that used to catch that fallback were deleted in the 2.43.x cycle.

The lighter variable we already use elsewhere, WEBKIT_DMABUF_RENDERER_FORCE_SHM=1, keeps GPU
rasterization on and only degrades the cross-process buffer transport. The two are described in
the code as if they were the same class of workaround, and they are not.

This issue is source analysis, not a bug report from a running Wayland session. See
"What was and was not tested" at the bottom before acting on any of it.

What Studio ships today

Both Linux bundle targets are shipped: studio/src-tauri/tauri.conf.json:60 lists
["app", "appimage", "deb", "dmg", "nsis"], and .github/workflows/release-desktop.yml:1495-1500
uploads ...-Linux.AppImage and ...-Ubuntu.deb as release assets.

The selection logic is rendering_plan() at studio/src-tauri/src/linux_webkit.rs:47-96, called
from configure_renderer() at linux_webkit.rs:126-140, called from
studio/src-tauri/src/main.rs:1809.

Configuration Variable set Line
Either variable already present in the environment nothing, operator override wins linux_webkit.rs:55-57
AppImage, libGLESv2.so.2 fails to dlopen, any session WEBKIT_DISABLE_DMABUF_RENDERER=1 linux_webkit.rs:61-63
Non-Wayland session, or an explicitly non-Wayland GDK_BACKEND nothing linux_webkit.rs:78-83
AppImage on Wayland, any WebKitGTK version WEBKIT_DISABLE_DMABUF_RENDERER=1 linux_webkit.rs:85-87
.deb on Wayland, WebKitGTK >= 2.44 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 linux_webkit.rs:88-89
.deb on Wayland, WebKitGTK < 2.44 WEBKIT_DISABLE_DMABUF_RENDERER=1 linux_webkit.rs:90-93

One correction to how this is usually described: the GLES row is not X11 only. The
is_appimage && !gles_usable check at linux_webkit.rs:61 runs before any Wayland detection, so
an AppImage that cannot load GLES takes the heavy path in every session type.

Why WEBKIT_DISABLE_DMABUF_RENDERER=1 is not a light workaround on 2.44+

Traced against a WebKitGTK 2.48.5 checkout (Source/WebKit/gtk/NEWS reports 2.48.5):

  1. UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp:85-87. The variable causes a bare return
    from the std::call_once initializer, so the static OptionSet<RendererBufferTransportMode>
    is left empty. Note that the early return is above mode.add(SharedMemory) on line 95.
  2. UIProcess/gtk/AcceleratedBackingStoreDMABuf.cpp:114-116. checkRequirements() is
    !rendererBufferTransportMode().isEmpty(), so it is false.
  3. UIProcess/gtk/AcceleratedBackingStore.cpp:68-76. On 2.44+ there is no other branch left to
    try, so the whole check returns false. create() in the same file then returns nullptr.
  4. UIProcess/gtk/HardwareAccelerationManager.cpp:45. m_canUseHardwareAcceleration = false.
  5. UIProcess/gtk/WebPreferencesGtk.cpp:41-48. This is the payload:
if (!HardwareAccelerationManager::singleton().canUseHardwareAcceleration())
    compositingState = { false, false };
...
setAcceleratedCompositingEnabled(compositingState.acceleratedCompositingEnabled);
setForceCompositingMode(compositingState.forceCompositingMode);
setThreadedScrollingEnabled(compositingState.forceCompositingMode);

All three land on false. Painting then goes through
WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp, which paints the
dirty region on the CPU into a ShareableBitmap. There is no GL context in that path.

This was harmless on 2.42 and earlier because AcceleratedBackingStore::checkRequirements() on
the webkitglib/2.42 branch still fell through to AcceleratedBackingStoreWayland and
AcceleratedBackingStoreX11, both of which are accelerated. Those two were removed by
bug 265308 and
bug 265511, recorded in the 2.43.2 entry of
Source/WebKit/gtk/NEWS as "Remove the X11 and WPE renderers". The same commit that removed the
X11 renderer is the one that added WEBKIT_DMABUF_RENDERER_FORCE_SHM, which is exactly why the
two variables are not interchangeable after 2.43.

The null AcceleratedBackingStore holds for 2.44 through 2.52. On 2.53.x trunk create() returns
a non-null Ref instead, but the preference outcome above is unchanged.

What FORCE_SHM actually costs, stated accurately

FORCE_SHM is added to the mode set on line 95 and only then does the early return happen on
line 99 (AcceleratedBackingStoreDMABuf.cpp:95-99). The set is non-empty, so
canUseHardwareAcceleration() stays true and all three preferences above stay true. Compositing
and GPU rasterization are intact.

What degrades is the transport. WebProcess/WebPage/dmabuf/AcceleratedSurfaceDMABuf.cpp:328-332:

void AcceleratedSurfaceDMABuf::RenderTargetSHMImage::didRenderFrame()
{
    RenderTarget::didRenderFrame();
    glReadPixels(0, 0, m_bitmap->size().width(), m_bitmap->size().height(), GL_BGRA, GL_UNSIGNED_BYTE, m_bitmap->mutableSpan().data());
}

That is a synchronous, full-surface readback into a ShareableBitmap, once per composited frame,
with no PBO or fence, and it is not limited to the damage region even though the software path it
replaces is. ShareableBitmap is 32 bpp.

Surface Bytes per frame At a sustained 60 fps
1920x1080 at 1x 8.29 MB about 0.50 GB/s
1920x1080 at device scale 2 33.18 MB about 1.99 GB/s
3840x2160 at 1x 33.18 MB about 1.99 GB/s

Two honest qualifications on those numbers. It is per composited frame, not a guaranteed 60 Hz
drain, so an idle window costs nothing. And the surface is the web view, not the whole screen.

There is no fallback when the transport fails

SwapChain::createTarget() at AcceleratedSurfaceDMABuf.cpp:504 returns nullptr when target
allocation fails, and nothing downstream switches to a different transport mode or to software.
The allocation is re-attempted on the next frame because the free list stays empty, so "no retry"
would be the wrong way to put it. The accurate statement is that there is no fallback: the
same mode is retried forever.

The user-visible symptoms split into two cases, which are worth separating:

  • Framebuffer incomplete: AcceleratedSurfaceDMABuf.cpp:654-663 logs
    AcceleratedSurfaceDMABuf was unable to construct a complete framebuffer on every frame, via
    WTFLogAlways, which prints in release builds. On 2.53.x this became LOG_ERROR, which is
    compiled out of release builds, so on 2.54+ the same failure will be silent.
  • createTarget() returned null: AcceleratedSurfaceDMABuf.cpp:657-658 returns early before the
    log line, so this case produces a blank view with no log message at all.

Our own release notes already warn about the visible half of this, at
.github/workflows/release-desktop.yml:46:

Linux AppImage can show a blank window on some Tauri/WebKitGTK + Wayland/Mesa stacks; use .deb
when available.

To be precise, that line documents the blank window. The "unable to construct a complete
framebuffer" string is WebKit's own and does not appear anywhere in this repo.

Out of our control, but users should know

Debian and Ubuntu carry debian/patches/disable-nvidia-dmabuf.patch in their webkit2gtk
packaging. It is present and active in Debian sid 2.52.6-1, Debian bookworm 2.50.6-1~deb12u2, and
the Ubuntu 2.48.6 and 2.52.3 packages. It inserts an isNVIDIA() probe of
glGetString(GL_VENDOR) and returns early before mode.add(SharedMemory), which leaves the
transport mode set empty. That is bit for bit the same state as
WEBKIT_DISABLE_DMABUF_RENDERER=1, so it disables accelerated compositing outright rather than
just the DMA-BUF mode.

Practical consequence: a .deb user on Ubuntu with an NVIDIA card is on software rendering
regardless of which variable Studio sets. The patch does honour an escape hatch,
WEBKIT_FORCE_DMABUF_RENDERER=1, which our override check at linux_webkit.rs:55-57 does not
currently know about.

The upstream change was never merged: WebKit PR 18614
was closed unmerged in April 2024, and the tracking bug
262607, "[GTK] Disable DMABuf renderer for NVIDIA
proprietary drivers", is RESOLVED WONTFIX. The distros kept the patch anyway.

User-facing consequence

setThreadedScrollingEnabled(false) is not cosmetic.
WebProcess/WebPage/WebPage.cpp:1025-1028 feeds it into setScrollingCoordinatorEnabled(), and
WebCore/page/Page.cpp:707-718 only ever constructs a scrolling coordinator when that setting is
true. With no coordinator there is no ScrollingThread dispatch, so scroll handling runs on the
web process main thread. DrawingAreaCoordinatedGraphics.cpp:215-227 additionally force-disables
async frame and async overflow scrolling in that state.

So on a long chat thread, main-thread scrolling and whatever else the main thread is already doing
serialize instead of overlapping.

What this is NOT

This is not the cause of the widely reported "long threads get slow" problem. That is
O(rendered boxes) hit-testing in the DOM, and it is unaffected by any compositing or transport
setting. Please do not conflate the two. Fixing this issue will not make long threads fast, and
fixing long threads will not make this issue go away.

What was and was not tested

  • Source reading only, for everything above: this repo at main, a WebKitGTK 2.48.5 checkout, a
    WebKitGTK 2.53.4 trunk checkout, the webkitglib/2.42, 2.50 and 2.52 release branches, and
    the Debian and Ubuntu webkit2gtk packaging tarballs.
  • Nothing here was executed on a Wayland session. No Wayland session was available. No frame
    timings, no readback measurements, no blank-window reproduction.
  • The hit-testing cost mentioned under "What this is NOT" comes from a separate investigation and
    was not re-measured here, so no figure is quoted for it.

Untested hypothesis, recorded but not recommended

The AppImage-on-Wayland row takes the heavy path on the rationale given at linux_webkit.rs:86:

// FORCE_SHM still reaches the failing libepoxy path in AppImages.

That rationale is about the GLES load, and the code already probes exactly that separately at
linux_webkit.rs:98-109 and :127. If the GLES probe passes, it is at least plausible that
AppImage-on-Wayland could take FORCE_SHM like the .deb does and keep GPU rasterization, with the
disable path reserved for the case where the probe fails.

This is a hypothesis, not a proposal. It needs a real AppImage on a real Wayland session on at
least NVIDIA proprietary, Mesa/AMD and Intel before anyone changes that branch. Filing it here so
it is on record rather than opening a speculative PR.

Activity

  1. Hironori-Abe commented on Aug 31, 2026

    @Hironori-Abe

    First, a thank you. I maintain LoTT (Local Transcription for Therapy)
    (https://github.com/Hironori-Abe/local-transcription-for-therapy), an offline
    transcription app for counseling sessions, and it ships unsloth/gemma-4-E4B-it-qat-GGUF
    and unsloth/gemma-4-12B-it-qat-GGUF for its local proofreading. Your quants do real
    work for us every day. I ran into this exact renderer problem while chasing a scroll
    stutter in my own app, and since I had both an AMD and an NVIDIA box to test on, I
    figured the least I could do is write the results up here. I hope it is useful.

    Summary: WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 was sufficient on both machines, and
    WEBKIT_DISABLE_DMABUF_RENDERER=1 was never necessary — including on the NVIDIA box
    where DMA-BUF genuinely does fail.

    A. AMD / Mesa / Wayland — Unsloth Studio itself

    Unsloth Desktop AppImage 2.11.5, KDE Plasma Wayland, AMD only (Radeon 890M +
    Radeon Graphics, no NVIDIA present), host webkit2gtk-4.1 2.52.6.

    Default launch logs:

    [INFO] Unsloth desktop app starting
    [INFO] Wayland session; set WEBKIT_DISABLE_DMABUF_RENDERER=1 for WebKitGTK compatibility
    

    The stated reason is just "Wayland session" — no GPU vendor is involved. Objective
    check with WEBKIT_SHOW_DAMAGE=1:

    launch log line 2 damage rectangles
    default set WEBKIT_DISABLE_DMABUF_RENDERER=1 none
    WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 absent (operator override respected) visible

    No damage rectangles at all means the TextureMapper compositor is not running, i.e.
    accelerated compositing is off entirely. It comes back with FORCE_SHM. The AppImage
    bundles its own libwebkit2gtk-4.1.so.0, and that library does contain the
    WEBKIT_DMABUF_RENDERER_FORCE_SHM string, so the lighter path is available in the
    shipped build.

    Notes:

    • Setting a WEBKIT_* variable externally is respected — the decision line disappears.
    • WEBKIT_FORCE_DMABUF_RENDERER=1 did not change the decision on this path.
    • WEBKIT_DISABLE_DMABUF_RENDERER=0 also suppresses the decision line, but WebKit
      checks these variables by presence, so =0 most likely still disables the renderer.
      It is not a usable opt-out.

    B. NVIDIA / Wayland — LoTT

    RTX 2070 SUPER, nvidia-open 610.57.04, nvidia_drm.modeset=Y, KDE Plasma Wayland,
    host webkit2gtk-4.1 2.52.6, CachyOS/Arch. Tauri 2.

    Here the DMA-BUF path genuinely fails:

    AcceleratedSurface was unable to construct a complete framebuffer
    Error 71 dispatching to Wayland display
    

    nvidia-drm_gbm.so is present and resolves to the matching
    libnvidia-allocator.so.610.57.04; kernel module and userspace versions all match
    (610.57.04 across /proc/driver/nvidia/version, modinfo, nvidia-utils, nvidia-smi).
    Forcing every FourCC via WEBKIT_DMABUF_RENDERER_BUFFER_FORMAT (XR24 / AR24 /
    XB24 / AB24) does not help.

    Measured results on that machine:

    setting starts damage rects scrolling
    none (plain DMA-BUF) no — —
    WEBKIT_DISABLE_DMABUF_RENDERER=1 yes none visibly stutters
    WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 yes visible smooth
    __NV_DISABLE_EXPLICIT_SYNC=1 + hardware DMA-BUF yes visible smooth, no artifacts

    Two things worth highlighting:

    1. Even where DMA-BUF really is broken, DISABLE_DMABUF is not required.
      FORCE_SHM starts fine and keeps accelerated compositing alive.
    2. FORCE_SHM and full hardware DMA-BUF were indistinguishable to me in
      perceived smoothness, with no visual artifacts in either. The GPU→CPU readback
      cost did not show up in normal desktop UI use, which makes FORCE_SHM a cheap
      and safe default that needs no vendor-specific variable.

    The stutter under DISABLE_DMABUF was the original symptom I was chasing: scrolling
    a long transcript list would freeze, then jump. It went away entirely with FORCE_SHM.
    Worth noting that while stuck on that path, WEBKIT_SKIA_CPU_PAINTING_THREADS,
    WEBKIT_FORCE_VBLANK_TIMER and WEBKIT_SHOW_DAMAGE were all inert — they belong to
    the compositor that DISABLE_DMABUF had switched off. That made the problem quite
    hard to diagnose, since every knob looked like it did nothing.

    Suggestion

    Wherever WEBKIT_DISABLE_DMABUF_RENDERER=1 is currently applied on WebKitGTK 2.44+,
    WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 appears to be sufficient and much cheaper —
    including the NVIDIA + Wayland branch, not only the plain Wayland one. DISABLE_DMABUF
    seems worth keeping only as a last resort, for cases where FORCE_SHM itself fails
    to start.

    For what it is worth, I have already switched LoTT's CachyOS/Arch launcher from
    DISABLE_DMABUF to FORCE_SHM on the strength of this, and that is what fixed the
    stutter for us.

    Caveats

    Each environment is a single machine (n=1), one driver version, one WebKit version.
    The scrolling comparisons are subjective; the damage-rectangle observations are not.
    I have not tested X11, Hyprland, or mixed-GPU setups.

  2. danielhanchen commented on Oct 11, 2026

    @danielhanchen
    MemberAuthor

    Thanks @Hironori-Abe for testing this on real hardware, the damage rectangle check is exactly the evidence this needed. I re-read the selection code in the WebKitGTK 2.50.4 that the AppImage bundles and it matches what you saw: WEBKIT_DISABLE_DMABUF_RENDERER=1 leaves WebKit with no buffer transport, so accelerated compositing and threaded scrolling are switched off, while WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 keeps both on.

    We are keeping the current default for now though. The AppImage takes the heavier switch on Wayland because of the Steam Deck, which is the main reason the AppImage bundles WebKit at all: there the lighter switch was tried and still hit a libepoxy GL error, and only the full disable actually painted the window. On NVIDIA with GNOME Wayland the shared memory path can also get the app disconnected by the compositor (WebKit bug 315436). Trading slower scrolling on some machines for a blank or crashing window on others is not a good deal, and there is no reliable way to tell those machines apart before the window opens.

    If your machine renders fine with it, you can opt into GPU compositing yourself. Studio never overrides a value you set:

    WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 ./Unsloth-Desktop-Linux.AppImage

    On NVIDIA also add WEBKIT_FORCE_DMABUF_RENDERER=1, since the Ubuntu built WebKit inside the AppImage (and Debian / Ubuntu system WebKit) turns shared memory off for NVIDIA otherwise. One small correction to the notes above: WebKit treats WEBKIT_DISABLE_DMABUF_RENDERER=0 as unset, so it is a real opt out, but it goes all the way to hardware DMA-BUF, so FORCE_SHM=1 is the safer choice. The .deb already uses shared memory on non NVIDIA Wayland.

    Closing as not planned since the default stays as is. If anyone can confirm FORCE_SHM=1 paints correctly on a Steam Deck with the current AppImage, please comment here and we will revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions