Skip to content

Auto-detect and apply WebKitGTK DMA-BUF workaround on Linux #1042

Description

@kchudy

Description

Context

On some Linux GPU/compositor combinations (mainly NVIDIA + Wayland), WebKitGTK's default DMA-BUF renderer fails, crashing Defguard Client on launch with:

Gdk-Message: Error 71 (Protocol error) dispatching to Wayland display.

Users currently must manually set WEBKIT_DISABLE_DMABUF_RENDERER=1. Documented by Tauri: https://v2.tauri.app/develop/debug/linux-graphics/

Goal

Detect affected configurations automatically and apply the least invasive fix - without disabling acceleration for unaffected users.

Approach

Do not set the workaround unconditionally for everyone (per Tauri's own guidance - it removes the faster rendering path for users on working setups).

At startup, before webview init:

  1. Detect Wayland session (XDG_SESSION_TYPE / WAYLAND_DISPLAY) and NVIDIA driver presence.
  2. Skip if the user already set WEBKIT_DISABLE_DMABUF_RENDERER or __NV_DISABLE_EXPLICIT_SYNC manually.
  3. If affected: try __NV_DISABLE_EXPLICIT_SYNC=1 first (keeps acceleration). Fall back to WEBKIT_DISABLE_DMABUF_RENDERER=1 only if that's insufficient.
  4. Log which decision was made and why.

Alternative/complementary: apply the fix in the package post-install script by patching the .desktop file's Exec line, rather than system-wide.

Acceptance criteria

  • App detects Wayland + NVIDIA at startup, before webview init.
  • Manually-set env vars are never overridden.
  • Tries __NV_DISABLE_EXPLICIT_SYNC=1 before WEBKIT_DISABLE_DMABUF_RENDERER=1.
  • No behavior change on unaffected configs (AMD/Intel, X11).
  • Decision is logged.
  • Troubleshooting docs updated to reflect auto-detection, with manual steps kept as fallback.
  • Tested on ≥2 affected setups (e.g. Fedora 44 + KDE + NVIDIA/Wayland) and 1 unaffected setup.

Risks

  • NVIDIA driver presence ≠ guaranteed failure (545+ often works fine) - consider checking driver version to avoid unnecessary workarounds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Task.

    Projects

    Status
    Development ready

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions