From 89a57c7b10d35156d0178355244accfb46e5e3e5 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Wed, 27 Mar 2024 11:06:55 -0300 Subject: [PATCH] color: keep track of supported primaries and transfer functions In the next commits we'll start support clients that want to create image descriptions through params using the CM&HDR protocol extension. In order to do that, we'll have to expose the primaries and transfer functions that the color manager supports. So keep track of that. Signed-off-by: Leandro Ribeiro --- libweston/color-lcms/color-lcms.c | 15 +++++++++++++++ libweston/color-noop.c | 2 ++ libweston/color.h | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/libweston/color-lcms/color-lcms.c b/libweston/color-lcms/color-lcms.c index 593fea200..9dfb5f648 100644 --- a/libweston/color-lcms/color-lcms.c +++ b/libweston/color-lcms/color-lcms.c @@ -506,6 +506,21 @@ weston_color_manager_create(struct weston_compositor *compositor) (1 << WESTON_RENDER_INTENT_RELATIVE) | (1 << WESTON_RENDER_INTENT_RELATIVE_BPC); + /* We support all primaries named. */ + cm->base.supported_primaries_named = (1 << WESTON_PRIMARIES_CICP_SRGB) | + (1 << WESTON_PRIMARIES_CICP_PAL_M) | + (1 << WESTON_PRIMARIES_CICP_PAL) | + (1 << WESTON_PRIMARIES_CICP_NTSC) | + (1 << WESTON_PRIMARIES_CICP_GENERIC_FILM) | + (1 << WESTON_PRIMARIES_CICP_BT2020) | + (1 << WESTON_PRIMARIES_CICP_CIE1931_XYZ) | + (1 << WESTON_PRIMARIES_CICP_DCI_P3) | + (1 << WESTON_PRIMARIES_CICP_DISPLAY_P3) | + (1 << WESTON_PRIMARIES_ADOBE_RGB); + + /* We still don't support any tf named. */ + cm->base.supported_tf_named = 0; + wl_list_init(&cm->color_transform_list); wl_list_init(&cm->color_profile_list); diff --git a/libweston/color-noop.c b/libweston/color-noop.c index 22ca289cb..bf1098606 100644 --- a/libweston/color-noop.c +++ b/libweston/color-noop.c @@ -264,6 +264,8 @@ weston_color_manager_noop_create(struct weston_compositor *compositor) /* We don't support anything related to the CM&HDR protocol extension */ cm->base.supported_color_features = 0; cm->base.supported_rendering_intents = 0; + cm->base.supported_primaries_named = 0; + cm->base.supported_tf_named = 0; return &cm->base; } diff --git a/libweston/color.h b/libweston/color.h index 8269b12d6..493ed3584 100644 --- a/libweston/color.h +++ b/libweston/color.h @@ -410,6 +410,22 @@ struct weston_color_manager { */ uint32_t supported_rendering_intents; + /** + * Supported primaries named from Wayland CM&HDR protocol extension. + * + * If v (v being enum weston_color_primaries v) is a supported + * primaries named, the bit v of this will be set to 1. + */ + uint32_t supported_primaries_named; + + /** + * Supported tf named from Wayland CM&HDR protocol extension. + * + * If v (v being enum weston_transfer_function v) is a supported + * tf named, the bit v of this will be set to 1. + */ + uint32_t supported_tf_named; + /** Initialize color manager */ bool (*init)(struct weston_color_manager *cm);