From a5ffb96d232238ca8c3ea290d237e1f1fcd9ced3 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Tue, 9 Dec 2025 14:30:03 +0200 Subject: [PATCH] color-lcms: adjust supported TF mask TF_SRGB will be deprecated, best to never advertise it. The test can simply use gamma22 instead. TF_EXT_LINEAR has an implementation and should be usable nowadays. TF_ST2084_PQ, GAMMA22 and GAMMA28 likewise. Signed-off-by: Pekka Paalanen --- libweston/color-lcms/color-lcms.c | 14 ++-------- tests/color-management-parametric-test.c | 34 ++++++++++++------------ 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/libweston/color-lcms/color-lcms.c b/libweston/color-lcms/color-lcms.c index 0effb74f3..aae6a2722 100644 --- a/libweston/color-lcms/color-lcms.c +++ b/libweston/color-lcms/color-lcms.c @@ -514,7 +514,6 @@ weston_color_manager_create(struct weston_compositor *compositor) cm->base.get_surface_color_transform = cmlcms_get_surface_color_transform; cm->base.create_output_color_outcome = cmlcms_create_output_color_outcome; - /* We support all color features. */ cm->base.supported_color_features = (1 << WESTON_COLOR_FEATURE_ICC) | (1 << WESTON_COLOR_FEATURE_PARAMETRIC) | (1 << WESTON_COLOR_FEATURE_SET_PRIMARIES) | @@ -529,7 +528,6 @@ weston_color_manager_create(struct weston_compositor *compositor) (1 << WESTON_RENDER_INTENT_RELATIVE) | (1 << WESTON_RENDER_INTENT_RELATIVE_BPC); - /* We support all primaries named. */ cm->base.supported_primaries_named = (1 << WESTON_PRIMARIES_CICP_SRGB) | (1 << WESTON_PRIMARIES_CICP_PAL_M) | (1 << WESTON_PRIMARIES_CICP_PAL) | @@ -541,18 +539,10 @@ weston_color_manager_create(struct weston_compositor *compositor) (1 << WESTON_PRIMARIES_CICP_DISPLAY_P3) | (1 << WESTON_PRIMARIES_ADOBE_RGB); - /** - * TODO: this is a lie just to make the color-management-parametric - * tests to work. Without this the tests would be much more limited. We - * actually need to implement such TF's. There's no problem doing that, - * as parametric color profiles themselves are still unsupported. - */ - - /* We need to implement each tf, and we support only a few of them. */ cm->base.supported_tf_named = (1 << WESTON_TF_GAMMA22) | (1 << WESTON_TF_GAMMA28) | - (1 << WESTON_TF_SRGB) | - (1 << WESTON_TF_ST2084_PQ); + (1 << WESTON_TF_ST2084_PQ) | + (1 << WESTON_TF_EXT_LINEAR); wl_list_init(&cm->color_transform_list); wl_list_init(&cm->color_profile_list); diff --git a/tests/color-management-parametric-test.c b/tests/color-management-parametric-test.c index f001bd60d..4e2317044 100644 --- a/tests/color-management-parametric-test.c +++ b/tests/color-management-parametric-test.c @@ -95,10 +95,10 @@ static const struct test_case test_cases[] = { /******** Successful cases *******/ { - /* sRGB primaries with sRGB TF; succeeds. */ + /* sRGB primaries with gamma22; succeeds. */ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, .primaries = NULL, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -112,10 +112,10 @@ static const struct test_case test_cases[] = { .error_point = ERROR_POINT_NONE, }, { - /* Custom primaries with sRGB TF; succeeds. */ + /* Custom primaries with gamma22; succeeds. */ .primaries_named = NOT_SET, .primaries = &color_gamut_sRGB, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -129,10 +129,10 @@ static const struct test_case test_cases[] = { .error_point = ERROR_POINT_NONE, }, { - /* sRGB primaries, sRGB TF and valid luminance values; succeeds. */ + /* sRGB primaries, gamma22 and valid luminance values; succeeds. */ .primaries_named = NOT_SET, .primaries = &color_gamut_sRGB, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = 0.5, .primaries_max_lum = 2000, @@ -163,10 +163,10 @@ static const struct test_case test_cases[] = { .error_point = ERROR_POINT_NONE, }, { - /* sRGB primaries, sRGB TF and valid target primaries; succeeds. */ + /* sRGB primaries, gamma22 and valid target primaries; succeeds. */ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, .primaries = NULL, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -309,7 +309,7 @@ static const struct test_case test_cases[] = { * protocol error. */ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, .primaries = NULL, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -327,7 +327,7 @@ static const struct test_case test_cases[] = { * protocol error. */ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, .primaries = NULL, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -381,7 +381,7 @@ static const struct test_case test_cases[] = { * defined range); graceful failure. */ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, .primaries = NULL, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -399,7 +399,7 @@ static const struct test_case test_cases[] = { * graceful failure. */ .primaries_named = WP_COLOR_MANAGER_V1_PRIMARIES_SRGB, .primaries = NULL, - .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB, + .tf_named = WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22, .tf_power = NOT_SET, .primaries_min_lum = NOT_SET, .primaries_max_lum = NOT_SET, @@ -455,7 +455,7 @@ color_manager_get(struct client *client) test_assert_u32_eq(cm->supported_tf, (1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22) | (1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA28) | - (1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB) | + (1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_EXT_LINEAR) | (1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ)); test_assert_true(cm->init_done); @@ -736,10 +736,10 @@ TEST(set_tf_named_twice) image_desc_creator_param = color_manager_create_param(cm); wp_image_description_creator_params_v1_set_tf_named(image_desc_creator_param, - WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB); + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22); client_roundtrip(client); /* make sure connection is still valid */ wp_image_description_creator_params_v1_set_tf_named(image_desc_creator_param, - WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB); + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22); expect_protocol_error(client, &wp_image_description_creator_params_v1_interface, WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET); wp_image_description_creator_params_v1_destroy(image_desc_creator_param); @@ -763,7 +763,7 @@ TEST(set_tf_power_then_tf_named) 2.4 * 10000); client_roundtrip(client); /* make sure connection is still valid */ wp_image_description_creator_params_v1_set_tf_named(image_desc_creator_param, - WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB); + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22); expect_protocol_error(client, &wp_image_description_creator_params_v1_interface, WP_IMAGE_DESCRIPTION_CREATOR_PARAMS_V1_ERROR_ALREADY_SET); wp_image_description_creator_params_v1_destroy(image_desc_creator_param); @@ -784,7 +784,7 @@ TEST(set_tf_named_then_tf_power) image_desc_creator_param = color_manager_create_param(cm); wp_image_description_creator_params_v1_set_tf_named(image_desc_creator_param, - WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB); + WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22); client_roundtrip(client); /* make sure connection is still valid */ wp_image_description_creator_params_v1_set_tf_power(image_desc_creator_param, 2.4 * 10000);