Skip to content

renderer/native: Register framebuffers with their real modifier - #904

Open
SyberHexen wants to merge 1 commit into
linuxmint:masterfrom
SyberHexen:6.8.6/framebuffer-modifiers
Open

SyberHexen wants to merge 1 commit into
linuxmint:masterfrom
SyberHexen:6.8.6/framebuffer-modifiers

Conversation

@SyberHexen

Copy link
Copy Markdown

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 through GETFB2 (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: GETFB2 on the NVIDIA monitor's framebuffer now returns the real modifier (0x300000000606014 instead of 0), and RustDesk captures it cleanly with no changes on its side. AMD monitors unchanged.

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>
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.

Wayland: scanout buffers on NVIDIA are registered without their modifier, so KMS capture gets scrambled pixels

1 participant