libweston: add basic output color characteristics API

This adds color_chracteristics field in weston_output. This field is
intended to be set by compositor frontends and read by color managers.
Color managers can use this information when choosing the output color
space and dynamic range, particularly when no ICC profile has been set.

This is most useful for HDR outputs, where the HDR static metadata for
PQ mode or the display luminance parameters for HLG mode can be based on
color_characteristics.

The fields of weston_color_characteristics mirror the information
available in EDID. However, using EDID information as-is has several
caveats, so the decision to use EDID for this is left for the frontend
and ultimately to the end user.

There are no defined ranges or validity checks for this data. The color
manager will have to validate the values against whatever it is using
them for.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen
2022-04-26 11:47:07 +03:00
committed by Pekka Paalanen
parent c8db957a0b
commit 3696d9b6a1
2 changed files with 109 additions and 0 deletions
+44
View File
@@ -6764,6 +6764,50 @@ weston_output_get_eotf_mode(const struct weston_output *output)
return output->eotf_mode;
}
/** Set display or monitor basic color characteristics
*
* \param output The output to modify, must be in disabled state.
* \param cc The new characteristics to set, or NULL to unset everything.
*
* This sets the metadata that describes the color characteristics of the
* output in a very simple manner. If a non-NULL color profile is set for the
* output, that will always take precedence.
*
* The initial value has everything unset.
*
* This function is meant to be used by compositor frontends.
*
* \ingroup output
* \sa weston_output_set_color_profile
*/
WL_EXPORT void
weston_output_set_color_characteristics(struct weston_output *output,
const struct weston_color_characteristics *cc)
{
assert(!output->enabled);
if (cc)
output->color_characteristics = *cc;
else
output->color_characteristics.group_mask = 0;
}
/** Get display or monitor basic color characteristics
*
* \param output The output to query.
* \return Pointer to the metadata stored in weston_output.
*
* This function is meant to be used by color manager modules.
*
* \ingroup output
* \sa weston_output_set_color_characteristics
*/
WL_EXPORT const struct weston_color_characteristics *
weston_output_get_color_characteristics(struct weston_output *output)
{
return &output->color_characteristics;
}
/** Initializes a weston_output object with enough data so
** an output can be configured.
*