From 4746361cb7bef36a962d9db7539595c562de3bb9 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Wed, 15 Oct 2025 20:59:12 +0200 Subject: [PATCH] cmm: ignore backend luminance with the default EOTF --- jay-config/src/video.rs | 4 ++++ src/cli/randr.rs | 4 ++++ src/ifs/wl_output.rs | 29 +++++++++-------------------- toml-spec/spec/spec.generated.md | 4 ++++ toml-spec/spec/spec.yaml | 4 ++++ 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/jay-config/src/video.rs b/jay-config/src/video.rs index 56b8a271..05d6ae0d 100644 --- a/jay-config/src/video.rs +++ b/jay-config/src/video.rs @@ -304,6 +304,10 @@ impl Connector { /// This should only be used with the PQ transfer function. If the default transfer /// function is used, you should instead calibrate the hardware directly. /// + /// When used with the default transfer function, the default brightness is anchored + /// at 80 cd/m^2. That is, setting this to 40 cd/m^2 makes everything appear half as + /// bright as normal and creates 50% HDR headroom. + /// /// This has no effect unless the vulkan renderer is used. pub fn set_brightness(self, brightness: Option) { get!().connector_set_brightness(self, brightness); diff --git a/src/cli/randr.rs b/src/cli/randr.rs index cec9887a..df63d735 100644 --- a/src/cli/randr.rs +++ b/src/cli/randr.rs @@ -386,6 +386,10 @@ pub struct BrightnessArgs { /// When using the default EOTF, you likely want to set this to `default` /// and adjust the display hardware brightness setting instead. /// + /// When used with the default transfer function, the default brightness is anchored + /// at 80 cd/m^2. That is, setting this to 40 cd/m^2 makes everything appear half as + /// bright as normal and creates 50% HDR headroom. + /// /// This has no effect unless the vulkan renderer is used. #[clap(verbatim_doc_comment, value_parser = parse_brightness)] brightness: Brightness, diff --git a/src/ifs/wl_output.rs b/src/ifs/wl_output.rs index f0dcd5b4..9925ff87 100644 --- a/src/ifs/wl_output.rs +++ b/src/ifs/wl_output.rs @@ -361,30 +361,19 @@ impl WlOutputGlobal { } pub fn update_color_description(&self) -> bool { - let mut luminance = Luminance::SRGB; - let tf = match self.btf.get() { - BackendEotfs::Default => { - if let Some(brightness) = self.persistent.brightness.get() { - let output_max = match self.luminance { - None => 80.0, - Some(v) => v.max, - }; - luminance.white.0 = luminance.max.0 * brightness / output_max; - } - Eotf::Gamma22 - } - BackendEotfs::Pq => { - luminance = Luminance::ST2084_PQ; - if let Some(brightness) = self.persistent.brightness.get() { - luminance.white.0 = brightness; - } - Eotf::St2084Pq - } + let (mut luminance, tf) = match self.btf.get() { + BackendEotfs::Default => (Luminance::SRGB, Eotf::Gamma22), + BackendEotfs::Pq => (Luminance::ST2084_PQ, Eotf::St2084Pq), }; + if let Some(brightness) = self.persistent.brightness.get() { + luminance.white.0 = brightness; + } let mut target_luminance = luminance.to_target(); let mut max_cll = None; let mut max_fall = None; - if let Some(l) = self.luminance { + if let Some(l) = self.luminance + && self.btf.get() == BackendEotfs::Pq + { target_luminance.min = F64(l.min); target_luminance.max = F64(l.max); max_cll = Some(F64(l.max)); diff --git a/toml-spec/spec/spec.generated.md b/toml-spec/spec/spec.generated.md index 43a32c02..c6ea9050 100644 --- a/toml-spec/spec/spec.generated.md +++ b/toml-spec/spec/spec.generated.md @@ -857,6 +857,10 @@ The string should have one of the following values: - `default`: The maximum brightness of the output. - `PQ`: 203 cd/m^2 + + When used with the default transfer function, the default brightness is anchored + at 80 cd/m^2. That is, setting this to 40 cd/m^2 makes everything appear half as + bright as normal and creates 50% HDR headroom. #### A number diff --git a/toml-spec/spec/spec.yaml b/toml-spec/spec/spec.yaml index 32d122bc..59fa300e 100644 --- a/toml-spec/spec/spec.yaml +++ b/toml-spec/spec/spec.yaml @@ -3425,6 +3425,10 @@ Brightness: - `default`: The maximum brightness of the output. - `PQ`: 203 cd/m^2 + + When used with the default transfer function, the default brightness is anchored + at 80 cd/m^2. That is, setting this to 40 cd/m^2 makes everything appear half as + bright as normal and creates 50% HDR headroom. - kind: number description: | The brightness in cd/m^2.