Skip to content

fix(wayland): export all DMA-BUF planes for wlroots capture#5427

Open
ninele7 wants to merge 1 commit into
LizardByte:masterfrom
ninele7:fix/wlgrab-multiplane-dmabuf
Open

fix(wayland): export all DMA-BUF planes for wlroots capture#5427
ninele7 wants to merge 1 commit into
LizardByte:masterfrom
ninele7:fix/wlgrab-multiplane-dmabuf

Conversation

@ninele7

@ninele7 ninele7 commented Jul 18, 2026

Copy link
Copy Markdown

In comments to #5132 I pointed out a regression on my setup. On my Proxmox LXC with Headless Sway and 8060s GPU WLR capture just stopped working completely https://gist.github.com/ninele7/15a83db0104c94ddcbb26dbca7fa6340..

I honestly have no understanding of the situation, but given that initial regression was introduced by fully AI driven PR, I decided to try to fix it the same way.

Claude identified the issue based on the logs. And created small test script to check used formats: https://gist.github.com/ninele7/0ea3d852ff6d0d0da6bfe6f70a4cdff5.

Script output:

/tmp/modprobe_test 
compositor-advertised modifiers for XRGB8888: 8
chosen modifier : 0x02000000186abb04
plane count     : 2
  plane 0: stride=10240 offset=0
  plane 1: stride=2560 offset=15728640

Sunshine submits only plane 0 with this modifier -> MISMATCH (compositor import will fail)
pre-5132 gbm_bo_create: modifier=0x00ffffffffffffff planes=1

After that it produced a fix, which I've tested with and without WLR_RENDERER=vulkan. It works on my hardware in both cases.

Working logs: https://gist.github.com/ninele7/e07621f3c6042ff5647fb529095cbc23

Probably would need testing from someone else. Also claude says, that it might fix problem that #5288 tries to fix.

Description

Screenshot

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed (I'm not really competent in this kind of C++)
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

See our AI usage policy.

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

I don't understand the code, so it contradicts AI usage guidelines. But PR which introduced the regression also doesn't follow that specific guideline.

Since LizardByte#5132 the capture buffer is allocated with gbm_bo_create_with_modifiers(),
letting the driver pick an explicit modifier from the set advertised by the
compositor. That modifier may describe a multi-planar layout - on radeonsi the
best match for XRGB8888 is an AMD DCC modifier, where a second plane holds the
compression metadata.

The buffer was still exported as a single plane, so the compositor received a
DCC modifier with its metadata plane missing and rejected the import with
EGL_BAD_MATCH, failing every capture. Drivers whose preferred modifier happens
to be single-plane were unaffected, which is why this only reproduced on some
GPUs.

Export every plane reported by gbm_bo_get_plane_count() instead. The consuming
side already handles up to four planes, so no changes are needed there.

Also fix two issues in the same path:
- gbm_bo_create_with_modifiers() takes no usage flags, silently dropping the
  GBM_BO_USE_RENDERING hint the implicit-modifier path passes. Use the
  gbm_bo_create_with_modifiers2() variant and pass it explicitly.
- Filter DRM_FORMAT_MOD_INVALID out of the modifier list. It requests an
  implicit-modifier allocation and is not a valid entry in an explicit list.
@ninele7 ninele7 changed the title fix(wayland): export all DMA-BUF planes for wlroots capture [Draft] fix(wayland): export all DMA-BUF planes for wlroots capture Jul 18, 2026
@ninele7 ninele7 changed the title [Draft] fix(wayland): export all DMA-BUF planes for wlroots capture fix(wayland): export all DMA-BUF planes for wlroots capture Jul 18, 2026
@ninele7
ninele7 marked this pull request as draft July 18, 2026 10:10
@ninele7
ninele7 marked this pull request as ready for review July 18, 2026 10:12
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant