Repository navigation
renderer/native: Register framebuffers with their real modifier - #904
Open
SyberHexen wants to merge 1 commit into
Open
SyberHexen wants to merge 1 commit into
SyberHexen wants to merge 1 commit into
Conversation
Without kms-modifiers, the onscreen surface on the primary GPU and the surface a secondary GPU copies a frame into are allocated implicitly, so their layout is the driver's choice: block-linear on NVIDIA. Registering them with plain drmModeAddFB2 leaves the kernel reporting modifier 0, which reads back as LINEAR, so anything capturing the output through GETFB2 gets scrambled pixels. Pass the modifier gbm reports when the device supports AddFB2 modifiers, on both paths. Allocation is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes linuxmint/wayland#248.
Bug: without kms-modifiers, the onscreen surface on the primary GPU and the surface a secondary GPU copies a frame into are allocated implicitly, so their layout is the driver's choice (block-linear on NVIDIA). They are registered with plain
drmModeAddFB2, so the kernel reports modifier 0, which reads back as LINEAR. Anything that captures the output throughGETFB2(KMS capture: RustDesk, gpu-screen-recorder, ffmpeg kmsgrab) then gets scrambled pixels on NVIDIA monitors.Reproduce: Cinnamon Wayland session with a monitor on an NVIDIA GPU; capture it with any KMS-based tool, or read the scanout framebuffer with
DRM_IOCTL_MODE_GETFB2: modifier 0 / LINEAR, image scrambled.Fix: when the device supports AddFB2 modifiers, pass the modifier gbm reports (
drmModeAddFB2WithModifiers), on both the primary-GPU and the secondary-GPU path. Allocation is unchanged.Tested:
GETFB2on the NVIDIA monitor's framebuffer now returns the real modifier (0x300000000606014instead of 0), and RustDesk captures it cleanly with no changes on its side. AMD monitors unchanged.