From 46c0383c14d57a99d6a4ba715aead578c5293b7b Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Mon, 12 Jul 2021 14:23:11 +0300 Subject: [PATCH] color-noop: supports only SDR EOTF mode The no-op color manager will not support any other EOTF mode than SDR. Other modes would require it to set up color transformations. Signed-off-by: Pekka Paalanen --- libweston/color-noop.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/libweston/color-noop.c b/libweston/color-noop.c index 4b0a0c38..0b67d5a6 100644 --- a/libweston/color-noop.c +++ b/libweston/color-noop.c @@ -35,6 +35,18 @@ struct weston_color_manager_noop { struct weston_color_manager base; }; +static bool +check_output_eotf_mode(struct weston_output *output) +{ + if (output->eotf_mode == WESTON_EOTF_MODE_SDR) + return true; + + weston_log("Error: color manager no-op does not support EOTF mode %s of output %s.\n", + weston_eotf_mode_to_str(output->eotf_mode), + output->name); + return false; +} + static struct weston_color_manager_noop * get_cmnoop(struct weston_color_manager *cm_base) { @@ -74,6 +86,9 @@ cmnoop_get_surface_color_transform(struct weston_color_manager *cm_base, /* TODO: Assert surface has no colorspace set */ assert(output->color_profile == NULL); + if (!check_output_eotf_mode(output)) + return false; + /* Identity transform */ surf_xform->transform = NULL; surf_xform->identity_pipeline = true; @@ -88,6 +103,9 @@ cmnoop_get_output_color_transform(struct weston_color_manager *cm_base, { assert(output->color_profile == NULL); + if (!check_output_eotf_mode(output)) + return false; + /* Identity transform */ *xform_out = NULL; @@ -101,6 +119,9 @@ cmnoop_get_sRGB_to_output_color_transform(struct weston_color_manager *cm_base, { assert(output->color_profile == NULL); + if (!check_output_eotf_mode(output)) + return false; + /* Identity transform */ *xform_out = NULL; @@ -114,6 +135,9 @@ cmnoop_get_sRGB_to_blend_color_transform(struct weston_color_manager *cm_base, { assert(output->color_profile == NULL); + if (!check_output_eotf_mode(output)) + return false; + /* Identity transform */ *xform_out = NULL;