Bug 508817 - HLG support for HDR playback
Summary: HLG support for HDR playback
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: colour-management (other bugs)
Version First Reported In: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-27 18:28 UTC by Shengyu Qu
Modified: 2026-08-25 17:29 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 6.8.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shengyu Qu 2025-08-27 18:28:56 UTC
Currently kwin only supports PQ/linear scRGB for HDR output, however some HDR videos are using HLG than PQ. And some playback software doesn't support internal EOTF converting and would just output HLG stream(for example, Firefox and MPV dmabuf-wayland). So we need to support that.
Comment 1 TraceyC 2025-08-27 21:06:53 UTC
Thanks for the suggestion, I'll pass it along for consideration.
Comment 2 Zamundaaa 2025-08-27 22:45:22 UTC
I've avoided adding support for HLG in KWin because its behavior depends on the targeted display, which is annoying to deal with.

Perhaps we should just treat it like Google does though... They just assume it's meant to target an HDR1000 display, convert it to luminance accordingly and then tonemap to the real display.
Comment 3 Zamundaaa 2025-08-28 14:21:31 UTC
I looked into this, and even with the assumption of 1000 nits target display (or whatever the client sets as max luminance), it's still very annoying - HLG's OOTF isn't independent per channel, but requires taking Y_rgb into account, which in turn also requires the primaries of the display.

That doesn't just mean KWin would require a bunch of changes to handle that (including breaking changes in effects API), but it's also not possible to apply HLG in a 1D LUT...

Maybe we can at some point add that OOTF as a step in the color pipeline instead of it being part of the transfer function directly, which would help with managing the complexity, but that'll have to wait until we can apply pipelines in a shader.
Comment 4 John 2026-08-07 09:17:50 UTC
I just tried the latest nightly build of Firefox (155.0a1) and force enabled the HDR support through about:config page.
It crashes, a lot. I couldn't watch anything, which is weird as a month or two ago, it was working.
Tested on Debian 14 with Plasma 6.7.2 (Wayland) on a UHD 620 iGPU, without a HDR capable screen.

I've sent a few messages in that window that appears after crashing and I found a bug report that looks to me to be related to that:
https://bugzilla.mozilla.org/show_bug.cgi?id=2057813
It looks to me that they are still working on it.
I see that they also have this pretty old one asking to support PQ and HLG transfer functions for WebRender, which hasn't moved even a bit:
https://bugzilla.mozilla.org/show_bug.cgi?id=1765362
And similar for WebGPU:
https://bugzilla.mozilla.org/show_bug.cgi?id=2024870
And here the last bug report about HLG on their bug tracker, comparing how HDR videos look in Firefox and Chrome with comment number 10 being interesting:
https://bugzilla.mozilla.org/show_bug.cgi?id=2028502

For me, as a high quality movie  watcher (4K + HDR in 10-bit AV1 or HEVC) and sometimes game player, the most important thing is the quality and accuracy with how the creators intended, so please do what you can, when you can, as long as the best quality is retained or at least it's configurable, like it is now with the "Color accuracy" in "Display configuration".

BTW, it would be nice if we had a table in some documentation page with the last Kwin capabilities, like what bit depths and what HDR standards it can support. Besides curiosity, it could help to write better bug reports for Firefox, Haruna, MPV, VLC, Kodi, etc. and avoid asking AI tools about what it supports, like I unfortunately just did after seeing the first Firefox bug report.
Comment 5 Bug Janitor Service 2026-08-24 14:06:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/9800
Comment 6 Zamundaaa 2026-08-25 14:36:40 UTC
Git commit 2ccdca3eb752e71c569ca05978e0d7823219ee7b by Xaver Hugl.
Committed on 25/08/2026 at 14:00.
Pushed by zamundaaa into branch 'master'.

core/colorspace: implement support for the HLG transfer function

It's used in some videos, and Firefox needs it to be supported by the
compositor in order to enable HDR by default.

M  +45   -19   autotests/test_colorspaces.cpp
M  +5    -0    src/backends/wayland/color_manager.cpp
M  +74   -3    src/core/colorspace.cpp
M  +5    -0    src/core/colorspace.h
M  +71   -4    src/opengl/colormanagement.glsl
M  +4    -0    src/opengl/glshader.cpp
M  +8    -2    src/opengl/icc_shader.cpp
M  +6    -0    src/wayland/colormanagement_v1.cpp

https://invent.kde.org/plasma/kwin/-/commit/2ccdca3eb752e71c569ca05978e0d7823219ee7b