Skip to content

wayland: Fix GPU acceleration#831

Open
clefebvre wants to merge 6 commits into
masterfrom
wayland-acceleration
Open

wayland: Fix GPU acceleration#831
clefebvre wants to merge 6 commits into
masterfrom
wayland-acceleration

Conversation

@clefebvre

@clefebvre clefebvre commented Jun 20, 2026

Copy link
Copy Markdown
Member

This is a collection of multiple fixes to bring acceleration to Wayland and XWayland.

It's only a temporary solution for now using wl_drm implementation. We need a better implementation which supports zwp_linux_dmabuf_v1 v4/5.

Fixes XWayland acceleration, acceleration in games like Supertuxkart, playing videos in Slack... I think Vulkan already worked before that. Doesn't fix acceleration in direct GL apps such as glmark2-es2-wayland.

@leigh123linux

Copy link
Copy Markdown
Member

@clefebvre looks like you forgot to 'git add' the new files.

@clefebvre clefebvre force-pushed the wayland-acceleration branch from 6c3d30c to 0aee5bb Compare June 21, 2026 11:26
Enable atomic modesetting client capability alongside the existing
universal planes cap. Log a warning if the kernel doesn't support it
rather than failing hard.
Open the DRM render node separately and pass it to gbm_create_device()
instead of reusing the KMS primary fd. This matches how wlroots-based
compositors initialize rendering and avoids hardware-specific issues
(e.g. amdgpu refusing ACCEL_WORKING queries on the primary fd) that
cause Mesa to fall back to software rendering.

Fall back to the primary fd if no render node is available.
…arate fds

When the GBM device fd differs from the KMS fd (render node vs primary
node), GEM handles from GBM are not valid on the KMS fd. Export each
handle as a dmabuf via drmPrimeHandleToFD and re-import it on the KMS
fd before calling drmModeAddFB2. Close the imported handles after the
FB takes its own reference.
With GBM now on the render node, cursor BOs created via the render
node GBM device have GEM handles that are invalid on the KMS fd, causing
drmModeSetCursor to fail on every frame.

Create a second GBM device from the KMS fd specifically for cursor BO
allocation. This keeps cursor GEM handles in the KMS fd's namespace
where the cursor plane expects them.
Without zwp_linux_dmabuf_v1 v4 feedback, Mesa's EGL and Xwayland's
Glamor have no way to discover which DRM device the compositor is using.
They fall back to opening the primary node, which fails on some hardware
(e.g. amdgpu on Strix Halo), causing software rendering for all clients.

Implement the wl_drm protocol and advertise the render node path on
client bind. This gives Mesa and Xwayland the render node path directly,
restoring hardware acceleration for both native Wayland EGL clients and
Xwayland Glamor.
@clefebvre clefebvre force-pushed the wayland-acceleration branch from 0aee5bb to 78ff966 Compare June 21, 2026 11:32
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.

2 participants