color: add weston_cm_send_parametric_info()

Implementation of sending the protocol info events for an arbitrary
parametric image description.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2025-06-17 14:43:04 +03:00 committed by Leandro Ribeiro
parent 03cad2e46b
commit 2aca058b69
3 changed files with 42 additions and 7 deletions

View file

@ -763,13 +763,10 @@ cmlcms_send_image_desc_info(struct cm_image_desc_info *cm_image_desc_info,
if (cprof->type == CMLCMS_PROFILE_TYPE_ICC && cprof != cm->sRGB_profile) {
return cmlcms_send_icc_info(cm_image_desc_info, cprof);
} else {
/* TODO: we still don't support parametric color profiles that
* are not the stock one. This should change when we start
* advertising parametric image description support in our
* color-management protocol implementation. */
if (cprof != cm->sRGB_profile)
weston_assert_not_reached(compositor, "we don't support parametric " \
"cprof's that are not the stock sRGB one");
if (cprof != cm->sRGB_profile) {
weston_cm_send_parametric_info(cm_image_desc_info, cprof->params);
return true;
}
/* Stock sRGB color profile. TODO: when we add support for
* parametric color profiles, the stock sRGB will be crafted

View file

@ -280,6 +280,40 @@ weston_cm_send_target_luminances(struct cm_image_desc_info *cm_image_desc_info,
max_lum);
}
/**
* Send complete parametric image description information to the client.
*/
WL_EXPORT void
weston_cm_send_parametric_info(struct cm_image_desc_info *cm_image_desc_info,
const struct weston_color_profile_params *par)
{
if (par->primaries_info)
weston_cm_send_primaries_named(cm_image_desc_info, par->primaries_info);
weston_cm_send_primaries(cm_image_desc_info, &par->primaries);
weston_cm_send_target_primaries(cm_image_desc_info, &par->target_primaries);
weston_cm_send_tf(cm_image_desc_info, &par->tf);
weston_cm_send_luminances(cm_image_desc_info, par->min_luminance,
par->max_luminance, par->reference_white_luminance);
if (par->target_min_luminance >= 0.0f && par->target_max_luminance >= 0.0f) {
weston_cm_send_target_luminances(cm_image_desc_info,
par->target_min_luminance,
par->target_max_luminance);
}
if (par->maxCLL > 0.0f) {
wp_image_description_info_v1_send_target_max_cll(cm_image_desc_info->owner,
par->maxCLL);
}
if (par->maxFALL > 0.0f) {
wp_image_description_info_v1_send_target_max_fall(cm_image_desc_info->owner,
par->maxFALL);
}
}
/**
* Destroy an image description info object.
*/

View file

@ -67,4 +67,8 @@ void
weston_cm_send_target_luminances(struct cm_image_desc_info *cm_image_desc_info,
float min_lum, float max_lum);
void
weston_cm_send_parametric_info(struct cm_image_desc_info *cm_image_desc_info,
const struct weston_color_profile_params *par);
#endif /* WESTON_COLOR_MANAGEMENT_H */