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 <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2024-03-27 11:06:55 -03:00
parent 9707a3320d
commit 89a57c7b10
3 changed files with 33 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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);