color: add KMS colorop 1D curves to tf_info

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
This commit is contained in:
Leandro Ribeiro 2026-03-08 21:46:53 -03:00
parent ea28be0cf8
commit b79aee2a2a
2 changed files with 32 additions and 0 deletions

View file

@ -279,6 +279,8 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_BT1886,
.desc = "BT.1886",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_BT1886,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
/**
* NOTE: This is the BT.1886 special case of L_B = 0 and
@ -292,6 +294,8 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_GAMMA22,
.desc = "assumed display gamma 2.2",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22,
.kms_colorop = WDRM_COLOROP_CURVE_1D_GAMMA_22,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D_GAMMA_22_INV,
.count_parameters = 0,
.curve_params_valid = true,
.curve = POWER_LAW(2.2, true),
@ -301,6 +305,8 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_GAMMA28,
.desc = "assumed display gamma 2.8",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA28,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
.curve_params_valid = true,
.curve = POWER_LAW(2.8, true),
@ -310,12 +316,16 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_EXT_LINEAR,
.desc = "extended linear",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_SRGB,
.desc = "sRGB piece-wise",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB,
.kms_colorop = WDRM_COLOROP_CURVE_1D_SRGB_EOTF,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D_SRGB_INV_EOTF,
.count_parameters = 0,
.curve_params_valid = true,
.curve = SRGB_PIECE_WISE(true),
@ -325,6 +335,8 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_EXT_SRGB,
.desc = "Extended sRGB piece-wise",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_SRGB,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
.curve_params_valid = true,
.curve = SRGB_PIECE_WISE(false),
@ -334,47 +346,63 @@ static const struct weston_color_tf_info color_tf_info_table[] = {
.tf = WESTON_TF_ST240,
.desc = "SMPTE ST 240",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST240,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_ST428,
.desc = "SMPTE ST 428",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST428,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_ST2084_PQ,
.desc = "Perceptual Quantizer",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_LOG_100,
.desc = "logarithmic 100:1",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_LOG_100,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_LOG_316,
.desc = "logarithmic (100*Sqrt(10) : 1)",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_LOG_316,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_XVYCC,
.desc = "IEC 61966-2-4 (xvYCC)",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_XVYCC,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_HLG,
.desc = "Hybrid log-gamma",
.protocol_tf = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_HLG,
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 0,
},
{
.tf = WESTON_TF_POWER,
.desc = "power-law with custom exponent",
.kms_colorop = WDRM_COLOROP_CURVE_1D__COUNT,
.kms_colorop_inverse = WDRM_COLOROP_CURVE_1D__COUNT,
.count_parameters = 1,
},
};

View file

@ -110,6 +110,10 @@ struct weston_color_tf_info {
/** CM&HDR protocol extension value representing the tf. */
uint32_t protocol_tf;
/** KMS 1D curve colorop value representing the tf. */
uint32_t kms_colorop;
uint32_t kms_colorop_inverse;
/* The protocol also has support for parameterized functions, i.e.
* certain known functions that clients can define passing arbitrary
* parameters. */