diff options
author | Pekka Paalanen <pekka.paalanen@collabora.com> | 2023-09-01 14:50:20 +0300 |
---|---|---|
committer | Pekka Paalanen <pq@iki.fi> | 2024-05-06 10:39:42 +0000 |
commit | 53493aaddcad885cb35529555151ed2caeea76d5 (patch) | |
tree | 457b9652ee8dc9ea418ccc3845caa77d50f27061 /include | |
parent | cd622900ee5f91387db934e57cef49920417b75b (diff) |
libweston: add colorimetry_mode API
This API is mostly for use by the DRM-backend. Colorimetry mode is is
the KMS connector property "Colorspace" which defines the video signal
encoding colorimetry. A video sink indicates the supported modes in EDID
or DisplayID.
This patch adds the libweston API that allows backends to indicate the
supported modes for the frontends, and frontends to set the mode to be
used by backends. Colorimetry mode does not directly affect color
management inside Weston, it is only metadata for the video sink. It is
the frontend's responsibility to set up an output color profile that
agrees with the colorimetry mode. (That API has not been implemented
yet.) eotf_mode will be the same.
There is only one reason to make this a libweston core API instead of
a backend-drm API: when wayland-backend gains color-management protocol
support, meaning it can forward WCG and HDR content correctly to a
host compositor, the supported colorimetry modes can be determined from
the host compositor's supported color-management features, allowing the
guest Weston to pick some other output image description than the host
compositor's preferred image description. This likely allows only a few
other choices from standard colorspaces, so it's possible this isn't
sufficient for that use case.
Either way, it is easy to just copy the eotf_mode API design, and since
colorimetry_mode and eotf_mode go together, let both have the same API
design. It is possible to convert this to backend-drm API later.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libweston/libweston.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index dc0f9ccb..d5018764 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -222,6 +222,55 @@ struct weston_testsuite_data { void *test_private_data; }; +/** Colorimetry mode for outputs and heads + * + * A list of colorimetry modes for driving displays, defined by ANSI/CTA-861-H. + * + * On heads, a bitmask of one or more entries shows which modes are claimed + * supported. + * + * On outputs, the mode to be used for driving the video sink. + * + * Default (RGB) colorimetry differs from all the others in that the signal + * colorimetry is not defined here. It is defined by the video sink, and it + * may be described in e.g. EDID. + */ +enum weston_colorimetry_mode { + /** Invalid colorimetry mode, or none supported. */ + WESTON_COLORIMETRY_MODE_NONE = 0, + + /** Default (RGB) colorimetry, video sink dependant */ + WESTON_COLORIMETRY_MODE_DEFAULT = 0x01, + + /** Rec. ITU-R BT.2020 constant luminance YCbCr */ + WESTON_COLORIMETRY_MODE_BT2020_CYCC = 0x02, + + /** Rec. ITU-R BT.2020 non-constant luminance YCbCr */ + WESTON_COLORIMETRY_MODE_BT2020_YCC = 0x04, + + /** Rec. ITU-R BT.2020 RGB */ + WESTON_COLORIMETRY_MODE_BT2020_RGB = 0x08, + + /** SMPTE ST 2113 DCI-P3 RGB D65 */ + WESTON_COLORIMETRY_MODE_P3D65 = 0x10, + + /** SMPTE ST 2113 DCI-P3 RGB Theater */ + WESTON_COLORIMETRY_MODE_P3DCI = 0x20, + + /** Rec. ITU-R BT.2100 ICtCp HDR (with PQ and/or HLG)*/ + WESTON_COLORIMETRY_MODE_ICTCP = 0x40, +}; + +/** Bitmask of all defined colorimetry modes */ +#define WESTON_COLORIMETRY_MODE_ALL_MASK \ + ((uint32_t)(WESTON_COLORIMETRY_MODE_DEFAULT | \ + WESTON_COLORIMETRY_MODE_BT2020_CYCC | \ + WESTON_COLORIMETRY_MODE_BT2020_YCC | \ + WESTON_COLORIMETRY_MODE_BT2020_RGB | \ + WESTON_COLORIMETRY_MODE_P3D65 | \ + WESTON_COLORIMETRY_MODE_P3DCI | \ + WESTON_COLORIMETRY_MODE_ICTCP)) + /** EOTF mode for outputs and heads * * A list of EOTF modes for driving displays, defined by CTA-861-G for @@ -351,6 +400,7 @@ struct weston_head { bool connected; /**< is physically connected */ bool non_desktop; /**< non-desktop display, e.g. HMD */ uint32_t supported_eotf_mask; /**< supported weston_eotf_mode bits */ + uint32_t supported_colorimetry_mask; /**< supported weston_colorimetry_mode bits */ /** Current content protection status */ enum weston_hdcp_protection current_protection; @@ -501,6 +551,7 @@ struct weston_output { struct weston_color_profile *color_profile; bool from_blend_to_output_by_backend; enum weston_eotf_mode eotf_mode; + enum weston_colorimetry_mode colorimetry_mode; struct weston_color_characteristics color_characteristics; struct weston_output_color_outcome *color_outcome; @@ -2532,6 +2583,13 @@ enum weston_eotf_mode weston_output_get_eotf_mode(const struct weston_output *output); void +weston_output_set_colorimetry_mode(struct weston_output *output, + enum weston_colorimetry_mode colorimetry_mode); + +enum weston_colorimetry_mode +weston_output_get_colorimetry_mode(const struct weston_output *output); + +void weston_output_set_color_characteristics(struct weston_output *output, const struct weston_color_characteristics *cc); @@ -2556,6 +2614,9 @@ weston_output_disable(struct weston_output *output); uint32_t weston_output_get_supported_eotf_modes(struct weston_output *output); +uint32_t +weston_output_get_supported_colorimetry_modes(struct weston_output *output); + void weston_output_power_off(struct weston_output *output); |