wayland: Fix GPU acceleration#831
Open
clefebvre wants to merge 6 commits into
Open
Conversation
Member
|
@clefebvre looks like you forgot to 'git add' the new files. |
6c3d30c to
0aee5bb
Compare
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.
0aee5bb to
78ff966
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.