Color Management & HDR #251
Replies: 38 comments 44 replies
|
https://yedlin.net/DebunkingHDR/index.html further, we already have colord |
|
The video you linked gives a good overview of colour theory. There is the issue of still not having HDR as shown by video content in HDR and SDR. The following videos provide somewhat of an explanation in difference and due to the same video you can see the difference on Wayland between HDR and SDR (if you have a display that supports HDR): For this project to a future there needs to be a full implementation of HDR (eventually). Some characteristics of HDR is addressed by colord, but depending on how HDR is implemented color management may need to be revamped. Within television HDR is currently set out in ITU-R BT.2100-3. Further, HDR is better set out in some of the standards i.e. HDR10 & HDR10+. Here are some more related links to HDR implementations and questions about HDR: There has been issues in how HDR has been marketed, but it's a technology that needs to be implemented. As without being able to with confidence say that this X11 implementation supports HDR. It will result in people going to the alternative which is Wayland. |
The point of the video is you shouldn't be able to see any difference. waylands hdr implementation is broken. |
Wayland's implementation of HDR isn't broken. Rather, it's a choice by the content creator. Quite frankly, we don't have a say in whether we want to support it there is content made in HDR that we should support. Furthermore, the video you linked was mainly referring to filmmaking, but the HDR display type is more widely used than just for filmmaking. |
|
In case anybody else wondering about the empty page, too: you have toclick into on the big rect to start the presentation video :) |
Its broken because the colour and brightness should not change, if the color was red in sdr and it shows green in hdr its just broken. All you should get with hdr is a slightly clearer image in the very dark areas that sdr just maps to black. |
The key point is that while a color's tone can change, it remains fundamentally the same color. Ultimately, content creators working in HDR determine how their material should be viewed. Additionally, SDR content maintains its consistency since HDR processing typically isn't applied to SDR material when properly implemented.
That was the intent, but like with any technology it can be used in other ways. Thus, if it doesn't have negative effects - it should be implemented. |
|
"HDR" as a focus point is IMO wrong, HDR support will come with proper colormanagement pipelines, all "HDR" really is, is a marketing term for colorspaces which utilize transfers that can represent 1000nits+ the basic "minimum checklist" for HDR is
Things like HDR10/HDR10+/Dolby vision can IMO come afterwards. The common transfers in question are PQ and HLG. scRGB is common in games, Displays typically don't support this it gets mapped to PQ or HLG. HLG is probably the easiest to start with, but has the worst display support, so PQ is probably the better one to start with. |
|
One thing I would suggest is that an X11 extension to add vulkan layers to windows would:
|
Any suggestion how it would look like ? Actually, I wonder what's still left to do here at all: |
vulkan has the option to add vulkan layers to the pipeline, these can do things like debugging, compute, change colorspace turn output into a video stream whole load of stuff I've only barely looked at. I do know this is how gamescope is adding its hdr layer to wine X11 games Its also how reshade works on windows. I imagine an X11 extension would let an application check for permission then do all this on the x server it is connected to. |
|
It's not hard to do vulkan layers, but first xlibre needs to support it getting colorspace data from the application, triggering HDR on the monitor, and doing the basic transforms. Context because the terms HDR and SDR are dumb. a color space is Gamut/primaries + transfer/gamma + whitepoint. As far as I, and the compositor cares, the most "unique" part here is the transfer and gamut. the "HDRness" of colorspaces as far as I am concerned, and most users are concerned, comes from the transfer, but this isn't really relevant because content is done in colorspaces Most legacy un-colormanaged applications are either bt.1886(rec709) which is common on TVs, or sRGB which is more common on PC displays. These are "SDR" colorspaces. There are others, but for uncolormanaged or "SDR" applications, this is all we really care about. Colormanaged applications can be treated differently (and should be.) The common HDR colorspaces are rec.2100 with either HLG or PQ transfers. HDR metadata can be added onto it to modify them, but it's not a hard requirement to handle. when it comes to displaying, HLG is probably the "easiest" to do, but PQ is by far the most common. Games often use scRGB colorspace which is a linear transfer with the primaries of sRGB and doing some weird hijinks with values to expand it. You need to convert scRGB to rec2100 with either of the transfers because no monitors use it. (linear is a lot of data :D) the current method compositors seem to be going with now to implement SDR->HDR is to have a dedicated SDR plane on the GPU, then use operations to transform that into "HDR" Presumably using a lut, but I don't know what all operations are available to work with here (https://melissawen.github.io/blog/2025/05/19/drm-info-with-kms-color-api). The actual specifics of the mapping should be user configurable (or compositor configurable, not really sure here) There are a lot of more nuanced things to think about like 'to what luminance do you make "SDR" to "HDR" ' which really should be user configurable. I think modeling the color data based on the wayland protocols themselves is fine, they are sufficiently detailed and staying in line with them will only serve to help applications port to xlibre. |
|
generally agree, but a lot of that is also already done a very long time ago, but the documentation is poor or non existent or just missing. a good place to start is probably the colord source code - what is in there already, what can be hardware accelerated with e.g. vulkan layers, what needs improving/adding. Oh, and who is going to pay for the $20,000 displays you need to actually barely see if it actually works.. color is a very, very hard topic, these "hdr on" toggles wayland compositors are adding are 100% gimmic, 0% useful. You can tell that by the only calibration software for Linux is X11 only. |
|
Could be the DeepColor X11 extension proposed by NVIDIA be a potential starting point for implementing HDR support? |
Perhaps. But maybe we don't even need to go that far, if we can live with 10bpc and 2 bits alpha. Not sure what exactly they're wanted to transmit via window properties. If it's about frame/scene specific gamut, then properties might not be the ideal way to do that. Needs some deeper thoughs. |
This could be perhaps done together with colord, since that allows a user to choose the color profile?
I see... Thanks for the clarifications! 🙂 |
If you truly have 10bit image, your whites, your blacks or any other colors won't match unless you can understand / translate 256 x 256 x 256 color matrix into 1024 x 1024 x 1024 color matrix. The color white in 8bit is represented as 255 x 255 x 255 while same white in 10bit is represented as 1024 x 1024 x 1024. You might be able to get near the right color but you won't get same color. The HDR as it is functioning right now on windows is 8bit of color data + 2bit in separate metadata that typically describe how bright that color should be with 4 settings (0% 25% 50% 100%) - (i might be wrong, but playing with metadata - i.e. changing those 2 bit values produced exactly that - the color depth - generation of more colors is typically only an illusion by dithering.)
To correctly display, and use 10bit color or more we would have to sit on wider gamut and translate the lower and higher bit address matrix to assign the correct color value from the gamut the display handles. Thus it would be better to work in 32bit address space for color depth even though we won't be using it.
Yes.
Thats right i'm not what you call a professional either. Just enthusiast hoping for something good. - and reason to not buy mac or use windows kvm to just play hdr content. |
|
I think implementing the DeepColor extension is a good idea or at least being based on it. Realistically speaking, I think supporting FP16 is desirable anyways and since xlibre will need to put in some effort in supporting mixed clients anyways, it seems like a good idea to do that while keeping FP16 RGBA formats in mind. |
This comment has been hidden.
This comment has been hidden.
|
Thank you very much for your contributions! We currently restructured the "Ideas" discussions and accordingly this discussion will be moved to the Good Ideas For Later category. As far as the matter itself is concerned, we will defentively have a look at it. |
|
Since it was brought up on the telegram and not brought up here, the linux kernel now has a color pipeline API that can do transforms on images utilizing planes. Xlibre will be able to composite SDR applications on one or more planes, use the colormanagement API to make said planes "HDR" ofc, this relies on supporting overlay planes. https://github.com/torvalds/linux/blob/master/Documentation/gpu/rfc/color_pipeline.rst although hardware dependent, the general idea of grouping SDR applications together and applying an "HDR Conversion" to them is the same regardless, This is hardware accelerated, however this should be developed in a way that makes grouping without "hardware planes" possible. This would need to be spun out into it's own topic on how to handle overlay planes, but however that discussion goes, being able have a "logical plane" that can be represented either just internally on x11, or in hardware would be immensely useful. |
|
"A picture is worth a thousand words", that this topic is not forgotten: What I want to show after patching driver:
Obviously there needed much more for hdr... |
This comment has been hidden.
This comment has been hidden.
On tested videos looks like real hdr (there are chance not all pixmaps in pipeline have correct drm format or glamor swizzle. My monitor only have wider color gammut). There no extra processing - here proof of concept rudimentary hdr: |
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
|
What the hell is going on here: why some anonymous guy suddenly banning comments from the leader of the project and saying "he's no longer involved"? Who's "we" then? |
|
For curious what X11 HDR looks in experimental state: My android camera hates me 😆 Here:
|
|
I reached conclusion for question "Can X11 support HDR". Most changes revolves around glamor render for other part is here and there relative tame refactoring. It lives: Current code - only modesetting driver, minimal parts of glamor render support colorimeter (expect a lot of dark window or sudden dark effects when there are alpha effect used) and render code assumes all monitor hdr :) When compile xserver and enable in config: And add environment variables for VK_xlibre_layer (only BT2020 linear and BT2020 PQ implemented). For SDR part, there is __X11HDR_SDR_PARAMS property which tunes any SDR content. If you set on root window - the default values, for windows (you need found that logical output window) it overrides defaults, see https://github.com/orgs/X11Libre/discussions/251#discussioncomment-16089204 for example set 20 nits white point for 0x2000002 window, (parameters are( whitepoint, contrast, saturation, hue, brightness, gamma) |
|
Please keep the old low overhead 8-bit/channel pass-through intact. So with whatever new stuff happens, please keep the old stuff also supported!!!! Discussion of Challenges For Modern Color Calibrated Workflows In the vintage analog era things had been simple, we used hardware pucks to sample the output of the 8-bit signal, then used that feedback to calibrate the higher-than-8-bit precision VGA 1D LUTs so the better than 8-bit DAC could move all those 256 output steps to where they should be for the associated tonal specification (say for example a gamma 2.2 curve). In the digital era this old practice for color calibration got broken. For example AMD's HW LUTs are now 12-bit input to only 8-bit output. So using anything other than the identity matrix (ie no change pass-through) implies introducing more banding into the output, because you'd be mapping 2 or more rendered 8-bit steps into the same digital 8-bit output step. Now note many serious usage cases still need 8-bit/channel output, because they also want high-resolution and high frame rate without using DSC (lossy display stream compression on the output). So moving to say 10-bit/channel isn't necessarily an option (even if the HW supported a 10-bit output in the LUT). Another serious issue is that you'd see banding with a non-dithered signal at 8-bit, and even higher bit depths with the brightness and contrast capabilities of modern displays. Correct spatial/temporal dithering needs to be applied in a linear space (but simultaneously aware of the output signal space) so it is energy conserving across time. Applying dithering in a non-linear output space does subtle regrading of the output, it doesn't preserve the intended signal. This can be a really serious issue in the darks (on good displays that don't have a step function artifiact around black), when you shift the APL (average picture level) down to support visible higher contrast in a very dark viewing room. All the new overly complex HW in the scanout block for color calibration and linearizing for overlays/etc, gets this part about correct dithering completely wrong. They are all formulated on the idea one can output a 12-bit signal and do all this processing (1D shaper LUT, 3D color LUT, etc) and then quantize output without correct dithering. So a return to seeing banding on the output. The crux of all this is that the only CORRECT place to do color calibration on modern hardware is for the application to do it itself: read the measured calibration graphs in the application and send out the post-calibrated output to a RAW pass-through output. Because to implement energy preserving spatial temporal dithering, you'd have to do it in the shader during conversion into the non-linear output signal for the swap-chain. This is something the HW cannot do for you. This is also something you wouldn't want a compositor to do for you either, as that implies extra round trips through memory, etc (high overhead at high fps and high resolutions). Meaning you'd still want to run the old way, with rectangular windows with NO alpha blending, or alternatively run only full-screen. |



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Describe the feature
There has been no progress on implementing HDR within the X11 protocol, though it could potentially be approached in two ways. One option is to follow Wayland’s lead (in terms of code i.e. copy it and adjust any licensing requirements to make this feasible) and transition to in sort a X11.1 protocol. This path would be simpler and require less effort but could introduce challenges, such as increased dependency on the Wayland project and reduced independence. It’s a discussion that needs to be revisited, it was considered once before, about five years ago. The topic has become more relevant now, as Wayland has HDR support. However, it might be more beneficial to focus on this improvement after the codebase has been cleaned up. There could also be the introduction of a deep color expansion to the colormap sections of the project. To start off with there would need to the development of a check list of the steps to do - initially when Wayland started the process it looked like the following (sharing to give ideas):
It should be implemented because
(see above)
What are the alternatives?
No response
Addtional Information
for more context of past discussion within the x11 project -
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1037
Extra fields
All reactions