Repository navigation
Add per-output reference_luminance to set the SDR white level for color-managed clients in HDR #14999
Replies: 8 comments 8 replies
|
Need this! |
|
Another reproduction, with measurements that may help pin the behaviour down. Setup: Hyprland 0.56.2, Intel Panther Lake ( cm = "hdr", bitdepth = 10, supports_wide_color = 1, supports_hdr = 1,
max_luminance = 616, max_avg_luminance = 400, min_luminance = 0.0005,
sdr_min_luminance = 0.0005, sdr_max_luminance = 900,The reference luminance does not track The max tracks No per-output override exists. Symptom, from a user's point of view: the effect is not only that colour-managed apps look dim — they are also completely unaffected by brightness control, because
So the browser that implements colour management correctly is the one that renders dim and ignores brightness, while the browser that doesn't implement it behaves "better" for everyday use. Raising
Correction (edited): that was wrong, and @nulluserid caught it below — I had the feature name wrong. The real one is So the opt-out does work. It is not a fix for this issue though — it costs in-browser HDR video entirely, which is the point of having an HDR output. It is useful for Electron apps that have no HDR content to lose (VS Code, Signal, Obsidian all take it via their flags files), but the either/or above still stands for browsers. A per-output |
|
This change works for me on my local machine. It does 2 things: 1/ Use EDID to set default luminance, when that's not set I'm not confident enough in hyprland's "hdr vision for the future" to submit this as a PR, but hopefully it's useful. |
|
Another data point, and — with apologies for the length — a perspective on why I think this deserves attention beyond "one more config option." The bug report: same story as v3rtx above, on effectively the same panel (Samsung OLED eDP, ~616 nits peak, Hyprland 0.56.2 + Omarchy): with The experience cost: I landed on the SDR + Why this is bigger than a config option: this is becoming the default out-of-box experience on new laptops. Nearly every OLED and mini-LED panel ships HDR-capable; Chromium and Electron ship CM negotiation enabled by default (Brave 151, Signal 8.x, VS Code); and users arriving from Windows, macOS or KDE expect the brightness control to simply work — KWin maps its slider across all SDR content including color-managed clients, so they never see this split. When the premium display on a new machine instead produces "half my screen ignores the brightness keys," Hyprland reads as broken rather than early. The proposed One friendly correction to an earlier measurement: on Chromium/Brave 151 there is a working client-side kill switch — Thanks to everyone who dug into the code and produced working patches (both the proposal above and erikwb's commit) — happy to test a build on this hardware whenever there's something to try. |
|
Confirming on Hyprland 0.56.2, RX 9070 XT, dual 4K HDR ( Hyprland advertises Patching Note the code has moved since 0.55.2 — the HDR image-description build is now in Would be great if this actually got some attention, as others have mentioned, HDR is becoming standard and so far this has been the biggest downside for me since switching to Hyprland. |
|
Hey @vaxerski - this issue has a bunch of upvotes, traffic, and some decent fixes proposed; I think that it may be a good candidate for promotion to Real Issue. |
|
Same issue here on 0.56.2 (RX 6600, 1080p240 DP,
I'm running a small local patch that makes the descriptions advertised to clients use the output's
After: Browser pages now match the rest of the desktop and HDR video still works. The render path isn't touched. As far as I can tell the PQ conversion is absolute-nit and the reference only feeds the tonemapper, so games/HDR content aren't rescaled. It reuses hdr-sdr-reference.patchdiff --git a/src/Compositor.cpp b/src/Compositor.cpp
index 1d2d8b9..25b8824 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -957,8 +957,15 @@ PImageDescription CCompositor::getPreferredImageDescription() {
}
Log::logger->log(Log::WARN, "FIXME: color management protocol is enabled, determine correct preferred image description");
// should determine some common settings to avoid unnecessary transformations while keeping maximum displayable precision
- return State::monitorState()->monitors().size() == 1 ? State::monitorState()->monitors()[0]->m_imageDescription :
- CImageDescription::from(SImageDescription{.primaries = NColorPrimaries::BT709});
+ if (State::monitorState()->monitors().size() != 1)
+ return CImageDescription::from(SImageDescription{.primaries = NColorPrimaries::BT709});
+ const auto MON = State::monitorState()->monitors()[0];
+ if (MON->m_imageDescription->value().transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_ST2084_PQ && MON->m_sdrMaxLuminance > 0) {
+ auto lum = MON->m_imageDescription->value().luminances;
+ lum.reference = MON->m_sdrMaxLuminance;
+ return MON->m_imageDescription->with(lum);
+ }
+ return MON->m_imageDescription;
}
PImageDescription CCompositor::getHDRImageDescription() {
diff --git a/src/protocols/ColorManagement.cpp b/src/protocols/ColorManagement.cpp
index fc420ad..0ec8421 100644
--- a/src/protocols/ColorManagement.cpp
+++ b/src/protocols/ColorManagement.cpp
@@ -269,7 +269,13 @@ CColorManagementOutput::CColorManagementOutput(SP<CWpColorManagementOutputV1> re
if (!m_output || !m_output->m_monitor.valid())
RESOURCE->m_resource->sendFailed(WP_IMAGE_DESCRIPTION_V1_CAUSE_NO_OUTPUT, "No output");
else {
- RESOURCE->m_settings = m_output->m_monitor->m_imageDescription;
+ const auto MON = m_output->m_monitor;
+ if (MON->m_imageDescription->value().transferFunction == CM_TRANSFER_FUNCTION_ST2084_PQ && MON->m_sdrMaxLuminance > 0) {
+ auto lum = MON->m_imageDescription->value().luminances;
+ lum.reference = MON->m_sdrMaxLuminance;
+ RESOURCE->m_settings = MON->m_imageDescription->with(lum);
+ } else
+ RESOURCE->m_settings = MON->m_imageDescription;
RESOURCE->sendMaybeReady();
}
diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp
index ddc034d..7fb8cae 100644
--- a/src/protocols/core/Compositor.cpp
+++ b/src/protocols/core/Compositor.cpp
@@ -685,7 +685,14 @@ PImageDescription CWLSurfaceResource::getPreferredImageDescription() {
else if (m_hlSurface.valid() && WINDOW)
monitor = WINDOW->m_monitor;
- return monitor ? monitor->m_imageDescription : g_pCompositor->getPreferredImageDescription();
+ if (!monitor)
+ return g_pCompositor->getPreferredImageDescription();
+ if (monitor->m_imageDescription->value().transferFunction == NColorManagement::CM_TRANSFER_FUNCTION_ST2084_PQ && monitor->m_sdrMaxLuminance > 0) {
+ auto lum = monitor->m_imageDescription->value().luminances;
+ lum.reference = monitor->m_sdrMaxLuminance;
+ return monitor->m_imageDescription->with(lum);
+ }
+ return monitor->m_imageDescription;
}
void CWLSurfaceResource::sortSubsurfaces() { |
Uh oh!
There was an error while loading. Please reload this page.
What I'm seeing
On an HDR output, color-managed apps (anything using
wp_color_management— e.g. Brave/Chromium, VS Code, Electron apps) render their SDR UI noticeably dimmer than the rest of the desktop.Non-color-managed ("dumb") SDR clients like kitty or Dolphin, and XWayland apps, look correctly bright — but native-Wayland color-managed apps look washed out / dim by comparison.
There's currently no way to control the brightness those color-managed apps are shown at.
sdr_max_luminancehas no effect on them.Steps to reproduce
cm = hdr,bitdepth = 10).sdr_max_luminancedoesn't change it.Root cause (from reading the code)
HDR_REF_LUMINANCE(203) viaCImageDescription::getTFRefLuminance()(src/helpers/cm/ColorManagement.hpp).CMonitor's HDR image-description build (src/helpers/Monitor.cpp) setsluminances.referencefrom that, and themin_luminance/max_luminanceoverride path explicitly keeps.referenceunchanged — so there's no way to change it per output.src/protocols/ColorManagement.cpp) and used as the destination reference when compositing, so color-managed clients end up anchoredat 203 nits.
sdr_max_luminanceonly feeds the SDR→HDR mapping ingetCMSettings()for non-color-managed surfaces, so it can't affect color-managed apps.Net: there's no per-output control over the reference luminance that color-managed apps are rendered at.
Proposed change
Add a per-output
monitorv2option, e.g.reference_luminance(default-1= current behavior, fully opt-in / non-breaking), that overrides the HDR image description's reference luminance.Setting it (e.g. ~450–500) makes color-managed apps render their SDR content at the configured brightness so they match the rest of the desktop, while still keeping HDR.
Optionally, when unset it could derive from the EDID
desiredMaxFrameAverageLuminance(clamped to a sane range), but since that changes existing behavior I'd keep it out of the initial changeunless that's wanted.
Status
I have a small working patch (tested on 0.55.2, mini-LED HDR panel): with
reference_luminanceset, native-Wayland Chromium/Electron apps render their SDR UI at the configured brightness andkeep HDR working. Happy to open a PR — minimal, opt-in, non-breaking — if this direction makes sense, or to adjust to whatever design you'd prefer.
All reactions