Skip to content

wayland: Fix GPU acceleration (zwp_linux_dmabuf_v1 feedback (v4))#833

Closed
mtwebster wants to merge 4 commits into
masterfrom
dma-feedback
Closed

wayland: Fix GPU acceleration (zwp_linux_dmabuf_v1 feedback (v4))#833
mtwebster wants to merge 4 commits into
masterfrom
dma-feedback

Conversation

@mtwebster

Copy link
Copy Markdown
Member

wayland/dma-buf: Implement zwp_linux_dmabuf_v1 feedback (v4)

Temporarily includes #811 and a couple of other small fixes.

dongioia and others added 4 commits June 22, 2026 19:13
On multi-GPU SoCs like RK3588 (Rockchip), the mainline kernel exposes
two DRM devices: card0 (rockchip-drm, display-only, no 3D) and card1
(panthor, Mali-G610 GPU with full 3D). Muffin's choose_primary_gpu_unchecked()
selects the first platform device with render capability, which picks
card0 — a display controller with no OpenGL/Vulkan support.

This causes EGL clients to fall back to llvmpipe (software rendering),
as the compositor advertises the wrong device via wl_drm.

GNOME's Mutter solved this by introducing a udev tag mechanism
(mutter-device-preferred-primary) that lets system integrators
explicitly mark which GPU should be used as primary. This commit ports
that mechanism to Muffin using the tag "muffin-device-preferred-primary".

Changes:
- meta-udev.c/h: Add meta_is_udev_device_preferred_primary() that
  checks for the "muffin-device-preferred-primary" udev tag
- meta-kms-types.h: Add META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY flag
- meta-backend-native.c: Propagate the flag during GPU initialization
- meta-gpu-kms.c/h: Add meta_gpu_kms_is_preferred_primary() accessor
- meta-renderer-native.c: Check preferred_primary before platform_device
  and boot_vga in choose_primary_gpu_unchecked()

Example udev rule for RK3588 boards:

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

Tested on Rock 5B+ (RK3588) running BredOS with kernel 7.0-rc1 and
6.19.1, Cinnamon Wayland session. Verified that Muffin correctly
selects panthor (renderD128) as primary GPU with this patch applied.

Note: This fixes the compositor-side GPU selection (Part A). Full
client-side GPU discovery requires upgrading zwp_linux_dmabuf_v1
from v3 to v4+ with device feedback (Part B, separate work).

Ref: Mutter meta-udev.c meta_is_udev_device_preferred_primary()
Decouple modifier advertisement from KMS scanout usage so clients get
importable modifiers; NVIDIA's EGL rejects imports made with
DRM_FORMAT_MOD_INVALID, crashing accelerated XWayland clients.
Backported somewhat from mutter.

Temporarily includes #811.
@mtwebster mtwebster marked this pull request as draft June 23, 2026 00:19
@clefebvre clefebvre changed the title Dma feedback wayland: Fix GPU acceleration (zwp_linux_dmabuf_v1 feedback (v4)) Jun 23, 2026
@clefebvre clefebvre marked this pull request as ready for review June 23, 2026 18:14
@clefebvre

Copy link
Copy Markdown
Member

Merged in master.

@clefebvre clefebvre closed this Jun 23, 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.

3 participants