Skip to content

feat(linux/pipewire): Handle HDR(Rec. 2020/SMPTE 2084 PQ) visuals#5025

Open
garnacho wants to merge 1 commit intoLizardByte:masterfrom
garnacho:pipewire-hdr
Open

feat(linux/pipewire): Handle HDR(Rec. 2020/SMPTE 2084 PQ) visuals#5025
garnacho wants to merge 1 commit intoLizardByte:masterfrom
garnacho:pipewire-hdr

Conversation

@garnacho
Copy link
Copy Markdown
Contributor

  • Changed handling order of supported formats in DMA-buf cases, so the preferred format is predictable.
  • Dropped the last "guard" value from the format_map array, unused.
  • Added fallback value for SPA_VIDEO_TRANSFER_SMPTE2084, new in Pipewire >= 1.6.0 libraries. This format can be negotiated regardless.
  • Added support for 10-bit format, combined with BT.2020 color primaries and PQ transfer function. This format is preferred over SDR if supported by the compositor.
  • Tested over GNOME Shell 50, capable of HDR streaming. Should work over recent KDE Plasma as well.

Description

Support HDR streaming (10-bit + Rec. 2020 + SMPTE 2084 thus far, other combinations might be allowed later on) in the pipewire implementation.

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

  • 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

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Bundle Report

Bundle size has no change ✅

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 18, 2026

Codecov Report

❌ Patch coverage is 0% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.33%. Comparing base (5ffa66e) to head (95cdc3c).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/pipewire.cpp 0.00% 50 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5025      +/-   ##
==========================================
- Coverage   17.98%   17.33%   -0.66%     
==========================================
  Files         109      108       -1     
  Lines       23502    23248     -254     
  Branches    10373    10141     -232     
==========================================
- Hits         4228     4029     -199     
+ Misses      17757    15733    -2024     
- Partials     1517     3486    +1969     
Flag Coverage Δ
Archlinux 11.57% <0.00%> (-0.03%) ⬇️
FreeBSD-14.3-aarch64 ?
FreeBSD-14.3-amd64 13.55% <0.00%> (-0.02%) ⬇️
Homebrew-ubuntu-22.04 13.94% <0.00%> (-0.03%) ⬇️
Linux-AppImage 12.20% <0.00%> (-0.07%) ⬇️
Windows-AMD64 ?
Windows-ARM64 13.23% <ø> (+0.01%) ⬆️
macOS-arm64 19.02% <ø> (ø)
macOS-x86_64 18.38% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/platform/linux/pipewire.cpp 0.00% <0.00%> (ø)

... and 65 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ffa66e...95cdc3c. Read the comment docs.

- Changed handling order of supported formats in DMA-buf cases, so
  the preferred format is predictable.
- Dropped the last "guard" value from the format_map array, unused.
- Added fallback value for SPA_VIDEO_TRANSFER_SMPTE2084, new in
  Pipewire >= 1.6.0 libraries. This format can be negotiated regardless.
- Added support for 10-bit format, combined with BT.2020 color primaries
  and PQ transfer function. This format is preferred over SDR if
  supported by the compositor.
- Tested over GNOME Shell 50, capable of HDR streaming. Should work over
  recent KDE Plasma as well.
@sonarqubecloud
Copy link
Copy Markdown

@psyke83
Copy link
Copy Markdown
Contributor

psyke83 commented Apr 19, 2026

I don't have a real HDR-capable client to test fully, but GNOME did seem to stream HDR with the same washed-out colours as kmsgrab.

KDE doesn't work with HDR, but I don't think it's your fault. Full KDE log in case it helps: https://gist.github.com/psyke83/02c501dbfc4f3b157196cd0aa5a928ae

Edit: previously I misidentified some errors in my log that were not actually related to this PR, please disregard.

@garnacho
Copy link
Copy Markdown
Contributor Author

garnacho commented Apr 19, 2026

Ah indeed, I had the impression KDE also had HDR streaming support merged, these logs:

[2026-04-19 19:16:20.604]: Info: [pipewire] Video format: 12
[2026-04-19 19:16:20.604]: Info: [pipewire] Size: 1920x1080
[2026-04-19 19:16:20.604]: Info: [pipewire] Color primaries: 0
[2026-04-19 19:16:20.604]: Info: [pipewire] Transfer function: 0

Suggest that BGRA format was chosen (i.e. no 10-bit color), and KDE did not fill in (yet) color primaries and transfer function metadata.

@Kishi85
Copy link
Copy Markdown
Contributor

Kishi85 commented Apr 23, 2026

I don't have a real HDR-capable client to test fully, but GNOME did seem to stream HDR with the same washed-out colours as kmsgrab.

KDE doesn't work with HDR, but I don't think it's your fault. Full KDE log in case it helps: https://gist.github.com/psyke83/02c501dbfc4f3b157196cd0aa5a928ae

Edit: previously I misidentified some errors in my log that were not actually related to this PR, please disregard.

Don't have a HDR capable display here atm either but it would be great to have this in Sunshine as it might just provide the necessary test application that Xaver Hugl is looking for in https://invent.kde.org/plasma/kwin/-/merge_requests/8293#note_1471304 (Cite: ... So there isn't actually any test app that clearly verifies it works).

I've noticed the code comments on missing HDR metadata in the commit and if I'm guessing correctly that should be covered by https://gitlab.freedesktop.org/pipewire/pipewire/-/work_items/5064 once that's available.

@psyke83
Copy link
Copy Markdown
Contributor

psyke83 commented Apr 23, 2026

Just to clarify my earlier comment: I don't think we need to wait for KDE support; I was just pointing out that it's not ready on their side. The PR looks fine to me right now, seems to work on GNOME with the limited testing I can do, and if having this ready in Sunshine helps accelerate KDE merging 10 bit & HDR screencasting, all the better.

@garnacho
Copy link
Copy Markdown
Contributor Author

I've noticed the code comments on missing HDR metadata in the commit and if I'm guessing correctly that should be covered by https://gitlab.freedesktop.org/pipewire/pipewire/-/work_items/5064 once that's available.

That indeed would help drop most of the guesswork. A thing I am unclear though is about who and where in the pipeline things are converted to the capabilities of the target display on the other end.

inkatail added a commit to inkatail/Sunshine that referenced this pull request Apr 25, 2026
@ReenigneArcher ReenigneArcher added this to the pipewire milestone Apr 26, 2026
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.

4 participants