From e3be3ca41eb3b72bb80f037ad22e94c2597d7c19 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Sun, 29 Mar 2026 15:51:33 +0200 Subject: [PATCH] cmm: add support for absolute_no_adaptation intent --- src/cmm/cmm_render_intent.rs | 9 ++++++++- src/ifs/color_management.rs | 1 + src/ifs/color_management/wp_color_manager_v1.rs | 10 +++++++--- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/cmm/cmm_render_intent.rs b/src/cmm/cmm_render_intent.rs index e9c6d7fe..afb16a30 100644 --- a/src/cmm/cmm_render_intent.rs +++ b/src/cmm/cmm_render_intent.rs @@ -1,5 +1,6 @@ use crate::{ ifs::color_management::{ + ABSOLUTE_NO_ADAPTATION_SINCE, RENDER_INTENT_ABSOLUTE_NO_ADAPTATION, RENDER_INTENT_PERCEPTUAL, RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, }, object::Version, @@ -11,14 +12,18 @@ pub enum RenderIntent { Perceptual, Relative, RelativeBpc, + AbsoluteNoAdaptation, } impl RenderIntent { - pub fn from_wayland(intent: u32, _version: Version) -> Option { + pub fn from_wayland(intent: u32, version: Version) -> Option { let res = match intent { RENDER_INTENT_PERCEPTUAL => Self::Perceptual, RENDER_INTENT_RELATIVE => Self::Relative, RENDER_INTENT_RELATIVE_BPC => Self::RelativeBpc, + RENDER_INTENT_ABSOLUTE_NO_ADAPTATION if version >= ABSOLUTE_NO_ADAPTATION_SINCE => { + Self::AbsoluteNoAdaptation + } _ => return None, }; Some(res) @@ -29,6 +34,7 @@ impl RenderIntent { RenderIntent::Perceptual => true, RenderIntent::RelativeBpc => true, RenderIntent::Relative => false, + RenderIntent::AbsoluteNoAdaptation => false, } } @@ -37,6 +43,7 @@ impl RenderIntent { RenderIntent::Perceptual => true, RenderIntent::RelativeBpc => true, RenderIntent::Relative => true, + RenderIntent::AbsoluteNoAdaptation => false, } } } diff --git a/src/ifs/color_management.rs b/src/ifs/color_management.rs index b739916d..d7295adb 100644 --- a/src/ifs/color_management.rs +++ b/src/ifs/color_management.rs @@ -13,6 +13,7 @@ pub mod wp_image_description_v1; const UNIQUE_CM_IDS_SINCE: Version = Version(2); const SRGB_DEPRECATED_SINCE: Version = Version(2); const COMPOUND_POWER_2_4_SINCE: Version = Version(2); +pub const ABSOLUTE_NO_ADAPTATION_SINCE: Version = Version(2); const PRIMARIES_MUL: f64 = 1_000_000.0; const PRIMARIES_MUL_INV: f64 = 1.0 / PRIMARIES_MUL; diff --git a/src/ifs/color_management/wp_color_manager_v1.rs b/src/ifs/color_management/wp_color_manager_v1.rs index b644ed68..e3f920f3 100644 --- a/src/ifs/color_management/wp_color_manager_v1.rs +++ b/src/ifs/color_management/wp_color_manager_v1.rs @@ -4,9 +4,10 @@ use { globals::{Global, GlobalName}, ifs::{ color_management::{ - COMPOUND_POWER_2_4_SINCE, FEATURE_EXTENDED_TARGET_VOLUME, - FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, FEATURE_SET_TF_POWER, - RENDER_INTENT_RELATIVE, RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE, + ABSOLUTE_NO_ADAPTATION_SINCE, COMPOUND_POWER_2_4_SINCE, + FEATURE_EXTENDED_TARGET_VOLUME, FEATURE_SET_MASTERING_DISPLAY_PRIMARIES, + FEATURE_SET_TF_POWER, RENDER_INTENT_ABSOLUTE_NO_ADAPTATION, RENDER_INTENT_RELATIVE, + RENDER_INTENT_RELATIVE_BPC, SRGB_DEPRECATED_SINCE, TRANSFER_FUNCTION_COMPOUND_POWER_2_4, consts::{ FEATURE_PARAMETRIC, FEATURE_SET_LUMINANCES, FEATURE_SET_PRIMARIES, @@ -80,6 +81,9 @@ impl WpColorManagerV1 { self.send_supported_intent(RENDER_INTENT_PERCEPTUAL); self.send_supported_intent(RENDER_INTENT_RELATIVE); self.send_supported_intent(RENDER_INTENT_RELATIVE_BPC); + if self.version >= ABSOLUTE_NO_ADAPTATION_SINCE { + self.send_supported_intent(RENDER_INTENT_ABSOLUTE_NO_ADAPTATION); + } self.send_supported_feature(FEATURE_PARAMETRIC); self.send_supported_feature(FEATURE_SET_PRIMARIES); self.send_supported_feature(FEATURE_SET_LUMINANCES);