From b79aee2a2a8991d831bcdfa42b3564d6feded38b Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Sun, 8 Mar 2026 21:46:53 -0300 Subject: [PATCH] color: add KMS colorop 1D curves to tf_info Signed-off-by: Leandro Ribeiro --- libweston/color-properties.c | 28 ++++++++++++++++++++++++++++ libweston/color-properties.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/libweston/color-properties.c b/libweston/color-properties.c index 1d39c54fc..6e9913887 100644 --- a/libweston/color-properties.c +++ b/libweston/color-properties.c @@ -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, }, }; diff --git a/libweston/color-properties.h b/libweston/color-properties.h index 9246446a5..7698242bb 100644 --- a/libweston/color-properties.h +++ b/libweston/color-properties.h @@ -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. */