From 2b7b3b53102cf1b757f34cf1c35fb8eee940ff4e Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Thu, 4 Dec 2025 14:07:14 +0100 Subject: [PATCH] cmm: don't use display primaries as target_primaries in SDR mode --- src/ifs/wl_output.rs | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/ifs/wl_output.rs b/src/ifs/wl_output.rs index 9925ff87..40c8e753 100644 --- a/src/ifs/wl_output.rs +++ b/src/ifs/wl_output.rs @@ -379,16 +379,27 @@ impl WlOutputGlobal { max_cll = Some(F64(l.max)); max_fall = Some(F64(l.max_fall)); } - let primaries = match self.bcs.get() { - BackendColorSpace::Default => NamedPrimaries::Srgb, - BackendColorSpace::Bt2020 => NamedPrimaries::Bt2020, - }; + let named_primaries; + let primaries; + let target_primaries; + match self.bcs.get() { + BackendColorSpace::Default => { + named_primaries = NamedPrimaries::Srgb; + primaries = named_primaries.primaries(); + target_primaries = primaries; + } + BackendColorSpace::Bt2020 => { + named_primaries = NamedPrimaries::Bt2020; + primaries = named_primaries.primaries(); + target_primaries = self.primaries; + } + } let cd = self.state.color_manager.get_description( - Some(primaries), - primaries.primaries(), + Some(named_primaries), + primaries, luminance, tf, - self.primaries, + target_primaries, target_luminance, max_cll, max_fall,