Skip to content

Wayland: wrong GPU selected on multi-GPU SoCs (RK3588) — EGL clients fall back to llvmpipe #194

@dongioia

Description

@dongioia

Bug Description

On ARM SoCs with multiple DRM devices (e.g., Rockchip RK3588), Muffin's Wayland session selects the wrong GPU as primary, causing all EGL-based Wayland clients to fall back to llvmpipe (software rendering).

This affects all RK3588 boards (Rock 5B+, Orange Pi 5 Plus, etc.) running Cinnamon Wayland with mainline kernels. Other desktops (GNOME, KDE, Budgie) work correctly on the same hardware.

Root Cause Analysis

The RK3588 dual-DRM architecture

The mainline kernel exposes two DRM devices:

Device Driver Capabilities
/dev/dri/card0 rockchip-drm Display output (CRTC/encoder/connector), no 3D
/dev/dri/card1 panthor Mali-G610 GPU, OpenGL 3.1/3.3, Vulkan 1.4, no display
/dev/dri/renderD128 panthor Render node for card1

Problem 1: GPU selection (Part A — patch available)

choose_primary_gpu_unchecked() in meta-renderer-native.c has this priority:

  1. Platform device with HW rendering
  2. Boot VGA device
  3. Any device

On RK3588, both card0 and card1 are platform devices. card0 is enumerated first and has render capability (Mesa loads for it), so Muffin picks card0 as primary — even though card0's render path is software-only (no 3D hardware).

GNOME's Mutter solved this by adding a higher-priority check: meta_is_udev_device_preferred_primary(), which checks for a mutter-device-preferred-primary udev tag. System integrators (distros) add a udev rule:

SUBSYSTEM=="drm", KERNEL=="card1", DRIVERS=="panthor", TAG+="mutter-device-preferred-primary"

Muffin is missing this mechanism. A patch porting it is available in PR linuxmint/muffin#811.

Problem 2: Client device discovery (Part B — larger work)

Even with Part A fixing the compositor's GPU selection, Wayland EGL clients still get llvmpipe. This is because Muffin implements zwp_linux_dmabuf_v1 version 3, which has no device feedback mechanism.

Mutter implements version 4/5 of this protocol, which includes zwp_linux_dmabuf_feedback_v1 with a main_device event that tells clients which render node to use. Without this, clients fall back to wl_drm for device discovery, which advertises card0 (the wrong device).

Protocol trace showing the issue:

{mesa egl display queue} wl_registry#2.global(20, "zwp_linux_dmabuf_v1", 3)  ← version 3, no feedback
libEGL warning: MESA-LOADER: failed to retrieve device information           ← Mesa can't discover GPU

Upgrading from v3 to v4+ is a significant change (~1200 lines in Mutter's meta-wayland-dma-buf.c vs ~750 in Muffin's).

Symptoms

  • eglinfo -B -p wayland shows llvmpipe as renderer
  • eglinfo -B -p gbm shows Mali-G610 MC4 (Panfrost) — compositor itself uses GPU correctly
  • vkmark and Vulkan apps work fine (Vulkan bypasses the EGL/wl_drm path)
  • glmark2-es2-wayland scores are extremely low (~50 vs ~500+ expected)
  • GNOME, KDE, Budgie all work correctly on the same hardware

Diagnostic Data

Collected on Rock 5B+ (RK3588), BredOS, kernel 7.0-rc1, Cinnamon 6.6.3 Wayland:

# Compositor uses correct GPU
$ sudo ls -la /proc/$(pgrep cinnamon)/fd | grep dri
card0        # display output
renderD128   # 3D rendering (panthor)

# Panthor clients confirmed
$ cat /sys/kernel/debug/dri/1/clients
             command  tgid dev master   uid
            cinnamon 17565 128   n      1000

# But Wayland EGL clients see llvmpipe
$ eglinfo -B -p wayland
OpenGL core profile renderer: llvmpipe (LLVM 21.1.8, 128 bits)

Proposed Fix

Part A (PR linuxmint/muffin#811, +39 lines, 7 files): Port Mutter's preferred_primary udev tag mechanism. Fixes compositor GPU selection. Minimal, backward-compatible — no effect on systems without the udev tag.

Part B (future): Upgrade zwp_linux_dmabuf_v1 from v3 to v4+ with device feedback. This is the complete fix that would let EGL clients discover the correct render node. Larger scope, likely best done as part of a broader Mutter sync.

Affected Hardware

Any SoC/system where the mainline kernel exposes multiple DRM devices with only one having 3D capability:

  • RK3588: Rock 5B/5B+, Orange Pi 5/5 Plus, Radxa NX5, FriendlyELEC boards
  • Potentially other ARM SoCs with separate display and GPU DRM drivers

Environment

  • Muffin 6.6.3 (also tested against current master)
  • Cinnamon 6.6.3, Wayland session
  • BredOS (Arch Linux ARM), kernels 6.19.1 and 7.0-rc1
  • Mesa 26.0.1, Panthor kernel driver, PanVK Vulkan

Metadata

Metadata

Assignees

No one assigned

    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